Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- my_view::my_view()
- : game::manialink::view("my_view.map_list"),
- m_close_button("Close")
- {
- m_map_list.columns.add("ID");
- m_map_list.columns.add("Name");
- m_map_list.columns.add("Author");
- m_map_list.columns.add("Record");
- add(m_map_list);
- close_button.on_click() += mem_fn(*this, &my_view::on_close_button_clicked);
- add(close_button);
- }
- void my_view::show(std::vector<std::tuple<const game::map&, const record::record&>> list_data)
- {
- for (const auto &entry : list_data) {
- const auto& map = entry->get<0>();
- const auto& record = entry->get<1>();
- // 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());
- m_map_list.items.add(li);
- }
- }
- void my_view::on_close_button_clicked(game::player &player)
- {
- // Close, aka. send empty document
- game::manialink::controls::document ml("my_view.map_list");
- player.gameserver().send_manialink_page_async(player, ml);
- }
Add Comment
Please, Sign In to add comment