---@class KLShapeShiftCardShopItem:UIKmlLuaPanelBase ---@field view KLShapeShiftCardShopItemView local KLShapeShiftCardShopItem = class(UIKmlLuaPanelBase) local this = KLShapeShiftCardShopItem ---创建时调用一次 function this:Init() end ---注册UI事件和服务器消息 function this:RegistEvents() GUI:AddOnClickEvent(self.view.img_item_click, self, self.ItemOnClick) end ---界面显示时调用一次 function this:Show() end ---创建或者刷新界面数据时调用 function this:Refresh() end ---@param data cfg_card_shop_column function this:RefreshUI(data) self.noBuy = false local redPointShow = false if data.condition == 0 then GUI:setVisible(self.view.item_tips, false) else if data.condition > SL:GetMetaValue(EMetaVarGetKey.LEVEL) then GUI:setVisible(self.view.item_tips, true) GUI:Text_setString(self.view.item_tips, "角色Lv." .. data.condition .. "后开启") self.noBuy = true else GUI:setVisible(self.view.item_tips, false) redPointShow = true end end self.consumeId = data.exchangeConsume[1] self.consumeCost = data.exchangeConsume[2] if SL:GetBagItemCount(self.consumeId) < self.consumeCost then GUI:Text_setString(self.view.text_cost, "" .. self.consumeCost .. "") if redPointShow then redPointShow = false end else GUI:Text_setString(self.view.text_cost, "" .. self.consumeCost .. "") end ---@type cfg_item_column local item_tbl = SL:GetConfig("cfg_item", data.exchangeAdd[1]) GUI:Text_setString(self.view.text_name, item_tbl.name) GUI:Text_setTextColor(self.view.text_name, tostring(item_tbl.color)) GUI:Item_setItemId(self.view.item_cost, self.consumeId) GUI:Item_setItemId(self.view.item_is, data.exchangeAdd[1]) GUI:setVisible(self.view.item_equip_redPoint, redPointShow) self.itemData = data end function this:ItemOnClick() if self.noBuy then SL:TipMessage(SL:GetConfig('cfg_string', 449).text, 1, NoticeType.NoticeMid)--"等级不足", return end GUI:UIPanel_Open("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardBuy/KLShapeShiftCardBuyPanel", nil, nil, self.itemData, true) end function this:Close() end return this