WC: Convert the remaining dialogs to WML

- Pickup confirmation
- Got unit from invest
- Settings for map editor
This commit is contained in:
Celtic Minstrel 2021-03-31 09:29:20 -04:00
parent 1af920669c
commit 7defa434e8
6 changed files with 375 additions and 344 deletions

View file

@ -0,0 +1,64 @@
#textdomain wesnoth-wc
# Since this file is loaded standalone, we need to manually include these
{gui/macros}
[resolution]
maximum_width = 1200
maximum_height = 700
[helptip]
id = "tooltip_large"
[/helptip]
[tooltip]
id = "tooltip_large"
[/tooltip]
[grid]
[row]
[column]
border = "all"
border_size = 5
horizontal_alignment = "left"
[label]
definition = "title"
label = _ "You got"
id = "title"
[/label]
[/column]
[/row]
[row]
[column]
[grid]
[row]
[column]
border = "all"
border_size = 5
[image]
id="icon"
[/image]
[/column]
[/row]
[row]
[column]
border = "all"
border_size = 5
[label]
id = "name"
[/label]
[/column]
[/row]
[/grid]
[/column]
[/row]
[row]
[column]
border = "all"
border_size = 5
[button]
label = _ "OK"
id = "ok"
[/button]
[/column]
[/row]
[/grid]
[/resolution]

View file

@ -0,0 +1,82 @@
#textdomain wesnoth-wc
# Since this file is loaded standalone, we need to manually include these
{gui/macros}
[resolution]
maximum_width = 1200
maximum_height = 700
[helptip]
id = "tooltip_large"
[/helptip]
[tooltip]
id = "tooltip_large"
[/tooltip]
[grid]
[row]
[column]
border = "all"
border_size = 5
horizontal_alignment = "left"
[label]
definition = "title"
label = _"Pick up item?"
id = "title"
[/label]
[/column]
[/row]
[row]
[column]
[grid]
[row]
[column]
[image]
id="item_icon"
[/image]
[/column]
[column]
[label]
id="arrow"
use_markup=true
[/label]
[/column]
[column]
[image]
id="unit_icon"
[/image]
[/column]
[/row]
[/grid]
[/column]
[/row]
[row]
[column]
[grid]
[row]
[column]
[button]
border = "all"
border_size = 5
horizontal_alignment = "right"
label = _"Yes"
id="res_yes"
return_value = 1
[/button]
[/column]
[column]
border = "all"
border_size = 5
horizontal_alignment = "right"
[button]
label = _"No"
id="res_no"
return_value = 2
[/button]
[/column]
[/row]
[/grid]
[/column]
[/row]
[/grid]
[/resolution]

View file

@ -0,0 +1,223 @@
#textdomain wesnoth-wc
# Since this file is loaded standalone, we need to manually include these
{gui/macros}
[resolution]
maximum_width = 900
[helptip]
id = "tooltip_large"
[/helptip]
[tooltip]
id = "tooltip_large"
[/tooltip]
[linked_group]
id = "linked_group1"
fixed_width = true
[/linked_group]
[grid]
[row]
grow_factor = 1
[column]
border = "all"
border_size = 5
horizontal_alignment = "left"
[label]
definition = "title"
label = _"Map Settings"
id = "title"
[/label]
[/column]
[/row]
[row]
grow_factor = 1
[column]
horizontal_grow = true
vertical_grow = true
[grid]
[row]
[column]
border = "all"
border_size = 5
horizontal_grow = true
vertical_grow = true
[grid]
[row]
[column]
[label]
label = _" scenario: "
[/label]
[/column]
[column]
[slider]
definition="short"
id = "sl_scenario"
minimum_value=1
maximum_value=6
[/slider]
[/column]
[column]
[label]
label = _" map: "
width=20
[/label]
[/column]
[column]
[slider]
definition="default"
id = "sl_map"
minimum_value=1
maximum_value=10
[/slider]
[/column]
[/row]
[/grid]
[/column]
[/row]
[/grid]
[/column]
[/row]
[row]
[column]
horizontal_grow = true
[grid]
[row]
[column]
grow_factor = 1
[label]
label = "length"
[/label]
[/column]
[column]
horizontal_alignment = "right"
[slider]
id = "sl_length"
minimum_value=1
maximum_value=100
[/slider]
[/column]
[/row]
[row]
[column]
grow_factor = 1
[label]
label = "villages"
[/label]
[/column]
[column]
horizontal_alignment = "right"
[slider]
id = "sl_villages"
minimum_value=1
maximum_value=100
[/slider]
[/column]
[/row]
[row]
[column]
grow_factor = 1
[label]
label = "castle"
[/label]
[/column]
[column]
horizontal_alignment = "right"
[slider]
id = "sl_castle"
minimum_value=1
maximum_value=20
[/slider]
[/column]
[/row]
[row]
[column]
grow_factor = 1
[label]
label = "iterations"
[/label]
[/column]
[column]
horizontal_alignment = "right"
[slider]
id = "sl_iterations"
minimum_value=10
maximum_value=20000
[/slider]
[/column]
[/row]
[row]
[column]
grow_factor = 1
[label]
label = "hill_size"
[/label]
[/column]
[column]
horizontal_alignment = "right"
[slider]
id = "sl_hill_size"
minimum_value=1
maximum_value=10
[/slider]
[/column]
[/row]
[row]
[column]
grow_factor = 1
[label]
label = "island"
[/label]
[/column]
[column]
horizontal_alignment = "right"
[slider]
id = "sl_island"
minimum_value=1
maximum_value=10
[/slider]
[/column]
[/row]
[row]
[column]
grow_factor = 1
[label]
label = "castles"
[/label]
[/column]
[column]
horizontal_alignment = "right"
[slider]
id = "sl_ncastles"
minimum_value=1
maximum_value=10
[/slider]
[/column]
[/row]
[/grid]
[/column]
[/row]
[row]
[column]
horizontal_grow = true
[grid]
[row]
[column]
grow_factor = 1
[spacer]
[/spacer]
[/column]
[column]
horizontal_alignment = "right"
[button]
label = "OK"
id = "ok"
[/button]
[/column]
[/row]
[/grid]
[/column]
[/row]
[/grid]
[/resolution]

