feature/refactor-npc-handling-to-desition-handling #3
@@ -6,7 +6,7 @@ init/init.windows.lua
|
|||||||
init/init.context.lua
|
init/init.context.lua
|
||||||
data/data.songs.lua
|
data/data.songs.lua
|
||||||
system/system.print.lua
|
system/system.print.lua
|
||||||
system/system.actions.lua
|
system/system.desitions.lua
|
||||||
system/system.input.lua
|
system/system.input.lua
|
||||||
system/system.audio.lua
|
system/system.audio.lua
|
||||||
system/system.ui.lua
|
system/system.ui.lua
|
||||||
|
|||||||
@@ -16,4 +16,4 @@ local Print = {}
|
|||||||
local Input = {}
|
local Input = {}
|
||||||
local Player = {}
|
local Player = {}
|
||||||
local Audio = {}
|
local Audio = {}
|
||||||
local Actions = {}
|
local Desitions = {}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
function Actions.start_minigame_mash()
|
function Desitions.start_minigame_mash()
|
||||||
MinigameButtonMashWindow.start(WINDOW_GAME)
|
MinigameButtonMashWindow.start(WINDOW_GAME)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Actions.start_minigame_rhythm()
|
function Desitions.start_minigame_rhythm()
|
||||||
MinigameRhythmWindow.start(WINDOW_GAME)
|
MinigameRhythmWindow.start(WINDOW_GAME)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Actions.start_minigame_ddr(song_key)
|
function Desitions.start_minigame_ddr(song_key)
|
||||||
MinigameDDRWindow.start(WINDOW_GAME, song_key)
|
MinigameDDRWindow.start(WINDOW_GAME, song_key)
|
||||||
end
|
end
|
||||||
@@ -80,10 +80,10 @@ function UI.create_numeric_stepper(label, value_getter, value_setter, min, max,
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function UI.create_action_item(label, action)
|
function UI.create_desition_item(label, desition)
|
||||||
return {
|
return {
|
||||||
label = label,
|
label = label,
|
||||||
action = action,
|
desition = desition,
|
||||||
type = "action_item"
|
type = "desition_item"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ function AudioTestWindow.generate_menuitems(list_func, index_func)
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
label = "Play music/sound: " .. (list_func[index_func] or "?"),
|
label = "Play music/sound: " .. (list_func[index_func] or "?"),
|
||||||
action = function()
|
desition = function()
|
||||||
local current_func = Audio[list_func[index_func]]
|
local current_func = Audio[list_func[index_func]]
|
||||||
if current_func then
|
if current_func then
|
||||||
current_func()
|
current_func()
|
||||||
@@ -21,13 +21,13 @@ function AudioTestWindow.generate_menuitems(list_func, index_func)
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label = "Stop playing music",
|
label = "Stop playing music",
|
||||||
action = function()
|
desition = function()
|
||||||
Audio.music_stop()
|
Audio.music_stop()
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label = "Back",
|
label = "Back",
|
||||||
action = function()
|
desition = function()
|
||||||
AudioTestWindow.back()
|
AudioTestWindow.back()
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
@@ -78,7 +78,7 @@ function AudioTestWindow.update()
|
|||||||
AudioTestWindow.index_func = Util.safeindex(AudioTestWindow.list_func, AudioTestWindow.index_func + 1)
|
AudioTestWindow.index_func = Util.safeindex(AudioTestWindow.list_func, AudioTestWindow.index_func + 1)
|
||||||
AudioTestWindow.menuitems = AudioTestWindow.generate_menuitems(AudioTestWindow.list_func, AudioTestWindow.index_func)
|
AudioTestWindow.menuitems = AudioTestWindow.generate_menuitems(AudioTestWindow.list_func, AudioTestWindow.index_func)
|
||||||
elseif Input.menu_confirm() then
|
elseif Input.menu_confirm() then
|
||||||
AudioTestWindow.menuitems[AudioTestWindow.index_menu].action()
|
AudioTestWindow.menuitems[AudioTestWindow.index_menu].desition()
|
||||||
elseif Input.menu_back() then
|
elseif Input.menu_back() then
|
||||||
AudioTestWindow.back()
|
AudioTestWindow.back()
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ ConfigurationWindow = {
|
|||||||
|
|
||||||
function ConfigurationWindow.init()
|
function ConfigurationWindow.init()
|
||||||
ConfigurationWindow.controls = {
|
ConfigurationWindow.controls = {
|
||||||
UI.create_action_item(
|
UI.create_desition_item(
|
||||||
"Save",
|
"Save",
|
||||||
function() Config.save() end
|
function() Config.save() end
|
||||||
),
|
),
|
||||||
UI.create_action_item(
|
UI.create_desition_item(
|
||||||
"Restore Defaults",
|
"Restore Defaults",
|
||||||
function() Config.restore_defaults() end
|
function() Config.restore_defaults() end
|
||||||
),
|
),
|
||||||
@@ -46,7 +46,7 @@ function ConfigurationWindow.draw()
|
|||||||
Print.text(label_text, x_start, current_y, color)
|
Print.text(label_text, x_start, current_y, color)
|
||||||
Print.text(value_text, value_x, current_y, color)
|
Print.text(value_text, value_x, current_y, color)
|
||||||
end
|
end
|
||||||
elseif control.type == "action_item" then
|
elseif control.type == "desition_item" then
|
||||||
local label_text = control.label
|
local label_text = control.label
|
||||||
if i == ConfigurationWindow.selected_control then
|
if i == ConfigurationWindow.selected_control then
|
||||||
color = Config.colors.item
|
color = Config.colors.item
|
||||||
@@ -91,9 +91,9 @@ function ConfigurationWindow.update()
|
|||||||
local new_value = math.min(control.max, current_value + control.step)
|
local new_value = math.min(control.max, current_value + control.step)
|
||||||
control.set(new_value)
|
control.set(new_value)
|
||||||
end
|
end
|
||||||
elseif control.type == "action_item" then
|
elseif control.type == "desition_item" then
|
||||||
if Input.menu_confirm() then
|
if Input.menu_confirm() then
|
||||||
control.action()
|
control.desition()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ function MenuWindow.update()
|
|||||||
|
|
||||||
if Input.menu_confirm() then
|
if Input.menu_confirm() then
|
||||||
local selected_item = Context.menu_items[Context.selected_menu_item]
|
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()
|
Audio.sfx_select()
|
||||||
selected_item.action()
|
selected_item.desition()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -51,15 +51,15 @@ function MenuWindow.refresh_menu_items()
|
|||||||
Context.menu_items = {} -- Start with an empty table
|
Context.menu_items = {} -- Start with an empty table
|
||||||
|
|
||||||
if Context.game_in_progress then
|
if Context.game_in_progress then
|
||||||
table.insert(Context.menu_items, {label = "Resume Game", action = MenuWindow.resume_game})
|
table.insert(Context.menu_items, {label = "Resume Game", desition = MenuWindow.resume_game})
|
||||||
table.insert(Context.menu_items, {label = "Save Game", action = MenuWindow.save_game})
|
table.insert(Context.menu_items, {label = "Save Game", desition = MenuWindow.save_game})
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(Context.menu_items, {label = "New Game", action = MenuWindow.new_game})
|
table.insert(Context.menu_items, {label = "New Game", desition = MenuWindow.new_game})
|
||||||
table.insert(Context.menu_items, {label = "Load Game", action = MenuWindow.load_game})
|
table.insert(Context.menu_items, {label = "Load Game", desition = MenuWindow.load_game})
|
||||||
table.insert(Context.menu_items, {label = "Configuration", action = MenuWindow.configuration})
|
table.insert(Context.menu_items, {label = "Configuration", desition = MenuWindow.configuration})
|
||||||
table.insert(Context.menu_items, {label = "Audio Test", action = MenuWindow.audio_test})
|
table.insert(Context.menu_items, {label = "Audio Test", desition = MenuWindow.audio_test})
|
||||||
table.insert(Context.menu_items, {label = "Exit", action = MenuWindow.exit})
|
table.insert(Context.menu_items, {label = "Exit", desition = MenuWindow.exit})
|
||||||
|
|
||||||
Context.selected_menu_item = 1 -- Reset selection after refreshing
|
Context.selected_menu_item = 1 -- Reset selection after refreshing
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user