WIP gui2 lobby
This commit is contained in:
parent
eb3f0cd9e2
commit
abf8b9e4a2
3 changed files with 352 additions and 6 deletions
|
@ -24,7 +24,7 @@
|
|||
horizontal_alignment = "left"
|
||||
[label]
|
||||
definition = "title"
|
||||
label = _ "Lobby"
|
||||
label = _ "Multiplayer Lobby"
|
||||
[/label]
|
||||
[/column]
|
||||
[/row]
|
||||
|
@ -33,10 +33,315 @@
|
|||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
[label]
|
||||
definition = "default"
|
||||
label = _ "Lobby"
|
||||
[/label]
|
||||
[grid]
|
||||
[row]
|
||||
grow_factor = 0
|
||||
[column]
|
||||
[grid]
|
||||
[row]
|
||||
[column]
|
||||
grow_factor = 1
|
||||
[listbox]
|
||||
id = "game_list"
|
||||
definition = "default"
|
||||
[header]
|
||||
[row]
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "name"
|
||||
definition = "default"
|
||||
label = "Name"
|
||||
[/label]
|
||||
[/column]
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "map"
|
||||
definition = "default"
|
||||
label = "Map"
|
||||
[/label]
|
||||
[/column]
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "era"
|
||||
definition = "default"
|
||||
label = "Era"
|
||||
[/label]
|
||||
[/column]
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "slots"
|
||||
definition = "default"
|
||||
label = "Slots"
|
||||
[/label]
|
||||
[/column]
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "options"
|
||||
definition = "default"
|
||||
label = "Options"
|
||||
[/label]
|
||||
[/column]
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "join"
|
||||
definition = "default"
|
||||
label = "Join"
|
||||
[/label]
|
||||
[/column]
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "observe"
|
||||
definition = "default"
|
||||
label = "Observe"
|
||||
[/label]
|
||||
[/column]
|
||||
[/row]
|
||||
[/header]
|
||||
[list_definition]
|
||||
[row]
|
||||
[column]
|
||||
vertical_grow = "true"
|
||||
horizontal_grow = "true"
|
||||
[toggle_panel]
|
||||
definition = "default"
|
||||
return_value_id = "ok"
|
||||
[grid]
|
||||
[row]
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "name"
|
||||
definition = "default"
|
||||
[/label]
|
||||
[/column]
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "map"
|
||||
definition = "default"
|
||||
[/label]
|
||||
[/column]
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "era"
|
||||
definition = "default"
|
||||
[/label]
|
||||
[/column]
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "slots"
|
||||
definition = "default"
|
||||
[/label]
|
||||
[/column]
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "options"
|
||||
definition = "default"
|
||||
[/label]
|
||||
[/column]
|
||||
[column]
|
||||
[button]
|
||||
id = "join"
|
||||
definition = "default"
|
||||
label = _ "Join"
|
||||
[/button]
|
||||
[/column]
|
||||
[column]
|
||||
[button]
|
||||
id = "observe"
|
||||
definition = "default"
|
||||
label = _ "Observe"
|
||||
[/button]
|
||||
[/column]
|
||||
[/row]
|
||||
[/grid]
|
||||
[/toggle_panel]
|
||||
[/column]
|
||||
[/row]
|
||||
[/list_definition]
|
||||
[/listbox]
|
||||
[/column]
|
||||
[/row]
|
||||
[row]
|
||||
[column]
|
||||
[grid]
|
||||
[row]
|
||||
[column]
|
||||
[text_box]
|
||||
id = "chat_log"
|
||||
definition = "default"
|
||||
label = ""
|
||||
[/text_box]
|
||||
[/column]
|
||||
[/row]
|
||||
[row]
|
||||
[column]
|
||||
[text_box]
|
||||
id = "chat_input"
|
||||
definition = "default"
|
||||
label = ""
|
||||
[/text_box]
|
||||
[/column]
|
||||
[/row]
|
||||
[row]
|
||||
[column]
|
||||
[button]
|
||||
id = "send_message"
|
||||
definition = "default"
|
||||
label = _ "Send"
|
||||
[/button]
|
||||
[/column]
|
||||
[/row][/grid]
|
||||
[/column]
|
||||
[/row]
|
||||
[/grid]
|
||||
[/column]
|
||||
[column]
|
||||
[grid]
|
||||
[row]
|
||||
[column]
|
||||
[button]
|
||||
id = "quit"
|
||||
definition = "default"
|
||||
label = _ "Quit"
|
||||
[/button]
|
||||
[/column]
|
||||
[/row]
|
||||
[row]
|
||||
[column]
|
||||
[button]
|
||||
id = "settings"
|
||||
definition = "default"
|
||||
label = _ "Settings"
|
||||
[/button]
|
||||
[/column]
|
||||
[/row]
|
||||
[row]
|
||||
[column]
|
||||
[button]
|
||||
id = "refresh"
|
||||
definition = "default"
|
||||
label = _ "Refresh"
|
||||
[/button]
|
||||
[/column]
|
||||
[/row]
|
||||
[row]
|
||||
[column]
|
||||
[button]
|
||||
id = "create"
|
||||
definition = "default"
|
||||
label = _ "Create Game"
|
||||
[/button]
|
||||
[/column]
|
||||
[/row]
|
||||
[row]
|
||||
[column]
|
||||
[button]
|
||||
id = "help"
|
||||
definition = "default"
|
||||
label = _ "Help"
|
||||
[/button]
|
||||
[/column]
|
||||
[/row]
|
||||
[row]
|
||||
[column]
|
||||
[listbox]
|
||||
id = "player_list"
|
||||
definition = "default"
|
||||
[header]
|
||||
[row]
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "player"
|
||||
definition = "default"
|
||||
label = "Player"
|
||||
[/label]
|
||||
[/column]
|
||||
[/row]
|
||||
[/header]
|
||||
[list_definition]
|
||||
[row]
|
||||
[column]
|
||||
vertical_grow = "true"
|
||||
horizontal_grow = "true"
|
||||
[toggle_panel]
|
||||
definition = "default"
|
||||
return_value_id = "ok"
|
||||
[grid]
|
||||
[row]
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "player"
|
||||
definition = "default"
|
||||
[/label]
|
||||
[/column]
|
||||
[/row]
|
||||
[/grid]
|
||||
[/toggle_panel]
|
||||
[/column]
|
||||
[/row]
|
||||
[/list_definition]
|
||||
[/listbox]
|
||||
[/column]
|
||||
[/row]
|
||||
[/grid]
|
||||
[/column]
|
||||
[/row]
|
||||
[/grid]
|
||||
[/column]
|
||||
[/row]
|
||||
[/grid]
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
#include "gui/dialogs/lobby_main.hpp"
|
||||
#include "gui/dialogs/field.hpp"
|
||||
|
||||
#include "gui/widgets/listbox.hpp"
|
||||
#include "foreach.hpp"
|
||||
|
||||
namespace gui2 {
|
||||
|
||||
tlobby_main::tlobby_main()
|
||||
|
@ -27,4 +30,33 @@ twindow* tlobby_main::build_window(CVideo& video)
|
|||
return build(video, get_id(LOBBY_MAIN));
|
||||
}
|
||||
|
||||
void tlobby_main::update_gamelist(const config& cfg)
|
||||
{
|
||||
foreach (const config &game, cfg.child("gamelist").child_range("game"))
|
||||
{
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
std::string tmp;
|
||||
|
||||
tmp = game["name"];
|
||||
utils::truncate_as_wstring(tmp, 20);
|
||||
item["label"] = tmp;
|
||||
data.insert(std::make_pair("name", item));
|
||||
|
||||
tmp = game["mp_era"];
|
||||
utils::truncate_as_wstring(tmp, 20);
|
||||
item["label"] = tmp;
|
||||
data.insert(std::make_pair("name", item));
|
||||
|
||||
gamelist_->add_row(data);
|
||||
}
|
||||
}
|
||||
|
||||
void tlobby_main::pre_show(CVideo& /*video*/, twindow& window)
|
||||
{
|
||||
gamelist_ =
|
||||
dynamic_cast<tlistbox*>(window.find_widget("game_list", false));
|
||||
VALIDATE(gamelist_, missing_widget("game_list"));
|
||||
}
|
||||
|
||||
} // namespace gui2
|
||||
|
|
|
@ -17,17 +17,26 @@
|
|||
|
||||
#include "gui/dialogs/dialog.hpp"
|
||||
|
||||
class config;
|
||||
|
||||
namespace gui2 {
|
||||
|
||||
class tlistbox;
|
||||
|
||||
class tlobby_main : public tdialog
|
||||
{
|
||||
public:
|
||||
tlobby_main();
|
||||
|
||||
void update_gamelist(const config& cfg);
|
||||
private:
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
twindow* build_window(CVideo& video);
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
void pre_show(CVideo& video, twindow& window);
|
||||
|
||||
tlistbox* gamelist_;
|
||||
};
|
||||
|
||||
} // namespace gui2
|
||||
|
|
Loading…
Add table
Reference in a new issue