24 lines
1.5 KiB
Python
24 lines
1.5 KiB
Python
"""Prepare a bounded, read-only presence query for captured event paths."""
|
|||
|
|
import json
|
||
|
|
from pathlib import Path
|
||
|
|
root=Path(__file__).resolve().parents[1]
|
||
|
|
c=json.loads((root/'resources/PreviewGameplayCatalog.json').read_text(encoding='utf-8-sig'))
|
||
|
|
paths=sorted({p[k] for p in c['tables']['panels'] for k in ('UIPrefab','TabIcon') if p.get(k)})
|
||
|
|
source='''-- Asset manifest presence only, eight captured paths per heartbeat; no loading.
|
||
|
|
do local function capture()
|
||
|
|
local s=_G.__gacEventAssets1 or {index=1};_G.__gacEventAssets1=s
|
||
|
|
local paths=PATHS
|
||
|
|
if s.index>#paths 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
|
||
|
|
for n=1,8 do
|
||
|
|
if s.index>#paths then CS.UnityEngine.Debug.Log('[GAC_EVENT_ASSET] END');return end
|
||
|
|
local path=paths[s.index];s.index=s.index+1
|
||
|
|
CS.UnityEngine.Debug.Log('[GAC_EVENT_ASSET] '..tostring(CS.RPG.Client.GlobalVars.s_AssetMgr:Exists(path))..' '..path)
|
||
|
|
end
|
||
|
|
end;local ok,e=pcall(capture);if not ok then _G.__gacEventAssets1={index=99999};CS.UnityEngine.Debug.Log('[GAC_EVENT_ASSET] ERROR '..tostring(e))end end
|
||
|
|
'''.replace('PATHS','{'+','.join(json.dumps(p)for p in paths)+'}')
|
||
|
|
(root/'tools/event_asset_presence.lua').write_text(source,encoding='utf-8')
|
||
|
|
print('Captured paths:',len(paths))
|