20 lines
1.3 KiB
Lua
20 lines
1.3 KiB
Lua
-- Serialize one already loaded plain configuration object per heartbeat.
|
|
do local function capture()
|
|
local s=_G.__gacFiveDimMiniConfig1 or {index=1};_G.__gacFiveDimMiniConfig1=s
|
|
local names={'MiniGameCollectionConfig','PlayerConfig','LevelConfig'}
|
|
if s.index>#names then return end
|
|
local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60)
|
|
local manager=CS.RPG.Client.GlobalVars.s_GamePhaseManager
|
|
local phase=manager and typeof(CS.RPG.Client.GamePhaseManager):GetField('_CurrentPhase',flags):GetValue(manager)
|
|
if not phase or typeof(CS.RPG.Client.BattleGamePhase):IsInstanceOfType(phase)then return end
|
|
local m=CS.RPG.Client.GlobalVars.s_ModuleManager.FiveDimModule
|
|
local cfg=m:GetType():GetField('_GameConfig',flags):GetValue(m)
|
|
if not cfg then return end
|
|
local name=names[s.index];s.index=s.index+1
|
|
local value=cfg:GetType():GetField(name,flags):GetValue(cfg)
|
|
local text=CS.Newtonsoft.Json.JsonConvert.SerializeObject(value)
|
|
if #text>65536 then error('config output bound')end
|
|
CS.UnityEngine.Debug.Log('[GAC_FIVEDIM_MINI_CONFIG] '..name..' '..text)
|
|
if s.index>#names then CS.UnityEngine.Debug.Log('[GAC_FIVEDIM_MINI_CONFIG] END')end
|
|
end;local ok,e=pcall(capture);if not ok then _G.__gacFiveDimMiniConfig1={index=99};CS.UnityEngine.Debug.Log('[GAC_FIVEDIM_MINI_CONFIG] ERROR '..tostring(e))end end
|