Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- my_module::my_module()
- {
- }
- void my_module::on_show_map_list_request(game::player &player)
- {
- player.gameserver().get_map_list_async(0, 300,
- [this, player](const game::map_list &map_list)
- {
- // Start output
- game::manialink::controls::document ml("my_module.map_list");
- game::manialink::controls::list ml_map_list;
- ml_map_list.columns.add("ID");
- ml_map_list.columns.add("Name");
- ml_map_list.columns.add("Author");
- ml_map_list.columns.add("Record");
- ml.add(ml_map_list);
- for (const auto &map : map_list) {
- auto record = record_db->get_record_for_map(map);
- // Add map, record, record->player
- game::manialink::controls::list_item li;
- li.data.add(map.id());
- li.data.add(map.name());
- li.data.add(map.author().nickname());
- li.data.add(record.time());
- ml_map_list.items.add(li);
- }
- // End compose output
- game::manialink::controls::button close_button("Close");
- close_button.on_click() += mem_fn(*this, &my_module::on_close_button_clicked);
- ml.add(close_button);
- player.gameserver().send_manialink_page_async(player, ml);
- });
- return;
- }
- void my_module::on_close_button_clicked(game::player &player)
- {
- // Close, aka. send empty document
- game::manialink::controls::document ml("my_module.map_list");
- player.gameserver().send_manialink_page_async(player, ml);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement