1
0
mirror of synced 2024-11-24 07:30:21 +01:00

Script.luaを簡潔に (#242)

* Script.luaを簡潔に

* Keep documentation for function calls on Background Lua scripts

Co-authored-by: 0auBSQ <58159635+0auBSQ@users.noreply.github.com>
This commit is contained in:
Takkkom 2022-06-07 15:32:47 +09:00 committed by GitHub
parent f4adbf41b5
commit 1aca9a7a60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 68 deletions

View File

@ -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");

12
Test/BGScriptAPI.lua Normal file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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