rename action to desition
This commit is contained in:
@@ -10,7 +10,7 @@ function AudioTestWindow.generate_menuitems(list_func, index_func)
|
||||
return {
|
||||
{
|
||||
label = "Play music/sound: " .. (list_func[index_func] or "?"),
|
||||
action = function()
|
||||
desition = function()
|
||||
local current_func = Audio[list_func[index_func]]
|
||||
if current_func then
|
||||
current_func()
|
||||
@@ -21,13 +21,13 @@ function AudioTestWindow.generate_menuitems(list_func, index_func)
|
||||
},
|
||||
{
|
||||
label = "Stop playing music",
|
||||
action = function()
|
||||
desition = function()
|
||||
Audio.music_stop()
|
||||
end
|
||||
},
|
||||
{
|
||||
label = "Back",
|
||||
action = function()
|
||||
desition = function()
|
||||
AudioTestWindow.back()
|
||||
end
|
||||
},
|
||||
@@ -78,7 +78,7 @@ function AudioTestWindow.update()
|
||||
AudioTestWindow.index_func = Util.safeindex(AudioTestWindow.list_func, AudioTestWindow.index_func + 1)
|
||||
AudioTestWindow.menuitems = AudioTestWindow.generate_menuitems(AudioTestWindow.list_func, AudioTestWindow.index_func)
|
||||
elseif Input.menu_confirm() then
|
||||
AudioTestWindow.menuitems[AudioTestWindow.index_menu].action()
|
||||
AudioTestWindow.menuitems[AudioTestWindow.index_menu].desition()
|
||||
elseif Input.menu_back() then
|
||||
AudioTestWindow.back()
|
||||
end
|
||||
|
||||
@@ -5,11 +5,11 @@ ConfigurationWindow = {
|
||||
|
||||
function ConfigurationWindow.init()
|
||||
ConfigurationWindow.controls = {
|
||||
UI.create_action_item(
|
||||
UI.create_desition_item(
|
||||
"Save",
|
||||
function() Config.save() end
|
||||
),
|
||||
UI.create_action_item(
|
||||
UI.create_desition_item(
|
||||
"Restore Defaults",
|
||||
function() Config.restore_defaults() end
|
||||
),
|
||||
@@ -46,7 +46,7 @@ function ConfigurationWindow.draw()
|
||||
Print.text(label_text, x_start, current_y, color)
|
||||
Print.text(value_text, value_x, current_y, color)
|
||||
end
|
||||
elseif control.type == "action_item" then
|
||||
elseif control.type == "desition_item" then
|
||||
local label_text = control.label
|
||||
if i == ConfigurationWindow.selected_control then
|
||||
color = Config.colors.item
|
||||
@@ -91,9 +91,9 @@ function ConfigurationWindow.update()
|
||||
local new_value = math.min(control.max, current_value + control.step)
|
||||
control.set(new_value)
|
||||
end
|
||||
elseif control.type == "action_item" then
|
||||
elseif control.type == "desition_item" then
|
||||
if Input.menu_confirm() then
|
||||
control.action()
|
||||
control.desition()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,9 +8,9 @@ function MenuWindow.update()
|
||||
|
||||
if Input.menu_confirm() then
|
||||
local selected_item = Context.menu_items[Context.selected_menu_item]
|
||||
if selected_item and selected_item.action then
|
||||
if selected_item and selected_item.desition then
|
||||
Audio.sfx_select()
|
||||
selected_item.action()
|
||||
selected_item.desition()
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -51,15 +51,15 @@ function MenuWindow.refresh_menu_items()
|
||||
Context.menu_items = {} -- Start with an empty table
|
||||
|
||||
if Context.game_in_progress then
|
||||
table.insert(Context.menu_items, {label = "Resume Game", action = MenuWindow.resume_game})
|
||||
table.insert(Context.menu_items, {label = "Save Game", action = MenuWindow.save_game})
|
||||
table.insert(Context.menu_items, {label = "Resume Game", desition = MenuWindow.resume_game})
|
||||
table.insert(Context.menu_items, {label = "Save Game", desition = MenuWindow.save_game})
|
||||
end
|
||||
|
||||
table.insert(Context.menu_items, {label = "New Game", action = MenuWindow.new_game})
|
||||
table.insert(Context.menu_items, {label = "Load Game", action = MenuWindow.load_game})
|
||||
table.insert(Context.menu_items, {label = "Configuration", action = MenuWindow.configuration})
|
||||
table.insert(Context.menu_items, {label = "Audio Test", action = MenuWindow.audio_test})
|
||||
table.insert(Context.menu_items, {label = "Exit", action = MenuWindow.exit})
|
||||
table.insert(Context.menu_items, {label = "New Game", desition = MenuWindow.new_game})
|
||||
table.insert(Context.menu_items, {label = "Load Game", desition = MenuWindow.load_game})
|
||||
table.insert(Context.menu_items, {label = "Configuration", desition = MenuWindow.configuration})
|
||||
table.insert(Context.menu_items, {label = "Audio Test", desition = MenuWindow.audio_test})
|
||||
table.insert(Context.menu_items, {label = "Exit", desition = MenuWindow.exit})
|
||||
|
||||
Context.selected_menu_item = 1 -- Reset selection after refreshing
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user