MP Join Game: layout improvements

This commit is contained in:
Charles Dang 2016-10-01 10:32:13 +11:00
parent c05b8efc3f
commit b4d460cd16
2 changed files with 105 additions and 44 deletions

View file

@ -31,7 +31,7 @@
grow_factor = 0
border = "all"
border_size = 10
horizontal_grow = "true"
horizontal_alignment = "left"
vertical_alignment = "top"
[label]
@ -44,7 +44,6 @@
[column]
grow_factor = 1
horizontal_grow = "true"
#vertical_grow = "true"
[grid]
linked_group = "leader"
@ -149,7 +148,7 @@
grow_factor = 1
border = "left,bottom,right"
border_size = 5
horizontal_grow = "true"
horizontal_alignment = "left"
vertical_grow = "true"
[image]
@ -186,6 +185,7 @@
[label]
id = "side_team"
definition = "default"
linked_group = "team"
[/label]
[/column]
@ -195,34 +195,93 @@
border_size = 5
horizontal_grow = "true"
[label]
id = "side_gold"
definition = "default"
[/label]
[/column]
[column]
grow_factor = 0
border = "all"
border_size = 5
horizontal_grow = "true"
[label]
id = "side_income"
definition = "default"
[/label]
[/column]
[column]
grow_factor = 0
border = "all"
border_size = 5
horizontal_grow = "true"
[label]
[image]
id = "side_color"
definition = "default"
[/label]
definition = "centered"
linked_group = "color"
[/image]
[/column]
[column]
grow_factor = 0
horizontal_grow = "true"
[grid]
linked_group = "gold_and_income"
[row]
[column]
grow_factor = 0
border = "all"
border_size = 5
horizontal_alignment = "left"
[image]
id = "gold_icon"
definition = "default"
label = "themes/gold.png"
tooltip = _ "Gold"
[/image]
[/column]
[column]
grow_factor = 1
border = "all"
border_size = 5
horizontal_grow = "true"
[label]
id = "side_gold"
definition = "default_small"
tooltip = _ "Gold"
[/label]
[/column]
[/row]
[row]
[column]
grow_factor = 0
border = "bottom,left,right"
border_size = 5
horizontal_alignment = "left"
[image]
id = "income_icon"
definition = "default"
label = "themes/income.png"
tooltip = _ "Income"
[/image]
[/column]
[column]
grow_factor = 1
border = "bottom,left,right"
border_size = 5
horizontal_grow = "true"
[label]
id = "side_income"
definition = "default_small"
tooltip = _ "Income"
[/label]
[/column]
[/row]
[/grid]
[/column]
[column]
grow_factor = 0
[spacer]
width = 20
[/spacer]
[/column]
[/row]
@ -359,18 +418,18 @@
fixed_width = "true"
[/linked_group]
[linked_group]
id = "controller"
fixed_width = "true"
[/linked_group]
[linked_group]
id = "leader"
fixed_width = "true"
[/linked_group]
[linked_group]
id = "team_and_color"
id = "team"
fixed_width = "true"
[/linked_group]
[linked_group]
id = "color"
fixed_width = "true"
[/linked_group]

View file

@ -185,10 +185,8 @@ void tmp_join_game::post_build(twindow& window)
window.set_retval(twindow::CANCEL);
}
const bool allow_choice = (*side_choice)["allow_changes"].to_bool(true);
// If the client is allowed to choose their team, do that here instead of having it set by the server
if(allow_choice) {
if((*side_choice)["allow_changes"].to_bool(true)) {
events::event_context context;
const config& era = level_.child("era");
@ -397,23 +395,27 @@ void tmp_join_game::generate_side_list(twindow& window)
// Don't show gold for saved games
// TODO: gold icon
if(side["allow_changes"].to_bool()) {
item["label"] = side["gold"].str() + " " + "Gold";
item["label"] = side["gold"].str() + " " + _("Gold");
data.emplace("side_gold", item);
}
const int income_amt = side["income"];
if(income_amt != 0) {
const std::string income_string = formatter() << (income_amt > 0 ? "+" : "") << income_amt << "Income";
const std::string income_string = formatter() << (income_amt > 0 ? "+" : "") << income_amt << " " << _("Income");
item["label"] = income_string;
data.emplace("side_income", item);
}
// TODO: colorize
item["label"] = side["color"];
item["label"] = (formatter() << "buttons/misc/orb-active.png~RC(magenta>" << side["color"] << ")").str();
data.emplace("side_color", item);
list.add_row(data);
tgrid& row_grid = list.add_row(data);
if(income_amt == 0) {
find_widget<timage>(&row_grid, "income_icon", false).set_visible(twidget::tvisible::invisible);
find_widget<tlabel>(&row_grid, "side_income", false).set_visible(twidget::tvisible::invisible);
}
}
}