diff --git a/TJAPlayer3/Stages/07.Game/Taiko/ScriptBG.cs b/TJAPlayer3/Stages/07.Game/Taiko/ScriptBG.cs index 653d1f83..47dc4f6c 100644 --- a/TJAPlayer3/Stages/07.Game/Taiko/ScriptBG.cs +++ b/TJAPlayer3/Stages/07.Game/Taiko/ScriptBG.cs @@ -86,8 +86,14 @@ namespace TJAPlayer3 - - LuaScript.DoFile(filePath); + using (var streamAPI = new StreamReader("BGScriptAPI.lua", Encoding.UTF8)) + { + using (var stream = new StreamReader(filePath, Encoding.UTF8)) + { + var text = $"{streamAPI.ReadToEnd()}\n{stream.ReadToEnd()}"; + LuaScript.DoString(text); + } + } LuaUpdateValues = LuaScript.GetFunction("updateValues"); LuaClearIn = LuaScript.GetFunction("clearIn"); diff --git a/Test/BGScriptAPI.lua b/Test/BGScriptAPI.lua new file mode 100644 index 00000000..9af2cbfe --- /dev/null +++ b/Test/BGScriptAPI.lua @@ -0,0 +1,12 @@ +local fps = 0 +local deltaTime = 0 +local isClear = { false, false } +local towerNightNum = 0 + +function updateValues(_deltaTime, _fps, _isClear, _towerNightNum) + deltaTime = _deltaTime + fps = _fps + isClear = _isClear + towerNightNum = _towerNightNum + deltaTime = _deltaTime +end \ No newline at end of file diff --git a/Test/System/SimpleStyle/Graphics/5_Game/5_Background/Dan/Up/0/Script.lua b/Test/System/SimpleStyle/Graphics/5_Game/5_Background/Dan/Up/0/Script.lua index b6dacaf8..b6a97438 100644 --- a/Test/System/SimpleStyle/Graphics/5_Game/5_Background/Dan/Up/0/Script.lua +++ b/Test/System/SimpleStyle/Graphics/5_Game/5_Background/Dan/Up/0/Script.lua @@ -1,16 +1,3 @@ -local fps = 0 -local deltaTime = 0 -local isClear = { false, false } -local towerNightNum = 0 - -function updateValues(_deltaTime, _fps, _isClear, _towerNightNum) - deltaTime = _deltaTime - fps = _fps - isClear = _isClear - towerNightNum = _towerNightNum - deltaTime = _deltaTime -end - local bgWidth_1 = 1323 local bgWidth_2 = 1280 local bgWidth_3 = 1280 diff --git a/Test/System/SimpleStyle/Graphics/5_Game/5_Background/Normal/Down/0/Script.lua b/Test/System/SimpleStyle/Graphics/5_Game/5_Background/Normal/Down/0/Script.lua index 8457e501..f711b7c3 100644 --- a/Test/System/SimpleStyle/Graphics/5_Game/5_Background/Normal/Down/0/Script.lua +++ b/Test/System/SimpleStyle/Graphics/5_Game/5_Background/Normal/Down/0/Script.lua @@ -1,16 +1,3 @@ -local fps = 0 -local deltaTime = 0 -local isClear = { false, false } -local towerNightNum = 0 - -function updateValues(_deltaTime, _fps, _isClear, _towerNightNum) - deltaTime = _deltaTime - fps = _fps - isClear = _isClear - towerNightNum = _towerNightNum - deltaTime = _deltaTime -end - local loopWidth = 1255 local bgClearFade = 0 diff --git a/Test/System/SimpleStyle/Graphics/5_Game/5_Background/Normal/Up/0/Script.lua b/Test/System/SimpleStyle/Graphics/5_Game/5_Background/Normal/Up/0/Script.lua index e2c6019d..df53299e 100644 --- a/Test/System/SimpleStyle/Graphics/5_Game/5_Background/Normal/Up/0/Script.lua +++ b/Test/System/SimpleStyle/Graphics/5_Game/5_Background/Normal/Up/0/Script.lua @@ -1,16 +1,3 @@ -local fps = 0 -local deltaTime = 0 -local isClear = { false, false } -local towerNightNum = 0 - -function updateValues(_deltaTime, _fps, _isClear, _towerNightNum) - deltaTime = _deltaTime - fps = _fps - isClear = _isClear - towerNightNum = towerNightNum - deltaTime = _deltaTime -end - local loopWidth = 328 local loopHeight = 154 diff --git a/Test/System/SimpleStyle/Graphics/5_Game/5_Background/Sample/Template/Script.lua b/Test/System/SimpleStyle/Graphics/5_Game/5_Background/Sample/Template/Script.lua index 5d6e6d4a..8a78211c 100644 --- a/Test/System/SimpleStyle/Graphics/5_Game/5_Background/Sample/Template/Script.lua +++ b/Test/System/SimpleStyle/Graphics/5_Game/5_Background/Sample/Template/Script.lua @@ -1,4 +1,3 @@ - --func:DrawText(x, y, text); --func:DrawNum(x, y, num); --func:AddGraph("filename"); @@ -7,19 +6,6 @@ --func:SetScale(xscale, yscale, "filename"); --func:SetColor(r, g, b, "filename"); -local fps = 0 -local deltaTime = 0 -local isClear = { false, false } -local towerNightNum = 0 - -function updateValues(_deltaTime, _fps, _isClear, _towerNightNum) - deltaTime = _deltaTime - fps = _fps - isClear = _isClear - towerNightNum = _towerNightNum - deltaTime = _deltaTime -end - function clearIn(player) end diff --git a/Test/System/SimpleStyle/Graphics/5_Game/5_Background/Tower/Up/0/Script.lua b/Test/System/SimpleStyle/Graphics/5_Game/5_Background/Tower/Up/0/Script.lua index 7eb91000..7d10cda7 100644 --- a/Test/System/SimpleStyle/Graphics/5_Game/5_Background/Tower/Up/0/Script.lua +++ b/Test/System/SimpleStyle/Graphics/5_Game/5_Background/Tower/Up/0/Script.lua @@ -1,16 +1,3 @@ -local fps = 0 -local deltaTime = 0 -local isClear = { false, false } -local towerNightNum = 0 - -function updateValues(_deltaTime, _fps, _isClear, _towerNightNum) - deltaTime = _deltaTime - fps = _fps - isClear = _isClear - towerNightNum = _towerNightNum - deltaTime = _deltaTime -end - local bgWidth_1 = 1323 local bgWidth_2 = 1280 local bgWidth_3 = 1280