Files
GaCy-GO/tools/cw_ui_trace_probe.lua
T

35 lines
1.4 KiB
Lua

-- Temporary observers on the named CW entrance lifecycle only. Preserve every
-- argument/return; restore originals on deadline. No UI/gameplay action calls.
do
local function log(v)CS.UnityEngine.Debug.Log('[GAC_CW_UI_TRACE] '..tostring(v))end
local state=_G.__gacCwUiTrace1
if not state then
local class=package.loaded['Ui.GridFight.Entrance.S2.GridFightS2EntrancePage']
if type(class)=='table' then
state={class=class,methods={},deadline=CS.UnityEngine.Time.realtimeSinceStartup+120}
_G.__gacCwUiTrace1=state
for _,name in ipairs({'_on_load','_setup_view','_try_show_tutorial','_start_action','_on_entrance_anim_end','_on_dispose','_on_remain_timer_expire'})do
local original=class[name]
if type(original)=='function' then
local methodName=name
local wrapped=function(self,...)
log('ENTER '..methodName)
if methodName=='_on_dispose' or methodName=='_on_remain_timer_expire' then
if debug and debug.traceback then log('STACK '..debug.traceback('',2))end
end
return original(self,...)
end
state.methods[name]={original=original,wrapped=wrapped}
class[name]=wrapped
end
end
log('READY')
end
elseif not state.done and (state.stop or CS.UnityEngine.Time.realtimeSinceStartup>=state.deadline)then
for name,item in pairs(state.methods)do
if state.class[name]==item.wrapped then state.class[name]=item.original end
end
state.done=true;log('RESTORED')
end
end