View file

@ -3,61 +3,7 @@ local T = wml.tag
local invest_tellunit = {}
invest_tellunit.dialog_wml = {
maximum_width = 1200,
maximum_height = 700,
T.helptip { id = "tooltip_large" }, -- mandatory field
T.tooltip { id = "tooltip_large" }, -- mandatory field
T.grid {
T.row {
T.column {
border = "all",
border_size = 5,
horizontal_alignment = "left",
T.label {
definition = "title",
label = _ "You got",
id = "title"
}
}
},
T.row {
T.column {
T.grid {
T.row {
T.column {
border = "all",
border_size = 5,
T.image {
id="icon"
}
},
},
T.row {
T.column {
border = "all",
border_size = 5,
T.label {
id = "name"
}
},
},
},
},
},
T.row {
T.column {
border = "all",
border_size = 5,
T.button {
label = _ "OK",
id = "ok",
},
},
},
},
}
invest_tellunit.dialog_wml = wml.load "campaigns/World_Conquest/gui/invest_tellunit.cfg"
-- todo:maybe use a dialog ith the unit specific welcome mesage?
function invest_tellunit.execute(unit_type)
@ -72,7 +18,7 @@ function invest_tellunit.execute(unit_type)
dialog.name.label = unit_type.name
end
gui.show_dialog(invest_tellunit.dialog_wml, preshow)
gui.show_dialog(wml.get_child(invest_tellunit.dialog_wml, 'resolution'), preshow)
end
return invest_tellunit

View file

@ -1,5 +1,4 @@
local _ = wesnoth.textdomain 'wesnoth-wc'
local T = wml.tag
local pickup_confirmation_dialog = {}
@ -9,87 +8,14 @@ local function show_dialog(unit, item_image)
return 1
end
local dialog_wml = {
maximum_width = 1200,
maximum_height = 700,
T.helptip { id = "tooltip_large" }, -- mandatory field
T.tooltip { id = "tooltip_large" }, -- mandatory field
T.grid {
T.row {
T.column {
border = "all",
border_size = 5,
horizontal_alignment = "left",
T.label {
definition = "title",
label = _"Pick up item?",
id = "title",
},
},
},
T.row {
T.column {
T.grid {
T.row {
T.column {
T.image {
id="item_icon",
},
},
T.column {
T.label {
id="arrow",
use_markup=true
},
},
T.column {
T.image {
id="unit_icon",
},
},
},
},
},
},
T.row {
T.column {
T.grid {
T.row {
T.column {
T.button {
border = "all",
border_size = 5,
horizontal_alignment = "right",
label = _"Yes",
id="res_yes",
return_value = 1,
},
},
T.column {
border = "all",
border_size = 5,
horizontal_alignment = "right",
T.button {
label = _"No",
id="res_no",
return_value = 2
},
},
},
},
},
},
},
}
local dialog_wml = wml.load "campaigns/World_Conquest/gui/pickup_confirmation.cfg"
local function preshow(dialog)
dialog.unit_icon.label = wc2_color.tc_image(wesnoth.unit_types[unit.type].image)
dialog.arrow.label = wc2_color.tc_text("")
dialog.item_icon.label = item_image
dialog.res_yes:focus()
end
local res = gui.show_dialog(dialog_wml, preshow)
local res = gui.show_dialog(wml.get_child(dialog_wml, 'resolution'), preshow)
return res == 1 or res == -1
end

