49 lines
2.0 KiB
Lua
49 lines
2.0 KiB
Lua
-- Read initialized tutorial wrapper rows only; never load their JsonPath.
|
|
do
|
|
_G.__gacCwTutorialRows3=_G.__gacCwTutorialRows3 or {count=0}
|
|
local s=_G.__gacCwTutorialRows3
|
|
if not s.done then
|
|
local log=function(v)CS.UnityEngine.Debug.Log('[GAC_CW_TUTORIAL_ROWS] '..tostring(v))end
|
|
local ok,err=pcall(function()
|
|
local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60)
|
|
if not s.iterator then
|
|
local module=CS.RPG.Client.GlobalVars.s_ModuleManager.GridFightModule
|
|
local rows=module.TutorialStageConfigs
|
|
if rows.Count>64 then error('Tutorial table exceeds capture bound')end
|
|
s.expected=rows.Count;s.iterator=rows:GetEnumerator();log('BEGIN count='..s.expected)
|
|
end
|
|
if s.iterator:MoveNext()then
|
|
local wrapper=s.iterator.Current.Value
|
|
local t=wrapper:GetType()
|
|
local row=nil
|
|
for depth=1,4 do
|
|
if not t then break end
|
|
local fields=t:GetFields(flags)
|
|
for i=0,math.min(fields.Length-1,47)do
|
|
local f=fields[i]
|
|
if f.FieldType.FullName=='RPG.GameCore.GridFightTutorialStageConfigRow' then row=f:GetValue(wrapper)end
|
|
end
|
|
if not row then
|
|
local methods=t:GetMethods(flags)
|
|
for i=0,math.min(methods.Length-1,63)do
|
|
local m=methods[i]
|
|
if m.Name:sub(1,4)=='get_' and m.ReturnType.FullName=='RPG.GameCore.GridFightTutorialStageConfigRow' and m:GetParameters().Length==0 then
|
|
row=m:Invoke(wrapper,CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),0),nil,CS.System.Array.CreateInstance(typeof(CS.System.Object),0),nil)
|
|
end
|
|
end
|
|
end
|
|
if row then break end
|
|
t=t.BaseType
|
|
end
|
|
if not row then error('Tutorial wrapper has no native row field in bounded base chain')end
|
|
log('ROW '..CS.Newtonsoft.Json.JsonConvert.SerializeObject(row))
|
|
s.count=s.count+1
|
|
else
|
|
if s.count~=s.expected then error('Tutorial table changed during capture')end
|
|
log('END');s.done=true
|
|
end
|
|
end)
|
|
if not ok then log('ERROR '..tostring(err));s.done=true end
|
|
end
|
|
end
|