Fix various bugs

- Sometimes keyboard suddenly closed while a key is being pressed on mobile (TEST)
- Fix navigation issue in replay scene
- Fix Confirm key is not usable as Restart in 20G Training
This commit is contained in:
Squishy (C6H12O6+NaCl+H2O)
2024-06-14 15:20:36 +07:00
parent a5b72ef286
commit 52f0e5323f
4 changed files with 17 additions and 8 deletions

View File

@@ -12,7 +12,6 @@ local GameMode = Object:extend()
function GameMode:new(player_name, input_file, replay_grade)
VCTRL.toggle(MOBILE and not input_file and not SETTINGS.tvMode)
if MOBILE and not SETTINGS.tvMode then love.keyboard.setTextInput(false) end
VCTRL.reset()
if player_name == nil then self.training = true else self.training = false end

View File

@@ -170,14 +170,12 @@ function NameEntryScene:onInputPress(e)
BUTTON.release(buttonList, e.x, e.y, e.id)
SETTINGS['last_entry'] = name:upper()
SCENE = GameScene(name:lower())
else
if self.entry_pos == 3 then self:getPlayInfo(name)
elseif self.entry_pos == 3 then self:getPlayInfo(name)
else
self.name_entry[self.entry_pos ] = self.chars:sub(self.char_pos, self.char_pos)
self.name_entry[self.entry_pos+1] = self.chars:sub(self.char_pos, self.char_pos)
end
self.entry_pos = self.entry_pos + 1
end
self.entry_pos = self.entry_pos + 1
elseif e.input == "left" or e.scancode == "left" then
self.direction = "left"
elseif e.input == "right" or e.scancode == "right" then
@@ -199,6 +197,10 @@ end
function NameEntryScene:onInputRelease(e)
if e.type == "mouse" or e.type == "touch" then
BUTTON.release(buttonList, e.x, e.y, e.id)
elseif (
MOBILE and not SETTINGS.tvMode and
self.entry_pos == 4
) then love.keyboard.setTextInput(false)
elseif e.input == "left" or e.scancode == "left" or e.input == "right" or e.scancode == "right" then
self.direction = nil
self.repeat_counter = self.repeat_limit-1

View File

@@ -8,7 +8,11 @@ local buttonList = {
x = 325, y = 385, w = 100, h = 30,
text = CHAR.key.up.." Page up",
codeWhenReleased = function()
scene_self.page = math.max(scene_self.page - 1, 0)
if scene_self.page == 1 then
scene_self.page = 1 + math.floor(#scene_self.replays / scene_self.page_flip)
else
scene_self.page = scene_self.page - 1
end
scene_self.replay_select = 1;
end
},
@@ -16,7 +20,11 @@ local buttonList = {
x = 435, y = 385, w = 100, h = 30,
text = CHAR.key.down.." Page down",
codeWhenReleased = function()
scene_self.page = math.max(scene_self.page - 1, 1+(math.floor(#scene_self.replays / scene_self.page_flip)))
if scene_self.page < 1 + math.floor(#scene_self.replays / scene_self.page_flip) then
scene_self.page = scene_self.page + 1
else
scene_self.page = 1
end
scene_self.replay_select = 1;
end
},

View File

@@ -54,7 +54,7 @@ end
function TrainingScene:onInputPress(e)
if e.type == "mouse" or (e.type == "touch" and not VCTRL.press(e.x, e.y, e.id)) then
menuKey:press(e.x, e.y, e.id)
elseif (self.game.game_over or self.game.completed) and (e.input == "menu_decide" or e.input == "menu_back" or e.input == "rotate_right") and self.game.game_over_frames > 50 then
elseif (self.game.game_over or self.game.completed) and (e.input == "menu_back" or e.input == "rotate_right") and self.game.game_over_frames > 50 then
SCENE = TitleScene()
elseif (e.input == "menu_back") then
SCENE = TitleScene()