MP Lobby: improved game row layout

This includes adding a section for active Modifications as the GUI1 lobby does
This commit is contained in:
Charles Dang 2016-09-01 00:41:31 +11:00
parent 8b15851d3d
commit b726e9fe1d
4 changed files with 143 additions and 59 deletions

View file

@ -3,20 +3,6 @@
### Definition of the lobby screen
###
#define GAMELISTBOX_BODY_LABEL ID LABEL GROW_FACTOR
[column]
grow_factor = {GROW_FACTOR}
horizontal_grow = "true"
border = "left,right"
border_size = 5
[label]
id = {ID}
definition = "default"
label = {LABEL}
[/label]
[/column]
#enddef
#define GAMELISTBOX_BODY_LABEL_TINY ID LABEL
[column]
border = "right"
@ -29,20 +15,6 @@
[/column]
#enddef
#define GAMELISTBOX_BODY_BUTTON ID LABEL
[column]
grow_factor = 1
horizontal_alignment = "right"
border = "left,right"
border_size = 5
[button]
id = {ID}
definition = "default"
label = {LABEL}
[/button]
[/column]
#enddef
#define GAMELISTBOX_BODY_IMAGE ID LABEL TOOLTIP GROW_FACTOR
[column]
grow_factor = {GROW_FACTOR}
@ -73,6 +45,7 @@
definition = "default"
vertical_scrollbar_mode = "always"
horizontal_scrollbar_mode = "never"
[header]
[row]
[column]
@ -98,7 +71,8 @@
[grid]
[row]
[column]
{GUI_FORCE_WIDGET_MINIMUM_SIZE 60 60 (
grow_factor = 0
{GUI_FORCE_WIDGET_MINIMUM_SIZE 72 72 (
border = "all"
border_size = 5
[minimap]
@ -108,53 +82,135 @@
)}
[/column]
[column]
horizontal_grow = "true"
grow_factor = 1
horizontal_grow = "true"
[grid]
[row]
[column]
grow_factor = 1
border = "all"
border_size = 5
horizontal_alignment = "left"
[label]
id = "name"
definition = "default"
[/label]
[/column]
[/row]
[row]
[column]
grow_factor = 1
horizontal_grow = "true"
border = "left,right"
border_size = 5
[label]
id = "scenario"
definition = "default"
[/label]
[/column]
[/row]
[row]
[column]
grow_factor = 1
horizontal_grow = "true"
[grid]
[row]
grow_factor = 1
[column]
grow_factor = 1
border = "left,right,bottom"
grow_factor = 0
horizontal_grow = "true"
border = "left,top,bottom"
border_size = 5
horizontal_alignment = "left"
[label]
id = "name"
definition = "default"
id = "era_label"
definition = "default_small"
label = _ "Era:"
[/label]
[/column]
[column]
grow_factor = 0
border = "left,right,bottom"
horizontal_grow = "true"
border = "all"
border_size = 5
horizontal_alignment = "right"
[label]
id = "status"
id = "era"
definition = "default_small"
[/label]
[/column]
[column]
grow_factor = 0
horizontal_grow = "true"
border = "all"
border_size = 5
[label]
id = "dash"
definition = "default"
label = " — "
[/label]
[/column]
[column]
grow_factor = 0
horizontal_grow = "true"
border = "left,top,bottom"
border_size = 5
[label]
id = "mods_label"
definition = "default_small"
label = _ "Modifications:"
[/label]
[/column]
[column]
grow_factor = 1
horizontal_grow = "true"
border = "all"
border_size = 5
[label]
id = "mods"
definition = "default_small"
[/label]
[/column]
[/row]
[/grid]
[/column]
[/row]
[/grid]
[/column]
[column]
grow_factor = 0
horizontal_alignment = "right"
[grid]
[row]
[column]
grow_factor = 0
border = "left,right,bottom"
border_size = 5
horizontal_alignment = "right"
[label]
id = "status"
definition = "default"
[/label]
[/column]
[/row]
[row]
[column]
grow_factor = 1
horizontal_grow = "true"
[grid]
[row]
grow_factor = 1
{GAMELISTBOX_BODY_LABEL "scenario" "" 0}
{GAMELISTBOX_BODY_LABEL "map_size_text" "" 0}
{GAMELISTBOX_BODY_LABEL "era" "Era" 1}
{GAMELISTBOX_BODY_IMAGE "map_size_icon" "misc/map.png" "" 0}
{GAMELISTBOX_BODY_LABEL_TINY "map_size_text" "900x900"}
{GAMELISTBOX_BODY_IMAGE "observer_icon" "misc/eye.png" "" 0}
{GAMELISTBOX_BODY_IMAGE "shuffle_sides_icon" "misc/shuffle-sides.png" _"Assign sides to players at random" 0}
{GAMELISTBOX_BODY_IMAGE "needs_password" "misc/key.png" _"Requires a password to join" 0}
@ -179,10 +235,30 @@
horizontal_alignment = "right"
[grid]
[row]
{GAMELISTBOX_BODY_BUTTON "join" _"Join"}
[column]
grow_factor = 1
horizontal_alignment = "right"
border = "top,left,right"
border_size = 5
[button]
id = "join"
definition = "default"
label = _ "Join"
[/button]
[/column]
[/row]
[row]
{GAMELISTBOX_BODY_BUTTON "observe" _"Observe"}
[column]
grow_factor = 1
horizontal_alignment = "right"
border = "all"
border_size = 5
[button]
id = "observe"
definition = "default"
label = _ "Observe"
[/button]
[/column]
[/row]
[/grid]
[/column]
@ -199,7 +275,7 @@
[grid]
[row]
[column]
horizontal_alignment = "left"
horizontal_alignment = "left"
[grid]
[row]
[column]
@ -619,7 +695,7 @@
label = _ "Create Game"
[/button]
[/column]
[column]
border = "all"
border_size = 5
@ -669,7 +745,7 @@
border = "left,right,top"
border_size = 5
horizontal_grow = "true"
[menu_button]
id = "replay_options"
definition = "default"

View file

@ -245,15 +245,21 @@ game_info::game_info(const config& game, const config& game_config, const std::v
map_info = era;
if(!game.child_or_empty("modification").empty()) {
for(const config &cfg : game.child_range("modification")) {
if(cfg["require_modification"].to_bool(false)) {
const config &mod = game_config.find_child("modification", "id", cfg["id"]);
if(!mod) {
have_all_mods = false;
break;
for(const config& cfg : game.child_range("modification")) {
if(const config& mod = game_config.find_child("modification", "id", cfg["id"])) {
mod_info += (mod_info.empty() ? "" : ", ") + mod["name"].str();
if(cfg["require_modification"].to_bool(false)) {
ADDON_REQ result = check_addon_version_compatibility(mod, game);
addons_outcome = std::max(addons_outcome, result); // Elevate to most severe error level encountered so far
}
} else {
mod_info += (mod_info.empty() ? "" : ", ") + cfg["id"].str();
if(cfg["require_modification"].to_bool(false)) {
have_all_mods = false;
mod_info += " " + _("(missing)");
}
ADDON_REQ result = check_addon_version_compatibility(mod, game);
addons_outcome = std::max(addons_outcome, result); // Elevate to most severe error level encountered so far
}
}
}

View file

@ -150,6 +150,7 @@ struct game_info
std::string map_size_info;
std::string era;
std::string era_short;
std::string mod_info;
std::string gold;
std::string support;

View file

@ -624,8 +624,9 @@ std::map<std::string, string_map> tlobby_main::make_game_row_data(const game_inf
add_label_data(data, "status", colorize(game.status, color_string));
add_label_data(data, "name", colorize(game.name, color_string));
add_label_data(data, "era", game.era);
add_label_data(data, "era", colorize(game.era, "#a69275"));
add_label_data(data, "era_short", game.era_short);
add_label_data(data, "mods", colorize(game.mod_info, "#a69275"));
add_label_data(data, "map_info", game.map_info);
add_label_data(data, "scenario", game.scenario);
add_label_data(data, "map_size_text", game.map_size_info);