mirror of
https://gitea.com/SweetSea-ButImNotSweet/tromi_mobile.git
synced 2025-01-08 17:33:09 +08:00
Fix bugs related to the first time launching game
This commit is contained in:
@@ -4,7 +4,7 @@ ConfigScene.title = "Input Config"
|
|||||||
local menu_screens = {
|
local menu_screens = {
|
||||||
KeyConfigScene,
|
KeyConfigScene,
|
||||||
StickConfigScene,
|
StickConfigScene,
|
||||||
TouchConfigScene
|
TouchConfigScene,
|
||||||
}
|
}
|
||||||
|
|
||||||
local buttonList
|
local buttonList
|
||||||
@@ -45,6 +45,23 @@ function ConfigScene:new(first_time)
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if not SETTINGS.firstTime then
|
||||||
|
menu_screens[4] = TitleScene
|
||||||
|
buttonList[4] = BUTTON.new{
|
||||||
|
text = "⌂", font = FONT_big,
|
||||||
|
x = 75, y = 280, w = 40, h = 40,
|
||||||
|
codeWhenReleased = function()
|
||||||
|
if self.menu_state ~= 4 then
|
||||||
|
self.menu_state = 4
|
||||||
|
else
|
||||||
|
SCENE = TitleScene()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
}
|
||||||
|
else
|
||||||
|
menu_screens[4] = nil
|
||||||
|
buttonList[4] = nil
|
||||||
|
end
|
||||||
|
|
||||||
self.menu_state = 1
|
self.menu_state = 1
|
||||||
if first_time then
|
if first_time then
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ function KeyConfigScene:onInputPress(e)
|
|||||||
if e.type == "key" then
|
if e.type == "key" then
|
||||||
-- function keys, escape, and tab are reserved and can't be remapped
|
-- function keys, escape, and tab are reserved and can't be remapped
|
||||||
if e.scancode == "escape" then
|
if e.scancode == "escape" then
|
||||||
SCENE = InputConfigScene()
|
SCENE = InputConfigScene(SETTINGS.firstTime)
|
||||||
elseif self.input_state > #configurable_inputs then
|
elseif self.input_state > #configurable_inputs then
|
||||||
if e.scancode == "return" then
|
if e.scancode == "return" then
|
||||||
SETTINGS.input.keys = self.new_input
|
SETTINGS.input.keys = self.new_input
|
||||||
|
|||||||
@@ -14,10 +14,15 @@ local snapUnit = 1
|
|||||||
local hasChanged
|
local hasChanged
|
||||||
|
|
||||||
---@type function
|
---@type function
|
||||||
local exitSceneFunc = function()
|
local function exitSceneFunc(saved)
|
||||||
VCTRL.release()
|
VCTRL.release()
|
||||||
BUTTON.release(buttonList)
|
BUTTON.release(buttonList)
|
||||||
|
if SETTINGS.firstTime and not saved then
|
||||||
|
SCENE = InputConfigScene(true)
|
||||||
|
else
|
||||||
SCENE = TitleScene()
|
SCENE = TitleScene()
|
||||||
|
SETTINGS.firstTime = false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
buttonList = {
|
buttonList = {
|
||||||
@@ -51,7 +56,7 @@ buttonList = {
|
|||||||
text = "MENU",
|
text = "MENU",
|
||||||
x = 570, y = 5, w = 60, h = 25,
|
x = 570, y = 5, w = 60, h = 25,
|
||||||
codeWhenReleased = function()
|
codeWhenReleased = function()
|
||||||
if hasChanged then
|
if hasChanged or SETTINGS.firstTime then
|
||||||
local selection = love.window.showMessageBox(
|
local selection = love.window.showMessageBox(
|
||||||
"Save config?", "Do you want to save your changes before exiting?",
|
"Save config?", "Do you want to save your changes before exiting?",
|
||||||
{"Save", "Discard", "Keep editing", escapebutton = 2, enterbutton = 1},
|
{"Save", "Discard", "Keep editing", escapebutton = 2, enterbutton = 1},
|
||||||
@@ -59,10 +64,9 @@ buttonList = {
|
|||||||
)
|
)
|
||||||
if selection == 1 then
|
if selection == 1 then
|
||||||
SETTINGS.input.virtual = VCTRL.exportAll()
|
SETTINGS.input.virtual = VCTRL.exportAll()
|
||||||
SETTINGS.firstTime = false
|
|
||||||
-- love.window.showMessageBox("Saved!", "Your changes was saved!")
|
-- love.window.showMessageBox("Saved!", "Your changes was saved!")
|
||||||
|
|
||||||
exitSceneFunc()
|
exitSceneFunc(true)
|
||||||
elseif selection == 2 then
|
elseif selection == 2 then
|
||||||
VCTRL.clearAll()
|
VCTRL.clearAll()
|
||||||
VCTRL.new(SETTINGS.input.virtual)
|
VCTRL.new(SETTINGS.input.virtual)
|
||||||
@@ -141,12 +145,12 @@ local function sliderList_update()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function TouchConfigScene:new()
|
function TouchConfigScene:new(fromPreviewScene)
|
||||||
VCTRL.toggle(true)
|
VCTRL.toggle(true)
|
||||||
|
|
||||||
VCTRL.focus = nil
|
VCTRL.focus = nil
|
||||||
focusingButton = nil
|
focusingButton = nil
|
||||||
hasChanged = false
|
hasChanged = fromPreviewScene
|
||||||
Grid:new(10, 20)
|
Grid:new(10, 20)
|
||||||
-- TODO
|
-- TODO
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ local _defaultSettings = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SETTINGS = setmetatable(
|
SETTINGS = setmetatable(
|
||||||
{__force_saving__ = function() bitser.dumpLoveFile(CONFIG_FILE,_settings) end},
|
{},
|
||||||
{
|
{
|
||||||
__index = function(_, k)
|
__index = function(_, k)
|
||||||
if _settings[k] == nil then
|
if _settings[k] == nil then
|
||||||
|
|||||||
Reference in New Issue
Block a user