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 "?"),
|
||||
desition = function()
|
||||
decision = 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",
|
||||
desition = function()
|
||||
decision = function()
|
||||
Audio.music_stop()
|
||||
end
|
||||
},
|
||||
{
|
||||
label = "Back",
|
||||
desition = function()
|
||||
decision = function()
|
||||
AudioTestWindow.back()
|
||||
end
|
||||
},
|
||||
@@ -90,7 +90,7 @@ function AudioTestWindow.update()
|
||||
AudioTestWindow.list_func, AudioTestWindow.index_func
|
||||
)
|
||||
elseif Input.menu_confirm() then
|
||||
AudioTestWindow.menuitems[AudioTestWindow.index_menu].desition()
|
||||
AudioTestWindow.menuitems[AudioTestWindow.index_menu].decision()
|
||||
elseif Input.menu_back() then
|
||||
AudioTestWindow.back()
|
||||
end
|
||||
|
||||
@@ -5,11 +5,11 @@ ConfigurationWindow = {
|
||||
|
||||
function ConfigurationWindow.init()
|
||||
ConfigurationWindow.controls = {
|
||||
UI.create_desition_item(
|
||||
UI.create_decision_item(
|
||||
"Save",
|
||||
function() Config.save() end
|
||||
),
|
||||
UI.create_desition_item(
|
||||
UI.create_decision_item(
|
||||
"Restore Defaults",
|
||||
function() Config.restore_defaults() end
|
||||
),
|
||||
@@ -40,7 +40,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 == "desition_item" then
|
||||
elseif control.type == "decision_item" then
|
||||
local label_text = control.label
|
||||
if i == ConfigurationWindow.selected_control then
|
||||
color = Config.colors.item
|
||||
@@ -82,9 +82,9 @@ function ConfigurationWindow.update()
|
||||
elseif btnp(3) then local new_value = math.min(control.max, current_value + control.step)
|
||||
control.set(new_value)
|
||||
end
|
||||
elseif control.type == "desition_item" then
|
||||
elseif control.type == "decision_item" then
|
||||
if Input.menu_confirm() then
|
||||
control.desition()
|
||||
control.decision()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,15 +3,15 @@ function GameWindow.draw()
|
||||
MapManager.draw(screen.background)
|
||||
UI.draw_top_bar(screen.name)
|
||||
if screen and screen.decisions and #screen.decisions > 0 then
|
||||
local available_desitions = {}
|
||||
for _, desition_id in ipairs(screen.decisions) do
|
||||
local desition = DesitionManager.get(desition_id)
|
||||
if desition and desition.condition() then
|
||||
table.insert(available_desitions, desition)
|
||||
local available_decisions = {}
|
||||
for _, decision_id in ipairs(screen.decisions) do
|
||||
local decision = DecisionManager.get(decision_id)
|
||||
if decision and decision.condition() then
|
||||
table.insert(available_decisions, decision)
|
||||
end
|
||||
end
|
||||
if #available_desitions > 0 then
|
||||
UI.draw_desition_selector(available_desitions, Context.selected_desition_index)
|
||||
if #available_decisions > 0 then
|
||||
UI.draw_decision_selector(available_decisions, Context.selected_decision_index)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -28,36 +28,36 @@ function GameWindow.update()
|
||||
if Context.current_screen < 1 then
|
||||
Context.current_screen = #Context.screens
|
||||
end
|
||||
Context.selected_desition_index = 1 elseif Input.down() then
|
||||
Context.selected_decision_index = 1 elseif Input.down() then
|
||||
Context.current_screen = Context.current_screen + 1
|
||||
if Context.current_screen > #Context.screens then
|
||||
Context.current_screen = 1
|
||||
end
|
||||
Context.selected_desition_index = 1 end
|
||||
Context.selected_decision_index = 1 end
|
||||
|
||||
local screen = Context.screens[Context.current_screen]
|
||||
if screen and screen.decisions and #screen.decisions > 0 then
|
||||
local available_desitions = {}
|
||||
for _, desition_id in ipairs(screen.decisions) do
|
||||
local desition = DesitionManager.get(desition_id)
|
||||
if desition and desition.condition() then table.insert(available_desitions, desition)
|
||||
local available_decisions = {}
|
||||
for _, decision_id in ipairs(screen.decisions) do
|
||||
local decision = DecisionManager.get(decision_id)
|
||||
if decision and decision.condition() then table.insert(available_decisions, decision)
|
||||
end
|
||||
end
|
||||
|
||||
if #available_desitions == 0 then return end
|
||||
if #available_decisions == 0 then return end
|
||||
|
||||
local new_selected_desition_index = UI.update_desition_selector(
|
||||
available_desitions,
|
||||
Context.selected_desition_index
|
||||
local new_selected_decision_index = UI.update_decision_selector(
|
||||
available_decisions,
|
||||
Context.selected_decision_index
|
||||
)
|
||||
|
||||
if new_selected_desition_index ~= Context.selected_desition_index then
|
||||
Context.selected_desition_index = new_selected_desition_index
|
||||
if new_selected_decision_index ~= Context.selected_decision_index then
|
||||
Context.selected_decision_index = new_selected_decision_index
|
||||
end
|
||||
|
||||
if Input.select() then
|
||||
local selected_desition = available_desitions[Context.selected_desition_index]
|
||||
if selected_desition and selected_desition.handle then Audio.sfx_select() selected_desition.handle()
|
||||
local selected_decision = available_decisions[Context.selected_decision_index]
|
||||
if selected_decision and selected_decision.handle then Audio.sfx_select() selected_decision.handle()
|
||||
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.desition then
|
||||
if selected_item and selected_item.decision then
|
||||
Audio.sfx_select()
|
||||
selected_item.desition()
|
||||
selected_item.decision()
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -47,14 +47,14 @@ end
|
||||
function MenuWindow.refresh_menu_items()
|
||||
Context.menu_items = {}
|
||||
if Context.game_in_progress then
|
||||
table.insert(Context.menu_items, {label = "Resume Game", desition = MenuWindow.resume_game})
|
||||
table.insert(Context.menu_items, {label = "Save Game", desition = MenuWindow.save_game})
|
||||
table.insert(Context.menu_items, {label = "Resume Game", decision = MenuWindow.resume_game})
|
||||
table.insert(Context.menu_items, {label = "Save Game", decision = MenuWindow.save_game})
|
||||
end
|
||||
|
||||
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})
|
||||
table.insert(Context.menu_items, {label = "New Game", decision = MenuWindow.new_game})
|
||||
table.insert(Context.menu_items, {label = "Load Game", decision = MenuWindow.load_game})
|
||||
table.insert(Context.menu_items, {label = "Configuration", decision = MenuWindow.configuration})
|
||||
table.insert(Context.menu_items, {label = "Audio Test", decision = MenuWindow.audio_test})
|
||||
table.insert(Context.menu_items, {label = "Exit", decision = MenuWindow.exit})
|
||||
|
||||
Context.selected_menu_item = 1 end
|
||||
|
||||
Reference in New Issue
Block a user