|
FirstRechargeItem = FirstRechargeItem or BaseClass(BaseItem)
|
|
|
|
function FirstRechargeItem:__init()
|
|
self.base_file = "rechargeActivity"
|
|
self.layout_file = "FirstRechargeItem"
|
|
self.is_delay_callback = true
|
|
self.model = RechargeActivityModel:getInstance()
|
|
--self.use_local_view = true
|
|
self:Load()
|
|
end
|
|
|
|
function FirstRechargeItem:Load_callback()
|
|
|
|
self.txtTitle = self:GetChild("name/txtTitle"):GetComponent("Text")
|
|
self.icon = self:GetChild("icon"):GetComponent("Image")
|
|
self.clickBg = self:GetChild("clickbg").gameObject
|
|
self.bg = self:GetChild("bg"):GetComponent("Image")
|
|
|
|
if self.need_refreshData then
|
|
self:SetData(self.index,self.data)
|
|
end
|
|
|
|
self:InitEvent()
|
|
end
|
|
|
|
|
|
|
|
function FirstRechargeItem:InitEvent()
|
|
|
|
-- local function onBtnClickHandler(target)
|
|
-- if target == self.clickBg then
|
|
-- if self.goods_basic then
|
|
-- self:ClickCallFun()
|
|
-- end
|
|
-- end
|
|
-- end
|
|
|
|
-- AddClickEvent(self.clickBg, onBtnClickHandler)
|
|
|
|
|
|
end
|
|
|
|
function FirstRechargeItem:SetData(index,data)
|
|
self.data = data
|
|
self.index = index
|
|
if not self.is_loaded then
|
|
self.need_refreshData = true
|
|
return
|
|
end
|
|
|
|
if self.data[1] and self.data[2] and self.data[3] then
|
|
self.goods_Id, _ = GoodsModel:getInstance():GetMappingTypeId(self.data[1], self.data[2])
|
|
self.goods_basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(self.goods_Id)
|
|
if self.goods_basic then
|
|
lua_resM:setImageSprite(self,self.bg,"rechargeActivity_asset","scyu_pz_"..(self.goods_basic.color+1))
|
|
local goods_icon
|
|
if Config.ConfigGoodsByCareer[tonumber(self.goods_Id)] then
|
|
goods_icon = Config.ConfigGoodsByCareer[tonumber(self.goods_Id)][RoleManager.Instance.mainRoleInfo.career]
|
|
else
|
|
goods_icon = self.goods_basic.goods_icon
|
|
end
|
|
|
|
lua_resM:setOutsideImageSprite(self,self.icon,GameResPath.GetGoodsIcon(goods_icon))
|
|
self.txtTitle.text = "<color='"..WordManager.GetGoodsColor(self.goods_basic.color).."'>" .. Trim(self.goods_basic.goods_name) .."x"..self.data[3].. "</color>"
|
|
|
|
if index > 3 then
|
|
self:SetPosition((index - 1) % 3 * 133-65, -111 * math.floor((index - 1) / 3))
|
|
else
|
|
self:SetPosition((index - 1) % 3 * 133, -111 * math.floor((index - 1) / 3))
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function FirstRechargeItem:__delete()
|
|
|
|
end
|
|
|
|
--点击函数,可在子类继承该方法,实现自己需要的效果
|
|
function FirstRechargeItem:ClickCallFun(x,y)
|
|
if self.goods_basic then
|
|
if self.goods_basic.type == GoodsModel.TYPE.EQUIP then --装备鉴定物
|
|
if self.dynamic then --拼接推荐属性
|
|
UIToolTipMgr:getInstance():AppendEquipShowTips(self.dynamic, x, y, self.show_type)
|
|
else
|
|
UIToolTipMgr:getInstance():AppendEquipTips(self.goods_basic.type_id, x, y)
|
|
end
|
|
elseif self.goods_basic.type == 39 then --幻兽装备
|
|
if self.dynamic then --拼接推荐属性
|
|
UIToolTipMgr:getInstance():AppendBeastShowTips(self.dynamic, x, y, self.show_type)
|
|
else
|
|
UIToolTipMgr:getInstance():AppendBeastTips(self.goods_basic.type_id, x, y)
|
|
end
|
|
elseif self.goods_basic.type == 13 then --圣印装备
|
|
if self.dynamic then --拼接推荐属性
|
|
UIToolTipMgr:getInstance():AppendSealShowTips(self.dynamic, x, y, self.show_type)
|
|
else
|
|
UIToolTipMgr:getInstance():AppendSealTips(self.goods_basic.type_id, x, y)
|
|
end
|
|
elseif self.goods_basic.type == 21 and self.goods_basic.subtype == 1 then --星痕装备
|
|
UIToolTipMgr:getInstance():AppendStarShadowTips(self.goods_basic.type_id,self.goods_basic, x, y, true,true)
|
|
elseif self.goods_basic.type == 16 and self.goods_basic.subtype == 4 then
|
|
UIToolTipMgr:getInstance():AppendHorseEquipInfoTips(self.type_id, x, y, nil, HorseEquipInfoTips.UNKNOWN, nil, nil)
|
|
elseif self.goods_basic.type == 52 and self.goods_basic.subtype ~= 4 and self.goods_basic.subtype ~= 5 then --魂珠类型
|
|
SoulBeadModel:getInstance():Fire(SoulBeadModel.EventName.OPEN_SOUL_BEAD_TIPS, self.type_id, x, y)
|
|
else --普通物品
|
|
UIToolTipMgr:getInstance():AppendGoodsTips(self.goods_basic.type_id, x, y)
|
|
end
|
|
end
|
|
end
|