Files
StellaSora_DataLua/lua/gamecore/ui/uiobjs.lua
T
SL1900 8c4bd41668 Update - 1.13.0.124
EN: 1.13.0.124
CN: 1.13.0.124
JP: 1.13.0.128
KR: 1.13.0.130
2026-07-21 12:30:00 +09:00

41 lines
876 B
Lua

local UIObjs = class("UIObjs")
local _instanceIndex = function(t, name)
local v = rawget(UIObjs, name)
if v ~= nil then
return v
end
if name == "_keys" then
local _keys = string.split(t._CSUIObjs.Keys, ",")
rawset(t, "_keys", _keys)
return _keys
end
local maps = t._objMaps
local cached = maps[name]
if cached ~= nil then
return cached
end
local obj = t._CSUIObjs:Get(name)
if obj == nil then
return nil
end
maps[name] = obj
local type_name = obj:GetType().Name
t._objTypeMaps[name] = type_name
return obj, type_name
end
function UIObjs:ctor(CSUIObjs, ctrl)
self._CSUIObjs = CSUIObjs
self._objMaps = {}
self._objTypeMaps = {}
self._ctrl = ctrl
setmetatable(self, {__index = _instanceIndex})
end
function UIObjs:Get(name)
local obj = self[name]
if obj == nil then
return nil, nil
end
return obj, self._objTypeMaps[name]
end
return UIObjs