108 lines
2.2 KiB
Lua
108 lines
2.2 KiB
Lua
CreateTopIconOBJ = {}
|
|
|
|
CreateTopIconOBJ._name = "CreateTopIconOBJ"
|
|
CreateTopIconOBJ.allowFunc = { "refresh" }
|
|
|
|
CreateTopIconOBJ.cfg = {
|
|
{
|
|
icon = "a1",
|
|
wnd = "Box996",
|
|
name = "Box996",
|
|
},
|
|
{
|
|
icon = "a9",
|
|
wnd = "TradingBank",
|
|
name = "TradingBank",
|
|
},
|
|
{
|
|
icon = "a2",
|
|
wnd = "StoreRecharge",
|
|
name = "StoreRecharge",
|
|
},
|
|
{
|
|
icon = "a3",
|
|
open = "FuLiDaTingOBJ_main",
|
|
name = "FuLi",
|
|
},
|
|
{
|
|
icon = "6",
|
|
open = "ShouChongOBJ_main",
|
|
name = "ShouChong",
|
|
},
|
|
{
|
|
icon = "a6",
|
|
name = "Strategy",
|
|
client_open = "StrategyOBJ",
|
|
},
|
|
{
|
|
icon = "a7",
|
|
name = "Service",
|
|
client_open = "ServiceOBJ",
|
|
},
|
|
{
|
|
icon = "a10",
|
|
open = "XianShiChongBangOBJ_main",
|
|
name = "XianShiChongBang",
|
|
},
|
|
{
|
|
icon = "a5",
|
|
open = "HuodongzhongxinOBJ_main",
|
|
name = "HuoDong",
|
|
},
|
|
{
|
|
path = "res/custom/46/icon_top.png",
|
|
name = "YueKa",
|
|
open = "YueKaOBJ_main",
|
|
},
|
|
-- {
|
|
-- name = "AutoXunHang",
|
|
-- client_open = "AutoXunHangOBJ",
|
|
-- },
|
|
}
|
|
|
|
function CreateTopIconOBJ:checkShow(actor, cfg)
|
|
if cfg.show == false then
|
|
return false
|
|
end
|
|
|
|
local check = cfg.check or cfg.checkcontion
|
|
if not check then
|
|
return true
|
|
end
|
|
|
|
return Func.checkcontion(actor, check, false, false)
|
|
end
|
|
|
|
|
|
function CreateTopIconOBJ:getCfg(actor)
|
|
local list = {}
|
|
|
|
for _, cfg in ipairs(self.cfg or {}) do
|
|
if self:checkShow(actor, cfg) then
|
|
local viewCfg = table.Copy(cfg)
|
|
viewCfg.show = nil
|
|
viewCfg.check = nil
|
|
viewCfg.checkcontion = nil
|
|
table.insert(list, viewCfg)
|
|
end
|
|
end
|
|
|
|
return list
|
|
end
|
|
|
|
function CreateTopIconOBJ:refresh(actor)
|
|
if not isnotnull(actor) then
|
|
return
|
|
end
|
|
|
|
Message:SubLink(actor, self._name .. "_refresh", self:getCfg(actor))
|
|
end
|
|
|
|
local function refreshTopIcon(actor)
|
|
CreateTopIconOBJ:refresh(actor)
|
|
end
|
|
|
|
GameEvent.add(EventCfg.onLoginEnd, refreshTopIcon, CreateTopIconOBJ)
|
|
GameEvent.add(EventCfg.onqfloadend, refreshTopIcon, CreateTopIconOBJ)
|
|
|
|
return CreateTopIconOBJ
|