---@class KLMountDisplayPanel:UIKmlLuaPanelBase ---@field view KLMountDisplayPanelView local KLMountDisplayPanel = class(UIKmlLuaPanelBase) local this =KLMountDisplayPanel ---创建时调用一次 function this:Init() self.attTxtList = {} self.mountAtt_all_item = {} end ---创建或者刷新界面数据时调用 function this:Refresh() SL.HideMainPanel() SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_MOUNT_DETAIL_INFO,{self.args.mountId}) GUI:setVisible(self.view.ownerMountRoot,self.args.mountId~=-1) if self.args.mountId ~= -1 then ---@type cfg_mount_column local tbl = SL:GetConfig("cfg_mount",self.args.mountId,"id") ---@type cfg_mount_model_column local mount_model_tbl = SL:GetConfig("cfg_mount_model",tbl.mountId,"id") ---@type cfg_mount_behaviour_column local behaviour_tbl = SL:GetConfigMultiKeys("cfg_mount_behaviour",tbl.motion,1,"id","state") GUI:HideAllChilds(self.view.model) self.cur_mount_model = GUI:Model_Create(self.view.model,{ id="cur_mount_model", mscale=tbl.scale2.. ",".. tbl.scale2 ..",".. tbl.scale2, mrotate="0,200,0", x="0", y="-120", z="-1000", a="00", src=mount_model_tbl.path, ani=behaviour_tbl.name, }) GUI:setVisible(self.view.cancelRideBtn,self.args.isWear) GUI:setVisible(self.view.rideBtn,not self.args.isWear) GUI:setVisible(self.view.rideTip,self.args.isWear or self.args.auto) GUI:setVisible(self.view.tapToggleGroup,tbl.mountEquip == 1) if tbl.mountEquip == 1 then GUI:SetIsOnWithoutNotify(self.view.mountInfoToggle,true) GUI:SetIsOnWithoutNotify(self.view.mountEquipToggle,false) end GUI:SetIsOnWithoutNotify(self.view.isRankShowMount,InfoManager.mountInfo.isRankShowMount) else GUI:setVisible(self.view.skillContainer,false) end end ---注册UI事件和服务器消息 function this:RegistEvents() GUI:AddOnClickEvent(self.view.closeBtn,self,self.OnClickCloseBtn) GUI:AddOnClickEvent(self.view.desBtn,self,self.OnClickDesBtn) GUI:AddOnClickEvent(self.view.cancelRideBtn,self,self.OnClickCancelRideBtn) GUI:AddOnClickEvent(self.view.rideBtn,self,self.OnClickRideBtn) GUI:SetToggleOnValueChange(self.view.isRankShowMount,self,self.OnValueChangeIsRankShowMount) GUI:SetToggleOnValueChange(self.view.mountInfoToggle,self,self.OnValueChangeMountInfoToggle) GUI:SetToggleOnValueChange(self.view.mountEquipToggle,self,self.OnValueChangeMountEquipToggle) SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_RIDING_MOUNT,self.RES_RIDING_MOUNT,self) SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_CANCEL_RIDING_MOUNT,self.RES_CANCEL_RIDING_MOUNT,self) SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_MOUNT_DETAIL_INFO,self.RES_MOUNT_DETAIL_INFO,self) end function this:OnClickCloseBtn() GUI:UIPanel_Close("dev/outui/Mount/Panel/KLMountEquip/KLMountEquipPanel") GUI:UIPanel_Close("dev/outui/Mount/Panel/KLMountStore/KLMountStorePanel") GUI:UIPanel_Close("dev/outui/Mount/Panel/KLMountDisplay/KLMountDisplayPanel") end function this:OnClickDesBtn() GUI:UIPanel_Open("dev/outui/Mount/Panel/KLMountDes/KLMountDesPanel") end function this:OnClickCancelRideBtn() GUI:setVisible(self.view.cancelRideBtn,false) GUI:setVisible(self.view.rideBtn,true) SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_CANCEL_RIDING_MOUNT,{self.args.mountId}) end function this:OnClickRideBtn() SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_RIDING_MOUNT,{self.args.mountId}) end function this:OnValueChangeMountInfoToggle(_,_,data) end function this:OnValueChangeIsRankShowMount(_,_,data) local isToggle = data[1] SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_SET_MOUNT_RANK,isToggle and self.args.mountId or 0) end function this:OnValueChangeMountEquipToggle(_,_,data) local isToggle = data[1] if isToggle then self:SetVisible(false) ---@type KLMountStorePanel local panel = GUI:GetUI("dev/outui/Mount/Panel/KLMountStore/KLMountStorePanel") if panel then panel:Refresh() end local data = {mountId = self.args.mountId} ---@type KLMountStorePanel panel = GUI:GetUI("dev/outui/Mount/Panel/KLMountEquip/KLMountEquipPanel") if panel then panel.args = data panel:SetVisible(true) panel:Refresh() else GUI:UIPanel_Open("dev/outui/Mount/Panel/KLMountEquip/KLMountEquipPanel",nil,nil,data) end end end function this:RES_RIDING_MOUNT(id,message) GUI:setVisible(self.view.cancelRideBtn,true) GUI:setVisible(self.view.rideBtn,false) GUI:setVisible(self.view.rideTip,true) end function this:RES_CANCEL_RIDING_MOUNT(id,message) GUI:setVisible(self.view.cancelRideBtn,false) GUI:setVisible(self.view.rideBtn,true) GUI:setVisible(self.view.rideTip,false) end function this:RES_MOUNT_DETAIL_INFO(id,message) self:RefreshAttInfoList(message.att) end function this:RefreshAttInfoList(attribute) if self.args.mountId == -1 then return end local attInfo = {} self.attTxtList = {} for i, v in pairs(attribute) do local isSkip = false local attId = tonumber(i) local attNum = v ---@type cfg_att_info_column local tbl = SL:GetConfig("cfg_att_info",attId,"id") local attTxt if tbl.remarks ~= EAttrRemarkType.Number then attTxt = attNum/100 .."%" else attTxt = attNum end if attId == 200011 then--最小 attInfo[1] = "攻击力#"..attTxt.."~" elseif attId == 200021 then--最大 attInfo[2] = attTxt elseif attId == 202021 then--最小 attInfo[3] = "魔法攻击力#"..attTxt.."~" elseif attId == 202011 then--最大 attInfo[4] = attTxt elseif attId == 205011 then--最小 attInfo[5] = "诅咒攻击力#"..attTxt.."~" elseif attId == 205021 then--最大 attInfo[6] = attTxt else attTxt = tbl.name.."#" ..attTxt table.insert(self.attTxtList,attTxt) isSkip = true end if not isSkip then if attInfo[1] and attInfo[2] then table.insert(self.attTxtList,attInfo[1]..attInfo[2]) attInfo[1] = nil attInfo[2] = nil elseif attInfo[3] and attInfo[4] then table.insert(self.attTxtList,attInfo[3]..attInfo[4]) attInfo[3] = nil attInfo[4] = nil elseif attInfo[5] and attInfo[6] then table.insert(self.attTxtList,attInfo[5]..attInfo[6]) attInfo[5] = nil attInfo[6] = nil end end end ---@type cfg_mount_column local tbl = SL:GetConfig("cfg_mount",self.args.mountId,"id") local height = #self.attTxtList * 38 + 35 if tbl.mountEquip ~= 1 and tbl.skillID~=0 then height = #self.attTxtList * 38 + 185 + 35 end GUI:setContentSize(self.view.mountDesList,385,height) for i = 1, #self.mountAtt_all_item do GUI:UIPanel_Close("",self.mountAtt_all_item[i]) end for i = 1, #self.attTxtList do local item = GUI:UIPanel_Open("dev/outui/Mount/Item/KLMountAttInfo/KLMountAttInfoItem",self.view.mount_att_info_list,self,{width=385,attInfo=self.attTxtList[i]},true) self.mountAtt_all_item[i] = item end GUI:setPositionY(self.view.skillContainer,0) self:ShowSkillInfo(tbl.skillID,tbl.skillLevel,tbl.mountEquip) end function this:ShowSkillInfo(skillId,level,mountEquip) GUI:setVisible(self.view.skillContainer,mountEquip ~= 1 and skillId~=0) if skillId ~= 0 then ---@type cfg_skill_info_column local tbl = SL:GetConfigMultiKeys("cfg_skill_info",skillId,level,"skillID","skillLevel") GUI:Image_loadTexture(self.view.skillIcon,tbl.icon,"Atlas/Skill_icon.spriteatlas") GUI:Text_setString(self.view.skillName,tbl.name.." Lv."..level) GUI:Text_setString(self.view.skillDes,tbl.tips) end end function this:SetVisible(isVisible) GUI:setVisible(self.view.root,isVisible) end function this:GetVisible() return GUI:getVisible(self.view.root) end function this:Close() SL.ShowMainPanel() end return this