wc: WoCopedia UI cleanup pass #1
Still a lot of work left to do, but this initial commit focuses on bringing the UI layout on par with mainline standards. Notable remaining layout issues: * Training pages don't have a proper caption. * The Items page (previously Artifacts, relabeled Items for consistency with the rest of the help text) has individual items grow the list horizontally out of the page's bounds, resulting in a horizontal scrollbar on the item list right now, or one on the whole window if anything is done to prevent the former. There is currently no simple way to fix this since labels in listboxes and treeviews grow unchecked, rendering `wrap = true` moot. * The Factions page seems to be designed to display a list of factions but this doesn't seem to be used or working right now? * The Settings page has some evidence of this having been user-made content. We probably want to do away with some of it in mainline. Maybe. * The Feedback page screams UMC all over. It is also a bit useless without gfgtdf around right now... * Lots of questionable English or UI language around still. * I don't like tree views.
This commit is contained in:
parent
6f571f3e44
commit
4e5eb49a4a
2 changed files with 155 additions and 72 deletions
|
@ -1,6 +1,14 @@
|
|||
local _ = wesnoth.textdomain 'wesnoth-wc'
|
||||
local dialog = wc2_wiki_dialog
|
||||
|
||||
local function make_caption(text)
|
||||
return ("<big><b>%s</b></big>"):format(text)
|
||||
end
|
||||
|
||||
local function help_page_text(caption, description)
|
||||
return caption, ("%s\n\n%s"):format(make_caption(caption), description)
|
||||
end
|
||||
|
||||
function wesnoth.wml_actions.wc2_show_wocopedia(cfg)
|
||||
|
||||
local show_help_mechanics = cfg.show_mechanics ~= false
|
||||
|
@ -16,48 +24,35 @@ function wesnoth.wml_actions.wc2_show_wocopedia(cfg)
|
|||
local preshow = function(dialog)
|
||||
local str_cat_mechnics = _ "Game Mechanics"
|
||||
local str_des_mechnics = cfg.mechanics_text or
|
||||
_ "<b>Gold</b>:\n" ..
|
||||
make_caption( _ "Game Mechanics") .. "\n\n" ..
|
||||
_ "<b>Gold</b>\n" ..
|
||||
_ "Carryover rate is 15% and split evenly among players. Negative amounts will not carry over. Early finish bonus is superior to village control, but it is not directly related to the carryover amount.\n\n" ..
|
||||
_ "<b>Autorecall</b>:\n" ..
|
||||
_ "Units with trait HEROIC are recalled at the start of each scenario with no cost (up to castle size).\n\n" ..
|
||||
_ "<b>Recall Cost</b>:\n" ..
|
||||
_ "<b>Autorecall</b>\n" ..
|
||||
_ "Units with the <b>heroic</b> trait are recalled at the start of each scenario with no cost (up to castle size).\n\n" ..
|
||||
_ "<b>Recall Cost</b>\n" ..
|
||||
_ "Units costing less than 17 gold are cheaper to recall.\n\n" ..
|
||||
_ "<b>Training</b>:\n" ..
|
||||
_ "<b>Training</b>\n" ..
|
||||
_ "Every time you recruit a new unit, your training levels will be applied. If a unit gains training benefits, you can see them with the trait \"trained\". Each unit’s chance of gaining training benefits is independent of another’s.\n\n" ..
|
||||
_ "<b>Upkeep</b>:\n" ..
|
||||
_ "Units with trait HEROIC or holding any magic ITEM have FREE upkeep.\n\n" ..
|
||||
_ "<b>Bonus Points</b>:\n" ..
|
||||
_ "<b>Upkeep</b>\n" ..
|
||||
_ "Units with the <b>heroic</b> trait or holding any magic <b>item</b> have free upkeep.\n\n" ..
|
||||
_ "<b>Bonus Points</b>\n" ..
|
||||
_ "In every scenario the game generates as many bonus points on the map as there are players in the game, the bonus points can be picked up by player units and either contain artifacts, loyal units, or training.\n\n" ..
|
||||
_ "<b>Army discipline</b>:\n" ..
|
||||
_ "<b>Army discipline</b>\n" ..
|
||||
_ "At scenarios 1 to 3, for each training level players already own, trainers found have 2% to 4% chance to become advanced trainers (provide 2 levels). Becomes irrelevant from scenario 4 onwards because all trainers will always be advanced.\n\n" ..
|
||||
""
|
||||
local str_cat_feedback = _ "Feedback"
|
||||
local str_des_feedback =
|
||||
_ "<b>Feedback</b>:\n" ..
|
||||
_ "For feedback please either post in the World Conquest II thread in the official Wesnoth forum https://r.wesnoth.org/t39651 or file an issue at GitHub https://github.com/gfgtdf/World_Conquest_II/issues .\n\n" ..
|
||||
""
|
||||
local str_cat_abilities = _ "Abilities"
|
||||
local str_des_abilities =
|
||||
_ "Ability <b>Autorecall</b>:\n" ..
|
||||
_ "Units with trait HEROIC are recalled at the start of each scenario with no cost (up to castle size).\n\n" ..
|
||||
""
|
||||
local str_cat_training = _ "Training"
|
||||
local str_des_training = _ "<b>Training</b>\nTraining improves newly recruited units, it has no effect on already recruited units. The following list shows all available training, the training you currently have is marked in green."
|
||||
local str_cat_items = _ "Artifacts"
|
||||
local str_des_items = _ "<b>Items</b>\nItems can be given to units to make them stronger. You can get artifacts in three ways: 1) By choosing an item as your starting bonus; 2) By finding it on a map in a bonus point; 3) By dropping from enemies in later scenarios. Note, however, that not all units can pick up all items."
|
||||
local str_cat_era = _ "Factions"
|
||||
local str_des_era = _ "<b>Factions</b>\n The World Conquest II era consists of factions that are built from pairs of mainline factions. One faction will have a healer available (Drakes, Rebels and Loyalists) and one will not (Orcs, Dwarves and Undead). The recruit list is also organized in pairs so that sometimes you will have to recruit a different unit before you can recruit the units that you want. The available heroes, deserters, and random leaders also depend on your factions; the items you can get do not depend on the faction you choose."
|
||||
local str_cat_feedback, str_des_feedback = help_page_text( _ "Feedback", _ "For feedback please either post in the World Conquest II thread in the official Wesnoth forum <https://r.wesnoth.org/t39651> or file an issue at GitHub <https://github.com/gfgtdf/World_Conquest_II/issues>.")
|
||||
local str_cat_training, str_des_training = help_page_text( _ "Training", _ "Training improves newly recruited units, it has no effect on already recruited units. The following list shows all available training, the training you currently have is marked in green.")
|
||||
local str_cat_items, str_des_items = help_page_text( _ "Items", _ "Items can be given to units to make them stronger. You can get items in three ways: 1) By choosing an item as your starting bonus; 2) By finding it on a map in a bonus point; 3) By dropping from enemies in later scenarios. Note, however, that not all units can pick up all items.")
|
||||
local str_cat_era, str_des_era = help_page_text( _ "Factions" , _ "The World Conquest II era consists of factions that are built from pairs of mainline factions. One faction will have a healer available (Drakes, Rebels and Loyalists) and one will not (Orcs, Dwarves and Undead). The recruit list is also organized in pairs so that sometimes you will have to recruit a different unit before you can recruit the units that you want. The available heroes, deserters, and random leaders also depend on your factions; the items you can get do not depend on the faction you choose.")
|
||||
local str_cat_settings = _ "Settings"
|
||||
|
||||
|
||||
|
||||
local root_node = dialog:find("treeview_topics")
|
||||
local details = dialog:find("details")
|
||||
|
||||
function gui.widget.add_help_page(parent_node, args)
|
||||
local node_type = args.node_type or "category"
|
||||
local page_type = args.page_type or "simple"
|
||||
|
||||
|
||||
local node = parent_node:add_item_of_type(node_type)
|
||||
local details_page = details:add_item_of_type(page_type)
|
||||
if args.title then
|
||||
|
@ -131,7 +126,7 @@ function wesnoth.wml_actions.wc2_show_wocopedia(cfg)
|
|||
}
|
||||
|
||||
page.label_content.marked_up_text = str_des_era
|
||||
|
||||
|
||||
for i, faction_info in ipairs(wc2_era.factions_wml) do
|
||||
local faction_wml = wml.get_child(era_wml, "multiplayer_side", faction_info.id)
|
||||
|
||||
|
@ -195,7 +190,7 @@ function wesnoth.wml_actions.wc2_show_wocopedia(cfg)
|
|||
if not_available.enemy then
|
||||
artifact_name = artifact_name .. str_not_for_enemies
|
||||
end
|
||||
|
||||
|
||||
local page_element = page.treeview_artifacts:add_item_of_type("artifact")
|
||||
page_element.image.label = artifact_icon
|
||||
page_element.label_name.label = artifact_name .. "\n" .. artifact_desc
|
||||
|
@ -207,7 +202,7 @@ function wesnoth.wml_actions.wc2_show_wocopedia(cfg)
|
|||
title = str_cat_settings,
|
||||
page_type = "settings",
|
||||
}
|
||||
|
||||
|
||||
page.checkbox_use_pya.selected = not not wml.variables["wc2_config_enable_pya"]
|
||||
page.checkbox_use_pya.enabled = false
|
||||
page.checkbox_use_markers.selected = not not wml.variables["wc2_config_enable_unitmarker"]
|
||||
|
|
|
@ -14,7 +14,7 @@ local function GUI_FORCE_WIDGET_MINIMUM_SIZE(w,h, content)
|
|||
height = h
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
T.layer {
|
||||
T.row {
|
||||
|
@ -25,7 +25,7 @@ local function GUI_FORCE_WIDGET_MINIMUM_SIZE(w,h, content)
|
|||
vertical_grow = "true",
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,11 +57,19 @@ local GUI_HORIZONTAL_SPACER_LINE = T.row {
|
|||
}
|
||||
}
|
||||
|
||||
local function formula_gui_scale_resolution(size)
|
||||
return ("(max(%d, floor(%d * 265 * 2 / (3 * screen_pitch_microns))))"):format(size, size)
|
||||
end
|
||||
|
||||
return {
|
||||
maximum_width = 900,
|
||||
automatic_placement = true,
|
||||
|
||||
maximum_width = formula_gui_scale_resolution(1024),
|
||||
maximum_height = formula_gui_scale_resolution(800),
|
||||
|
||||
T.helptip { id = "tooltip_large" }, -- mandatory field
|
||||
T.tooltip { id = "tooltip_large" }, -- mandatory field
|
||||
|
||||
|
||||
T.linked_group { id = "artifact_icon", fixed_width = true },
|
||||
T.linked_group { id = "artifact_name", fixed_width = true },
|
||||
T.linked_group { id = "recruit_icon", fixed_width = true },
|
||||
|
@ -91,7 +99,8 @@ return {
|
|||
T.column {
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
horizontal_grow = true,
|
||||
grow_factor = 0,
|
||||
horizontal_grow = false,
|
||||
vertical_grow = true,
|
||||
T.tree_view {
|
||||
id = "treeview_topics",
|
||||
|
@ -110,8 +119,18 @@ return {
|
|||
id = "tree_view_node_label",
|
||||
T.grid {
|
||||
T.row {
|
||||
T.column {
|
||||
grow_factor = 0,
|
||||
horizontal_grow = false,
|
||||
T.spacer {
|
||||
width = 10
|
||||
}
|
||||
},
|
||||
T.column {
|
||||
horizontal_alignment = "left",
|
||||
grow_factor = 1,
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.label {
|
||||
id = "label_topic",
|
||||
},
|
||||
|
@ -130,6 +149,8 @@ return {
|
|||
T.column {
|
||||
grow_factor = 0,
|
||||
horizontal_grow = true,
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.toggle_button {
|
||||
id = "tree_view_node_toggle",
|
||||
definition = "tree_view_node",
|
||||
|
@ -144,6 +165,8 @@ return {
|
|||
T.row {
|
||||
T.column {
|
||||
horizontal_alignment = "left",
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.label {
|
||||
id = "label_topic",
|
||||
},
|
||||
|
@ -158,6 +181,9 @@ return {
|
|||
},
|
||||
},
|
||||
T.column {
|
||||
grow_factor = 1,
|
||||
horizontal_grow = true,
|
||||
vertical_grow = true,
|
||||
T.multi_page {
|
||||
id = "details",
|
||||
definition = "default",
|
||||
|
@ -168,9 +194,11 @@ return {
|
|||
T.column {
|
||||
horizontal_grow = true,
|
||||
vertical_grow = true,
|
||||
T.scrollbar_panel {
|
||||
T.definition {
|
||||
T.row {
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.scrollbar_panel {
|
||||
T.definition {
|
||||
T.row {
|
||||
T.column {
|
||||
horizontal_grow = true,
|
||||
vertical_grow = true,
|
||||
|
@ -179,7 +207,7 @@ return {
|
|||
definition = "default",
|
||||
horizontal_scrollbar_mode = "never",
|
||||
vertical_scrollbar_mode = "never",
|
||||
indention_step_size = 20,
|
||||
indentation_step_size = 20,
|
||||
T.node {
|
||||
id = "training_details",
|
||||
T.node_definition {
|
||||
|
@ -187,6 +215,8 @@ return {
|
|||
T.column {
|
||||
grow_factor = 1,
|
||||
horizontal_alignment = "left",
|
||||
border = "bottom",
|
||||
border_size = 10,
|
||||
T.label {
|
||||
definition = "default_large",
|
||||
id = "training_caption",
|
||||
|
@ -213,6 +243,8 @@ return {
|
|||
T.column {
|
||||
grow_factor = 1,
|
||||
horizontal_alignment = "left",
|
||||
border = "bottom",
|
||||
border_size = 10,
|
||||
T.label {
|
||||
definition = "default_large",
|
||||
id = "training_caption",
|
||||
|
@ -239,6 +271,8 @@ return {
|
|||
T.column {
|
||||
grow_factor = 1,
|
||||
horizontal_grow = true,
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.spacer {
|
||||
height = 20,
|
||||
width = 20,
|
||||
|
@ -247,11 +281,11 @@ return {
|
|||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -261,18 +295,22 @@ return {
|
|||
T.column {
|
||||
horizontal_grow = true,
|
||||
vertical_grow = true,
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.scroll_label {
|
||||
id = "label_content",
|
||||
label = "Text",
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
T.page_definition {
|
||||
id="artifacts",
|
||||
horizontal_grow = true,
|
||||
vertical_grow = true,
|
||||
T.row {
|
||||
T.column {
|
||||
horizontal_grow = true,
|
||||
vertical_grow = true,
|
||||
T.grid {
|
||||
--T.row {
|
||||
|
@ -287,22 +325,28 @@ return {
|
|||
--},
|
||||
T.row {
|
||||
T.column {
|
||||
T.scroll_label {
|
||||
vertical_scrollbar_mode = "never",
|
||||
horizontal_grow = true,
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.label {
|
||||
id = "desc",
|
||||
wrap = true
|
||||
}
|
||||
}
|
||||
},
|
||||
T.row {
|
||||
T.column {
|
||||
horizontal_grow = true,
|
||||
grow_factor = 0,
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.tree_view {
|
||||
vertical_grow = true,
|
||||
id = "treeview_artifacts",
|
||||
definition = "default",
|
||||
horizontal_scrollbar_mode = "never",
|
||||
vertical_scrollbar_mode = "always",
|
||||
indentation_step_size = 35,
|
||||
horizontal_scrollbar_mode = "auto",
|
||||
vertical_scrollbar_mode = "auto",
|
||||
indentation_step_size = 0,
|
||||
T.node {
|
||||
id = "artifact",
|
||||
horizontal_grow = true,
|
||||
|
@ -315,14 +359,22 @@ return {
|
|||
T.grid {
|
||||
T.row {
|
||||
T.column {
|
||||
horizontal_alignment = "left",
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.image {
|
||||
id="image",
|
||||
linked_group = "artifact_icon",
|
||||
}
|
||||
},
|
||||
T.column {
|
||||
horizontal_grow = true,
|
||||
grow_factor = 1,
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.label {
|
||||
id="label_name",
|
||||
wrap = true,
|
||||
linked_group = "artifact_name",
|
||||
}
|
||||
},
|
||||
|
@ -533,11 +585,11 @@ return {
|
|||
},
|
||||
T.page_definition {
|
||||
id="settings",
|
||||
vertical_grow = true,
|
||||
vertical_alignment = "top",
|
||||
horizontal_grow = true,
|
||||
T.row {
|
||||
T.column {
|
||||
vertical_grow = true,
|
||||
vertical_alignment = "top",
|
||||
horizontal_grow = true,
|
||||
T.grid {
|
||||
T.row {
|
||||
|
@ -546,9 +598,11 @@ return {
|
|||
grow_factor = 0,
|
||||
vertical_grow = false,
|
||||
horizontal_alignment = "left",
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.label {
|
||||
id = "title",
|
||||
label = "<b>Settings</b>\n ",
|
||||
label = "<big><b>" .. _ "Settings" .. "</b></big>\n",
|
||||
use_markup=true,
|
||||
},
|
||||
},
|
||||
|
@ -556,80 +610,106 @@ return {
|
|||
T.row {
|
||||
grow_factor = 0,
|
||||
T.column {
|
||||
horizontal_grow=true,
|
||||
vertical_alignment="top",
|
||||
horizontal_grow = "true",
|
||||
vertical_alignment = "top",
|
||||
grow_factor = 1,
|
||||
T.grid {
|
||||
T.row {
|
||||
T.column {
|
||||
horizontal_alignment="left",
|
||||
horizontal_alignment = "left",
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.label {
|
||||
definition = "gold_small",
|
||||
label = "Use WC2 PYA mod",
|
||||
}
|
||||
},
|
||||
T.column {
|
||||
horizontal_alignment="right",
|
||||
horizontal_alignment = "center",
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.toggle_button {
|
||||
label = "",
|
||||
definition = "no_label",
|
||||
id="checkbox_use_pya",
|
||||
},
|
||||
},
|
||||
},
|
||||
T.row {
|
||||
T.column {
|
||||
horizontal_alignment="left",
|
||||
horizontal_alignment = "left",
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.label {
|
||||
definition = "gold_small",
|
||||
label = "Use WC2 Unitmarkers",
|
||||
}
|
||||
},
|
||||
T.column {
|
||||
horizontal_alignment="right",
|
||||
horizontal_alignment = "center",
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.toggle_button {
|
||||
label = "",
|
||||
definition = "no_label",
|
||||
id="checkbox_use_markers",
|
||||
},
|
||||
},
|
||||
},
|
||||
T.row {
|
||||
T.column {
|
||||
horizontal_alignment="left",
|
||||
horizontal_alignment = "left",
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.label {
|
||||
definition = "gold_small",
|
||||
label = "Use WC2 experimental pickup",
|
||||
}
|
||||
},
|
||||
T.column {
|
||||
horizontal_alignment="right",
|
||||
horizontal_alignment = "center",
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.toggle_button {
|
||||
label = "",
|
||||
definition = "no_label",
|
||||
id="checkbox_use_pickup",
|
||||
},
|
||||
},
|
||||
},
|
||||
T.row {
|
||||
T.column {
|
||||
horizontal_alignment="left",
|
||||
horizontal_alignment = "left",
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.label {
|
||||
definition = "gold_small",
|
||||
label = "Show pickup confirmation",
|
||||
}
|
||||
},
|
||||
T.column {
|
||||
horizontal_alignment="right",
|
||||
horizontal_alignment = "center",
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.toggle_button {
|
||||
label = "",
|
||||
definition = "no_label",
|
||||
id="checkbox_show_pickup_confirmation",
|
||||
},
|
||||
},
|
||||
},
|
||||
T.row {
|
||||
T.column {
|
||||
horizontal_alignment="left",
|
||||
horizontal_alignment = "left",
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.label {
|
||||
label = "difficulty",
|
||||
definition = "gold_small",
|
||||
label = _ "Difficulty",
|
||||
}
|
||||
},
|
||||
T.column {
|
||||
horizontal_alignment="right",
|
||||
horizontal_alignment = "center",
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.label {
|
||||
definition = "gold_small",
|
||||
label = "",
|
||||
id="label_difficulty",
|
||||
},
|
||||
|
@ -637,14 +717,20 @@ return {
|
|||
},
|
||||
T.row {
|
||||
T.column {
|
||||
horizontal_alignment="left",
|
||||
horizontal_alignment = "left",
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.label {
|
||||
definition = "gold_small",
|
||||
label = "WC2 version",
|
||||
}
|
||||
},
|
||||
T.column {
|
||||
horizontal_alignment="right",
|
||||
horizontal_alignment = "center",
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.label {
|
||||
definition = "gold_small",
|
||||
label = "",
|
||||
id="label_version",
|
||||
},
|
||||
|
@ -675,6 +761,8 @@ return {
|
|||
},
|
||||
T.column {
|
||||
horizontal_alignment = "right",
|
||||
border = "all",
|
||||
border_size = 5,
|
||||
T.button {
|
||||
label = wesnoth.textdomain("wesnoth")("Close"),
|
||||
id = "ok",
|
||||
|
|
Loading…
Add table
Reference in a new issue