V1 update (#1)

This commit is contained in:
Nguyễn Quốc Hưng
2024-06-06 16:01:24 +07:00
committed by Squishy (C6H12O6+NaCl+H2O)
parent 3343d8711b
commit 1d6643448e
30 changed files with 1000 additions and 228 deletions

View File

@@ -160,10 +160,10 @@ function ReplaySelectScene:onInputPress(e)
end
elseif e.input == "rotate_left" then -- Export
local plain_replay_data = love.data.encode("string", "base64", love.filesystem.read(REPLAY_DIR..selected_replay))
love.system.setClipboardText(("BEGINNING_OF_TROMI_REPLAY|%s|%s|END_OF_TROMI_REPLAY"):format(selected_replay, plain_replay_data))
love.system.setClipboardText(("BEGIN_OF_TROMI_REPLAY|%s|%s|END_OF_TROMI_REPLAY"):format(selected_replay, plain_replay_data))
elseif e.input == "rotate_right" then -- Import
local input_data = love.system.getClipboardText()
if input_data:find("BEGINNING_OF_TROMI_REPLAY|", 1, true) == 1 and input_data:find("|END_OF_TROMI_REPLAY", 1, true) == #input_data - 19 then
if input_data:find("BEGIN_OF_TROMI_REPLAY|", 1, true) == 1 and input_data:find("|END_OF_TROMI_REPLAY", 1, true) == #input_data - 19 then
local data_part = input_data:sub(27, #input_data - 20)
local separator_pos = data_part:find("|", 1, true)
local replay_name = data_part:sub(1, separator_pos - 1)
@@ -171,8 +171,10 @@ function ReplaySelectScene:onInputPress(e)
local replay_data = love.data.decode("string", "base64", data_part:sub(separator_pos + 1))
love.filesystem.write(replay_path, replay_data)
BUTTON.reset(buttonList)
SCENE = ReplayTestScene(replay_name)
else
BUTTON.reset(buttonList)
SCENE = ReplayTestScene()
end
elseif e.input == "up" or e.scancode == "up" then