---@class KLShapeShiftCardMainPanel:UIKmlLuaPanelBase ---@field view KLShapeShiftCardMainPanelView local KLShapeShiftCardMainPanel = class(UIKmlLuaPanelBase) local this =KLShapeShiftCardMainPanel function this:AsyncLoadUI() end ---创建时调用一次 function this:Init() SL.HideMainPanel() --GUI:UIPanel_Open("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardMain/KLShapeShiftCardMainPanel") end ---注册UI事件和服务器消息 function this:RegistEvents() GUI:AddOnClickEvent(self.view.btn_close,self,self.BtnCloseClick) GUI:SetToggleOnValueChange(self.view.toggle_inlay,self,self.ToggleInlayChange) GUI:SetToggleOnValueChange(self.view.toggle_house,self,self.ToggleHouseChange) GUI:SetToggleOnValueChange(self.view.toggle_synthesis,self,self.ToggleSynthesisChange) GUI:SetToggleOnValueChange(self.view.toggle_shop,self,self.ToggleShopChange) GUI:SetToggleOnValueChange(self.view.toggle_break,self,self.ToggleBreakChange) end function this:ToggleInlayChange(_,_,value) if value[1] then GUI:UIPanel_Open("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardInlay/KLShapeShiftCardInlayPanel") GUI:Image_loadTexture(self.view.img_bg, "Texture/bg_interface_window_2.png") self:OnClickBlock() else GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardInlay/KLShapeShiftCardInlayPanel") end end function this:ToggleHouseChange(_,_,value) if value[1] then GUI:UIPanel_Open("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardHouse/KLShapeShiftCardHousePanel") GUI:Image_loadTexture(self.view.img_bg, "Texture/bg_interface_window_2.png") self:OnClickBlock() else GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardHouse/KLShapeShiftCardHousePanel") end end function this:ToggleSynthesisChange(_,_,value) if value[1] then GUI:UIPanel_Open("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardSynthesis/KLShapeShiftCardSynthesisPanel") GUI:Image_loadTexture(self.view.img_bg, "Texture/bg_interface_window_2.png") self:OnClickBlock() else GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardSynthesis/KLShapeShiftCardSynthesisPanel") end end function this:ToggleShopChange(_,_,value) if value[1] then GUI:UIPanel_Open("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardShop/KLShapeShiftCardShopPanel") GUI:Image_loadTexture(self.view.img_bg, "Texture/bg_interface_window_3.png") self:OnClickBlock() else GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardShop/KLShapeShiftCardShopPanel") end end function this:ToggleBreakChange(_,_,value) if value[1] then GUI:UIPanel_Open("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardBreak/KLShapeShiftCardBreakPanel") GUI:Image_loadTexture(self.view.img_bg, "Texture/bg_interface_window_2.png") self:OnClickBlock() else GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardBreak/KLShapeShiftCardBreakPanel") end end function this:OnClickBlock() GUI:setVisible(self.view.img_block, true) if self.timer then SL:UnSchedule(self.timer) end self.timer = SL:ScheduleOnce(0.5, function() GUI:setVisible(self.view.img_block, false) end) end function this:BtnCloseClick() GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardMain/KLShapeShiftCardMainPanel") end ---界面显示时调用一次 function this:Show() end ---创建或者刷新界面数据时调用 function this:Refresh() if self.args then local index if type(self.args) == "table" then index = tonumber(self.args[1]) else index = tonumber(self.args) end if index == 2 then GUI:Toggle_setIsOn(self.view.toggle_house, true) elseif index == 3 then GUI:Toggle_setIsOn(self.view.toggle_synthesis, true) elseif index == 4 then GUI:Toggle_setIsOn(self.view.toggle_shop, true) elseif index == 5 then GUI:Toggle_setIsOn(self.view.toggle_break, true) end else GUI:Toggle_setIsOn(self.view.toggle_inlay, true) end self:RefreshMainRedPoint() end function this:RefreshMainRedPoint() local redPoint_shop = InfoManager.shapeShiftCardInfo:RefreshCardShopRedPointInfo() local redPoint_inlay = InfoManager.shapeShiftCardInfo:RefreshCardInlayRedPointInfo() local redPoint_house = InfoManager.shapeShiftCardInfo:RefreshCardHouseRedPointInfo() local redPoint_synthesis = InfoManager.shapeShiftCardInfo:RefreshCardSynthesisRedPointInfo() local redPoint_break = InfoManager.shapeShiftCardInfo:RefreshCardBreakRedPointInfo() GUI:setVisible(self.view.item_equip_redPoint_shop, redPoint_shop) GUI:setVisible(self.view.item_equip_redPoint_inlay, redPoint_inlay) GUI:setVisible(self.view.item_equip_redPoint_house, redPoint_house) GUI:setVisible(self.view.item_equip_redPoint_synthesis, redPoint_synthesis) GUI:setVisible(self.view.item_equip_redPoint_break, redPoint_break) end function this:Close() if self.timer then SL:UnSchedule(self.timer) self.timer = nil end SL.ShowMainPanel() GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardInlay/KLShapeShiftCardInlayPanel") GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardShop/KLShapeShiftCardShopPanel") GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardSynthesis/KLShapeShiftCardSynthesisPanel") GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardHouse/KLShapeShiftCardHousePanel") GUI:UIPanel_Close("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardBreak/KLShapeShiftCardBreakPanel") SL:RefreshPanelALLRedStateKmlByCondition("checkShapeShiftCardRedDot") end return this