Files
GaCy-GO/tools/cw_tutorial_json_capture.lua
T

33 lines
1.6 KiB
Lua

-- Parse only the exact native FirstPlay JSON through the plain JSON reader.
-- Does not call LoadLevelGraphConfig, execute tasks, or start a game session.
-- Output is bounded to one 4096-byte JSON-escaped chunk per heartbeat.
do
_G.__gacCwTutorialJson1=_G.__gacCwTutorialJson1 or {index=1}
local s=_G.__gacCwTutorialJson1
if not s.done then
local log=function(v)CS.UnityEngine.Debug.Log('[GAC_CW_TUTORIAL_JSON] '..tostring(v))end
local ok,err=pcall(function()
if not s.text then
local rule=CS.RPG.GameCore.ConstValueCommonExcelTable.GetData('GridFight_FirstPlay_JsonPath')
if not rule or not rule.Value.IsString then error('Native tutorial JSON path missing')end
s.path=rule.Value.StringValue
local node=CS.RPG.GameCore.GameCoreConfigLoader.LoadJsonConfig(s.path)
if not node then error('Plain JSON reader returned nil')end
s.text=tostring(node:ToString())
if #s.text>1048576 then error('Tutorial JSON exceeds capture bound')end
log('BEGIN path='..s.path..' bytes='..#s.text)
end
if s.index<=#s.text then
-- JSON configuration is emitted as escaped text to preserve chunk content.
local finish=math.min(s.index+4095,#s.text)
while finish<#s.text and string.byte(s.text,finish+1)>=128 and string.byte(s.text,finish+1)<192 do finish=finish-1 end
log('CHUNK '..s.index..' '..CS.Newtonsoft.Json.JsonConvert.SerializeObject(s.text:sub(s.index,finish)))
s.index=finish+1
else
log('END bytes='..#s.text);s.text=nil;s.done=true
end
end)
if not ok then log('ERROR '..tostring(err));s.done=true;s.text=nil end
end
end