View file

@ -28,217 +28,7 @@ function get_defaults(nplayer, nscenario)
return {}
end
local dialog_wml = {
maximum_width = 900,
T.helptip { id = "tooltip_large" }, -- mandatory field
T.tooltip { id = "tooltip_large" }, -- mandatory field
T.linked_group { id = "linked_group1", fixed_width = true },
T.grid {
T.row {
grow_factor = 1,
T.column {
border = "all",
border_size = 5,
horizontal_alignment = "left",
T.label {
definition = "title",
label = _"Map Settings",
id = "title"
}
}
},
T.row {
grow_factor = 1,
T.column {
horizontal_grow = true,
vertical_grow = true,
T.grid {
T.row {
T.column {
border = "all",
border_size = 5,
horizontal_grow = true,
vertical_grow = true,
T.grid {
T.row {
T.column {
T.label {
label = _" scenario: ",
}
},
T.column {
T.slider {
definition="short",
id = "sl_scenario",
minimum_value=1,
maximum_value=6,
}
},
T.column {
T.label {
label = _" map: ",
width=20,
}
},
T.column {
T.slider {
definition="default",
id = "sl_map",
minimum_value=1,
maximum_value=10,
}
},
}
},
},
}
}
}
},
T.row {
T.column {
horizontal_grow = true,
T.grid {
T.row {
T.column {
grow_factor = 1,
T.label {
label = "length"
}
},
T.column {
horizontal_alignment = "right",
T.slider {
id = "sl_length",
minimum_value=1,
maximum_value=100,
}
}
},
T.row {
T.column {
grow_factor = 1,
T.label {
label = "villages"
}
},
T.column {
horizontal_alignment = "right",
T.slider {
id = "sl_villages",
minimum_value=1,
maximum_value=100,
}
}
},
T.row {
T.column {
grow_factor = 1,
T.label {
label = "castle"
}
},
T.column {
horizontal_alignment = "right",
T.slider {
id = "sl_castle",
minimum_value=1,
maximum_value=20,
}
}
},
T.row {
T.column {
grow_factor = 1,
T.label {
label = "iterations"
}
},
T.column {
horizontal_alignment = "right",
T.slider {
id = "sl_iterations",
minimum_value=10,
maximum_value=20000,
}
}
},
T.row {
T.column {
grow_factor = 1,
T.label {
label = "hill_size"
}
},
T.column {
horizontal_alignment = "right",
T.slider {
id = "sl_hill_size",
minimum_value=1,
maximum_value=10,
}
}
},
T.row {
T.column {
grow_factor = 1,
T.label {
label = "island"
}
},
T.column {
horizontal_alignment = "right",
T.slider {
id = "sl_island",
minimum_value=1,
maximum_value=10,
}
}
},
T.row {
T.column {
grow_factor = 1,
T.label {
label = "castles"
}
},
T.column {
horizontal_alignment = "right",
T.slider {
id = "sl_ncastles",
minimum_value=1,
maximum_value=10,
}
}
},
}
},
T.row {
T.column {
horizontal_grow = true,
T.grid {
T.row {
T.column {
grow_factor = 1,
T.spacer {
}
},
T.column {
horizontal_alignment = "right",
T.button {
label = "OK",
id = "ok",
}
}
}
}
}
}
}
}
}
local dialog_wml = wml.load "campaigns/World_Conquest/gui/settings_dialog.cfg"
function wc2_debug_settings(nplayers)
@ -299,5 +89,5 @@ function wc2_debug_settings(nplayers)
globals.settings.ncastles = window.sl_ncastles.value
end
gui.show_dialog(dialog_wml, preshow, postshow)
gui.show_dialog(wml.get_child(dialog_wml, "resolution"), preshow, postshow)
end