123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- ---@class KLMapBranchItem:UIKmlLuaPanelBase
- ---@field view KLMapBranchItemView
- local KLMapBranchItem = class(UIKmlLuaPanelBase)
- local this = KLMapBranchItem
- ---创建时调用一次
- function this:Init()
- end
- ---创建或者刷新界面数据时调用
- function this:Refresh()
-
- end
- function this:RefreshUI(line, count, limit, isGold,pkLine)
- GUI:setVisible(self.view.root,true)
- self.mapLine = tonumber(line[2])
- self.isGoldMap = isGold
- GUI:Text_setString(self.view.line_name, line[1])
- GUI:SetLoadingbar_startper(self.view.line_state,count/limit*100)
-
- if self.mapLine == SL:GetMetaValue(EMetaVarGetKey.MAP_LINE) and ((not isGold and not self:CurrentIsInGoldMap()) or (isGold and self:CurrentIsInGoldMap())) then
- GUI:Toggle_setIsOn(self.view.branch_toggle, true)
- GUI:setVisible(self.view.btn_switch, true)
- else
- GUI:setVisible(self.view.btn_switch, false)
- GUI:Toggle_setIsOn(self.view.branch_toggle, false)
- end
- pkLine = string.split(pkLine,"|")
- if table.contains(pkLine,line[2]) then
- GUI:Toggle_setSrc(self.view.branch_toggle,nil,"Texture/branchMap_new_button_3.png","Texture/branchMap_new_button_2.png")
- GUI:setVisible(self.view.img_pk,true)
- else
- GUI:setVisible(self.view.img_pk,false)
- GUI:Toggle_setSrc(self.view.branch_toggle,nil,"Texture/branchMap_new_button_1.png","Texture/branchMap_new_button_2.png")
- end
- end
- function this:SetOnValueChange(func, ui)
- GUI:SetToggleOnValueChange(self.view.branch_toggle, ui, function(_,_,eventData,value)
- func(ui,_,eventData)
- if value[1] then
- GUI:setVisible(self.view.btn_switch, true)
- else
- GUI:setVisible(self.view.btn_switch, false)
- end
- end, { data = self.mapLine })
- end
- ---注册UI事件和服务器消息
- function this:RegistEvents()
- GUI:AddOnClickEvent(self.view.btn_switch,self,self.SwitchBranchClick)
- end
- function this:SwitchBranchClick()
- if self.isGoldMap and InfoManager.newVipInfo.vipLevel <= 0 then
- SL:CommonTipsMessage({ stringTblID=228, ui = self, sureBtnText = "确定", cancelBtnText = "取消",
- callback = function()
- SL.HideMainPanel()
- GUI:UIPanel_Open("dev/outui/VIP/Panel/KLNewVIPMain/KLNewVIPMainPanel")
- GUI:UIPanel_Close("dev/ui/Map/Panel/KLUIMapBranch/KLUIMapBranchPanel")
- end })
- return
- end
- ---@type KLUIMapBranchPanel
- local panel = GUI:GetUI("dev/ui/Map/Panel/KLUIMapBranch/KLUIMapBranchPanel")
- panel:SwitchBranchClick(self.isGoldMap)
- end
- function this:CurrentIsInGoldMap()
- ---@type cfg_map_info_column
- local infoCfg = SL:GetConfig("cfg_map_info",tonumber(SL:GetMetaValue(EMetaVarGetKey.MAP_ID)))
- return infoCfg.goldmap == 1
- end
- function this:Close()
- end
- function this:HideItemUI()
- GUI:setVisible(self.view.root,false)
- end
- return this
|