diff --git a/Mirserver/Mir200/Envir/QuestDiary/config/ConstCfg.lua b/Mirserver/Mir200/Envir/QuestDiary/config/ConstCfg.lua index 74c307f6..56f51f35 100644 --- a/Mirserver/Mir200/Envir/QuestDiary/config/ConstCfg.lua +++ b/Mirserver/Mir200/Envir/QuestDiary/config/ConstCfg.lua @@ -463,6 +463,10 @@ ConstCfg = { num = 1, where = 13, }, + [16] = { + name = "超强金创药", + num = 999, + }, }, newhuman_level = 1, --新人的等级 newhuman_map = { "3", 330, 330 }, --新人的地图 diff --git a/Mirserver/Mir200/Envir/QuestDiary/娓告垙鍔熻兘/A0_閫氱敤绫/椤堕儴鍥炬爣.lua b/Mirserver/Mir200/Envir/QuestDiary/娓告垙鍔熻兘/A0_閫氱敤绫/椤堕儴鍥炬爣.lua new file mode 100644 index 00000000..af6b66aa --- /dev/null +++ b/Mirserver/Mir200/Envir/QuestDiary/娓告垙鍔熻兘/A0_閫氱敤绫/椤堕儴鍥炬爣.lua @@ -0,0 +1,103 @@ +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", + }, + { + 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", + }, +} + +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 diff --git a/client/dev/GUILayout/delay/CreateTopIconOBJ.lua b/client/dev/GUILayout/delay/CreateTopIconOBJ.lua index 706407b4..a1757845 100644 --- a/client/dev/GUILayout/delay/CreateTopIconOBJ.lua +++ b/client/dev/GUILayout/delay/CreateTopIconOBJ.lua @@ -17,67 +17,15 @@ CreateTopIconOBJ.PCpos = { [3] = -600, } -CreateTopIconOBJ.cfg = { - - [1] = { - icon = "a1", - wnd = ssrConstCfg.Box996, - name = "Box996", - }, -- 996鐩掑瓙 - [2] = { - icon = "a9", - wnd = ssrConstCfg.TradingBank, - name = "TradingBank", - }, -- 浜ゆ槗琛 - [3] = { - icon = "a2", - wnd = ssrConstCfg.StoreRecharge, - name = "StoreRecharge", - }, -- 鍏呭间腑蹇 - [4] = { - icon = "a4", - open = "KuangBaoOBJ_main", - name = "KuangBao", - }, -- 鐙傛毚涔嬪姏 - [5] = { - icon = "a3", - open = "FuLiDaTingOBJ_main", - name = "FuLi", - }, -- 绂忓埄涓績 - [6] = { - icon = "6", - open = "ShouChongOBJ_main", - name = "ShouChong", - }, -- 棣栧厖 - [7] = { - icon = "a6", - name = "Strategy", - client_open = "StrategyOBJ", - }, -- 娓告垙鏀荤暐 - [8] = { - icon = "a7", - name = "Service", - }, -- 鑱旂郴瀹㈡湇 - [9] = { - icon = "a10", - open = "XianShiChongBangOBJ_main", - name = "XianShiChongBang", - }, -- 闄愭椂鍐叉 - [10] = { - icon = "a5", - open = "HuodongzhongxinOBJ_main", - name = "HuoDong", - }, -- 娲诲姩涓績 - [11] = { - path = "res/custom/46/icon_top.png", - name = "YueKa", - open = "YueKaOBJ_main", - }, -- 鏈堝崱 +CreateTopIconOBJ.cfg = {} +CreateTopIconOBJ._redKeys = {} +CreateTopIconOBJ.wndMap = { + Box996 = ssrConstCfg.Box996, + TradingBank = ssrConstCfg.TradingBank, + StoreRecharge = ssrConstCfg.StoreRecharge, } - - function CreateTopIconOBJ:main() if MainMiniMap._ui then @@ -93,10 +41,15 @@ function CreateTopIconOBJ:main() GUI:setAnchorPoint(self.ui.Top_Node, 1.00, 0) GUI:setPosition(self.ui.Top_Node, self.posX, self.posY) + GUI:addOnClickEvent(self.ui.top_btn, function() + local Visible_bool = GUI:getVisible(self.ui.btn_switch) + self:setShowCopyBtn(not Visible_bool) + end) ---* 缁戝畾浜嬩欢 self:EventBind() self:createIcon() + ssrMessage:SubLink(self.__cname .. "_refresh") end end end @@ -104,9 +57,12 @@ end --* 鍒涘缓鍥炬爣 function CreateTopIconOBJ:createIcon() - if GUI:Win_IsNull(self.ui.btn_switch) then + if not self.ui or GUI:Win_IsNull(self.ui.btn_switch) then return end + + self:clearIcon() + for i, v in ipairs(self.cfg) do local icon = string.format("icon_%s", i) if v.icon then @@ -124,7 +80,10 @@ function CreateTopIconOBJ:createIcon() GUI:addOnClickEvent(self.ui[icon], function() if v.wnd then - ssrUIManager:OPEN(v.wnd, { redKey = redKey }) + local wnd = type(v.wnd) == "string" and self.wndMap[v.wnd] or v.wnd + if wnd then + ssrUIManager:OPEN(wnd, { redKey = redKey }) + end elseif v.open then Npc_dispatchex(nil, nil, nil, nil, SL:JsonEncode({ sync_obj = v.open, @@ -140,14 +99,18 @@ function CreateTopIconOBJ:createIcon() end) GUI:setOpacity(self.ui[icon], 0) + local iconNode = self.ui[icon] SL:ScheduleOnce(function() - self:Action(self.ui[icon]) + if iconNode and GUI:Win_IsNotNull(iconNode) then + self:Action(iconNode) + end end, 0.1) --娉ㄥ唽鍒板叏灞绾㈢偣绯荤粺锛氫綔涓鸿仛鍚堢偣锛岀敱瀛愭ā鍧 register(parent=redKey) 鍐冲畾浜伃 --鍋忕Щ鍙湪 cfg 涓氳繃 redOffset = { x = ?, y = ? } 鑷畾涔夛紱涓嶈鍒欏彇榛樿 {15,15} if RedDotMgr and RedDotMgr.register then local iconKey = icon + table.insert(self._redKeys, redKey) RedDotMgr:register(redKey, { target = function() return CreateTopIconOBJ.ui and CreateTopIconOBJ.ui[iconKey] @@ -173,11 +136,31 @@ function CreateTopIconOBJ:createIcon() local btn_pos = GUI:getContentSize(self.ui.top_btn) GUI:setPosition(self.ui.btn_switch, btn_pos.width - 40, btn_pos.height + 30) +end - GUI:addOnClickEvent(self.ui.top_btn, function() - local Visible_bool = GUI:getVisible(self.ui.btn_switch) - self:setShowCopyBtn(not Visible_bool) - end) +function CreateTopIconOBJ:clearIcon() + if RedDotMgr and RedDotMgr.unregister then + for _, redKey in ipairs(self._redKeys or {}) do + RedDotMgr:unregister(redKey) + end + end + + self._redKeys = {} + + if self.ui and GUI:Win_IsNotNull(self.ui.btn_switch) then + GUI:removeAllChildren(self.ui.btn_switch) + end +end + +function CreateTopIconOBJ:refresh(arg1, arg2, arg3, data) + self.cfg = data or {} + + if self.ui and GUI:Win_IsNotNull(self.ui.btn_switch) then + self:createIcon() + if RedDotMgr and RedDotMgr.refreshAll then + RedDotMgr:refreshAll() + end + end end -- 璁剧疆椤堕儴鍔熻兘鎸夐挳鐨勬樉绀虹姸鎬 diff --git a/client/dev/GUILayout/delay/TaskShowOBJ.lua b/client/dev/GUILayout/delay/TaskShowOBJ.lua index a98ce79a..e598701c 100644 --- a/client/dev/GUILayout/delay/TaskShowOBJ.lua +++ b/client/dev/GUILayout/delay/TaskShowOBJ.lua @@ -15,7 +15,7 @@ TaskShowOBJ.UIfile = getUifile() TaskShowOBJ.mainLineData = nil local function canRouteMainLine(data) - return data and tonumber(data.status or 0) == 0 and not data.finish + return data ~= nil and tonumber(data.status or 0) == 0 and not data.finish end local function getShortDesc(data) diff --git a/client/dev/GUILayout/ssrgame/net/Message.lua b/client/dev/GUILayout/ssrgame/net/Message.lua index 988a9124..47d75869 100644 --- a/client/dev/GUILayout/ssrgame/net/Message.lua +++ b/client/dev/GUILayout/ssrgame/net/Message.lua @@ -31,7 +31,7 @@ SL:ScheduleOnce(function() for i, v in ipairs(SL:GetFilesByPath("GUILayout/delay") or {}) do local game_file = string.format("GUILayout/delay/%s", v) local file_name = SL:Split(game_file, ".")[1] - local obj_name = SL:Split(game_file, "/")[3] + local obj_name = SL:Split(v, ".")[1] dispatch_handler[obj_name] = SL:Require(file_name, true) local target = dispatch_handler[obj_name] if target and target["main"] then