52 lines
2.2 KiB
Lua
52 lines
2.2 KiB
Lua
-- Temporary observation of timers created by the named CW page. No timer or
|
|||
|
|
-- UI values are changed. Restore the original method after two minutes.
|
||
|
|
do
|
||
|
|
local function log(v)CS.UnityEngine.Debug.Log('[GAC_CW_TIMER_TRACE] '..tostring(v))end
|
||
|
|
local state=_G.__gacCwTimerTrace1
|
||
|
|
if not state then
|
||
|
|
local class=package.loaded['Ui.GridFight.Entrance.S2.GridFightS2EntrancePage']
|
||
|
|
if type(class)=='table' and type(class._refresh_remain_timer)=='function' then
|
||
|
|
state={class=class,original=class._refresh_remain_timer,deadline=CS.UnityEngine.Time.realtimeSinceStartup+120}
|
||
|
|
_G.__gacCwTimerTrace1=state
|
||
|
|
local function pack(...)return {n=select('#',...),...}end
|
||
|
|
state.wrapped=function(self,...)
|
||
|
|
local results=pack(state.original(self,...))
|
||
|
|
local ok,err=pcall(function()
|
||
|
|
local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60)
|
||
|
|
local timers=CS.UnityEngine.Resources.FindObjectsOfTypeAll(typeof(CS.RPG.Client.MonoRemainTimer))
|
||
|
|
log('COUNT '..timers.Length)
|
||
|
|
for i=0,math.min(timers.Length-1,63)do
|
||
|
|
local timer=timers[i]
|
||
|
|
local transform=timer.transform
|
||
|
|
local path=tostring(transform.name)
|
||
|
|
for j=1,12 do
|
||
|
|
transform=transform.parent
|
||
|
|
if not transform then break end
|
||
|
|
path=tostring(transform.name)..'/'..path
|
||
|
|
end
|
||
|
|
if path:lower():find('gridfight') then
|
||
|
|
log('PATH '..path)
|
||
|
|
local target=timer:GetType():GetField('_targetTime',flags):GetValue(timer)
|
||
|
|
local fields=target:GetType():GetFields(flags)
|
||
|
|
for j=0,math.min(fields.Length-1,31)do
|
||
|
|
local f=fields[j]
|
||
|
|
if not f.IsStatic then
|
||
|
|
local v=f:GetValue(target)
|
||
|
|
local good,text=pcall(function()return tostring(v)end)
|
||
|
|
if good then log('TARGET '..tostring(f)..' '..text)end
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end)
|
||
|
|
if not ok then log('ERROR '..tostring(err))end
|
||
|
|
return (table.unpack or unpack)(results,1,results.n)
|
||
|
|
end
|
||
|
|
class._refresh_remain_timer=state.wrapped
|
||
|
|
log('READY')
|
||
|
|
end
|
||
|
|
elseif not state.done and (state.stop or CS.UnityEngine.Time.realtimeSinceStartup>=state.deadline)then
|
||
|
|
if state.class._refresh_remain_timer==state.wrapped then state.class._refresh_remain_timer=state.original end
|
||
|
|
state.done=true;log('RESTORED')
|
||
|
|
end
|
||
|
|
end
|