bueddl

Untitled

Jan 4th, 2016
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.03 KB | None | 0 0
  1.  
  2. my_view::my_view()
  3.     : game::manialink::view("my_view.map_list"),
  4.       m_close_button("Close")
  5. {
  6.     m_map_list.columns.add("ID");
  7.     m_map_list.columns.add("Name");
  8.     m_map_list.columns.add("Author");
  9.     m_map_list.columns.add("Record");
  10.     add(m_map_list);
  11.  
  12.     close_button.on_click() += mem_fn(*this, &my_view::on_close_button_clicked);
  13.     add(close_button);
  14. }
  15.  
  16. void my_view::show(std::vector<std::tuple<const game::map&, const record::record&>> list_data)
  17. {
  18.     for (const auto &entry : list_data) {
  19.         const auto& map = entry->get<0>();
  20.         const auto& record = entry->get<1>();
  21.  
  22.         // Add map, record, record->player
  23.         game::manialink::controls::list_item li;
  24.  
  25.         li.data.add(map.id());
  26.         li.data.add(map.name());
  27.         li.data.add(map.author().nickname());
  28.         li.data.add(record.time());
  29.  
  30.         m_map_list.items.add(li);
  31.     }
  32. }
  33.  
  34. void my_view::on_close_button_clicked(game::player &player)
  35. {
  36.     // Close, aka. send empty document
  37.     game::manialink::controls::document ml("my_view.map_list");
  38.     player.gameserver().send_manialink_page_async(player, ml);
  39. }
Add Comment
Please, Sign In to add comment