Compare commits
3 Commits
feature/sp
...
feature/sc
| Author | SHA1 | Date | |
|---|---|---|---|
| 7e1dd28808 | |||
| 0b25ecc793 | |||
| f08e4ad1d4 |
10
.luacheckrc
10
.luacheckrc
@@ -14,6 +14,16 @@ globals = {
|
|||||||
"Context",
|
"Context",
|
||||||
"Meters",
|
"Meters",
|
||||||
"Minigames",
|
"Minigames",
|
||||||
|
"SplashWindow",
|
||||||
|
"IntroWindow",
|
||||||
|
"MenuWindow",
|
||||||
|
"GameWindow",
|
||||||
|
"PopupWindow",
|
||||||
|
"ConfigurationWindow",
|
||||||
|
"AudioTestWindow",
|
||||||
|
"MinigameButtonMashWindow",
|
||||||
|
"MinigameRhythmWindow",
|
||||||
|
"MinigameDDRWindow",
|
||||||
"mset",
|
"mset",
|
||||||
"mget",
|
"mget",
|
||||||
"btnp",
|
"btnp",
|
||||||
|
|||||||
@@ -4,5 +4,4 @@ Decision.register({
|
|||||||
handle = function()
|
handle = function()
|
||||||
Util.go_to_screen_by_id("home")
|
Util.go_to_screen_by_id("home")
|
||||||
end,
|
end,
|
||||||
condition = function() return true end
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,5 +4,4 @@ Decision.register({
|
|||||||
handle = function()
|
handle = function()
|
||||||
Util.go_to_screen_by_id("office")
|
Util.go_to_screen_by_id("office")
|
||||||
end,
|
end,
|
||||||
condition = function() return true end
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,5 +4,4 @@ Decision.register({
|
|||||||
handle = function()
|
handle = function()
|
||||||
Util.go_to_screen_by_id("toilet")
|
Util.go_to_screen_by_id("toilet")
|
||||||
end,
|
end,
|
||||||
condition = function() return true end
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,5 +4,4 @@ Decision.register({
|
|||||||
handle = function()
|
handle = function()
|
||||||
Util.go_to_screen_by_id("walking_to_home")
|
Util.go_to_screen_by_id("walking_to_home")
|
||||||
end,
|
end,
|
||||||
condition = function() return true end
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,5 +4,4 @@ Decision.register({
|
|||||||
handle = function()
|
handle = function()
|
||||||
Util.go_to_screen_by_id("walking_to_office")
|
Util.go_to_screen_by_id("walking_to_office")
|
||||||
end,
|
end,
|
||||||
condition = function() return true end
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,5 +4,4 @@ Decision.register({
|
|||||||
handle = function()
|
handle = function()
|
||||||
Situation.apply("drink_coffee")
|
Situation.apply("drink_coffee")
|
||||||
end,
|
end,
|
||||||
condition = function() return true end
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,5 +2,4 @@ Decision.register({
|
|||||||
id = "play_button_mash",
|
id = "play_button_mash",
|
||||||
label = "Play Button Mash",
|
label = "Play Button Mash",
|
||||||
handle = function() Meters.hide() MinigameButtonMashWindow.start(WINDOW_GAME) end,
|
handle = function() Meters.hide() MinigameButtonMashWindow.start(WINDOW_GAME) end,
|
||||||
condition = function() return true end
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,5 +2,4 @@ Decision.register({
|
|||||||
id = "play_ddr",
|
id = "play_ddr",
|
||||||
label = "Play DDR (Random)",
|
label = "Play DDR (Random)",
|
||||||
handle = function() Meters.hide() MinigameDDRWindow.start(WINDOW_GAME, nil) end,
|
handle = function() Meters.hide() MinigameDDRWindow.start(WINDOW_GAME, nil) end,
|
||||||
condition = function() return true end
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,5 +2,4 @@ Decision.register({
|
|||||||
id = "play_rhythm",
|
id = "play_rhythm",
|
||||||
label = "Play Rhythm Game",
|
label = "Play Rhythm Game",
|
||||||
handle = function() Meters.hide() MinigameRhythmWindow.start(WINDOW_GAME) end,
|
handle = function() Meters.hide() MinigameRhythmWindow.start(WINDOW_GAME) end,
|
||||||
condition = function() return true end
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ function Context.new_game()
|
|||||||
reset_context_to_initial_state()
|
reset_context_to_initial_state()
|
||||||
Context.game_in_progress = true
|
Context.game_in_progress = true
|
||||||
MenuWindow.refresh_menu_items()
|
MenuWindow.refresh_menu_items()
|
||||||
|
Context.screens[Context.current_screen].init()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Context.save_game()
|
function Context.save_game()
|
||||||
@@ -105,4 +106,5 @@ function Context.load_game()
|
|||||||
|
|
||||||
Context.game_in_progress = true
|
Context.game_in_progress = true
|
||||||
MenuWindow.refresh_menu_items()
|
MenuWindow.refresh_menu_items()
|
||||||
|
Context.screens[Context.current_screen].init()
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
local SplashWindow = {}
|
SplashWindow = {}
|
||||||
local IntroWindow = {}
|
IntroWindow = {}
|
||||||
local MenuWindow = {}
|
MenuWindow = {}
|
||||||
local GameWindow = {}
|
GameWindow = {}
|
||||||
local PopupWindow = {}
|
PopupWindow = {}
|
||||||
local ConfigurationWindow = {}
|
ConfigurationWindow = {}
|
||||||
local AudioTestWindow = {}
|
AudioTestWindow = {}
|
||||||
local MinigameButtonMashWindow = {}
|
MinigameButtonMashWindow = {}
|
||||||
local MinigameRhythmWindow = {}
|
MinigameRhythmWindow = {}
|
||||||
local MinigameDDRWindow = {}
|
MinigameDDRWindow = {}
|
||||||
Util = {}
|
Util = {}
|
||||||
Meters = {}
|
Meters = {}
|
||||||
Minigames = {}
|
Minigames = {}
|
||||||
|
|||||||
@@ -7,6 +7,12 @@ function Screen.register(screen_data)
|
|||||||
if not screen_data.situations then
|
if not screen_data.situations then
|
||||||
screen_data.situations = {}
|
screen_data.situations = {}
|
||||||
end
|
end
|
||||||
|
if not screen_data.init then
|
||||||
|
screen_data.init = function() end
|
||||||
|
end
|
||||||
|
if not screen_data.update then
|
||||||
|
screen_data.update = function() end
|
||||||
|
end
|
||||||
_screens[screen_data.id] = screen_data
|
_screens[screen_data.id] = screen_data
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ function Situation.register(situation)
|
|||||||
if not situation.handle then
|
if not situation.handle then
|
||||||
situation.handle = function() end
|
situation.handle = function() end
|
||||||
end
|
end
|
||||||
|
if not situation.update then
|
||||||
|
situation.update = function() end
|
||||||
|
end
|
||||||
if _situations[situation.id] then
|
if _situations[situation.id] then
|
||||||
trace("Warning: Overwriting situation with id: " .. situation.id)
|
trace("Warning: Overwriting situation with id: " .. situation.id)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ function GameWindow.draw()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function GameWindow.update()
|
function GameWindow.update()
|
||||||
|
local previous_screen_index = Context.current_screen
|
||||||
|
|
||||||
if Input.menu_back() then
|
if Input.menu_back() then
|
||||||
Context.active_window = WINDOW_MENU
|
Context.active_window = WINDOW_MENU
|
||||||
MenuWindow.refresh_menu_items()
|
MenuWindow.refresh_menu_items()
|
||||||
@@ -37,6 +39,19 @@ function GameWindow.update()
|
|||||||
Context.selected_decision_index = 1 end
|
Context.selected_decision_index = 1 end
|
||||||
|
|
||||||
local screen = Context.screens[Context.current_screen]
|
local screen = Context.screens[Context.current_screen]
|
||||||
|
screen.update()
|
||||||
|
|
||||||
|
if previous_screen_index ~= Context.current_screen then
|
||||||
|
screen.init()
|
||||||
|
end
|
||||||
|
|
||||||
|
if Context.current_situation then
|
||||||
|
local current_situation_obj = Situation.get(Context.current_situation)
|
||||||
|
if current_situation_obj and current_situation_obj.update then
|
||||||
|
current_situation_obj.update()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if screen and screen.decisions and #screen.decisions > 0 then
|
if screen and screen.decisions and #screen.decisions > 0 then
|
||||||
local available_decisions = {}
|
local available_decisions = {}
|
||||||
for _, decision_id in ipairs(screen.decisions) do
|
for _, decision_id in ipairs(screen.decisions) do
|
||||||
|
|||||||
Reference in New Issue
Block a user