|
|
- EquipShowItem = EquipShowItem or BaseClass(AwardItem)
- function EquipShowItem:__init()
- self.model = ChatModel:getInstance()
- end
-
- function EquipShowItem:Load_callback()
- AwardItem.Load_callback(self)
- if self.need_refreData then
- self:SetData(self.vo)
- end
- end
-
- function EquipShowItem:__delete()
-
- end
-
- function EquipShowItem:SetData(vo)
- self.vo = vo
- if self.is_loaded then
- self.need_refreData = false
- local stren_data = EquipModel:getInstance():GetBagEquipAwaraItemInfo(vo)
- self.stren_data = stren_data
- AwardItem.SetData(self, vo.type_id, vo.goods_num, vo.color, stren_data)
- AwardItem.SetNumLimitVisible(self,vo.pos == GoodsModel.GOODS_POS_TYPE.equip,24)
- self:SetItemSize(78, 78)
- self:SetSelect(false)
- local basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(vo.type_id)
- if basic == nil then
- return
- end
- -- if self.vo.level > RoleManager.Instance.mainRoleInfo.level or (self.vo.expire_time > 0 and TimeUtil:getServerTime() > self.goodsVo.expire_time)
- -- or (basic.career_id ~= 0 and basic.career_id ~= RoleManager.Instance.mainRoleInfo.career) then
- -- self:ChangeUnusableState(true)
- -- else
- -- self:ChangeUnusableState(false)
- -- end
-
- --[[ -- 装备中的icon图
- if self.vo.used == true then
- self:ChangeUseState(true)
- else
- self:ChangeUseState(false)
- end]]
- else
- self.need_refreData = true
- end
- end
-
- function EquipShowItem:ClickCallFun(target, x, y)
- -- self.model:Fire(ChatModel.SELECT_GOOD_ITEM,self.vo)
- if self.selectImage.activeSelf then
- --UIToolTipMgr:getInstance():AppendEquipTips(self.vo.type_id, x, y,self.vo,nil,true)
- end
- self.model:SelectedGoodItem(self)
- end
-
- function EquipShowItem:ChangeUnusableState(state)
- if state then
- if self.unusableImg == nil then
- self.unusableImg = UiFactory.createChild(self.transform, UIType.Image, "unusableImg")
- else
- self.unusableImg:SetActive(true)
- end
-
- local function load_callback()
- self.unusableImg.transform.pivot = Vector2(0, 1)
- self.unusableImg.transform.localPosition = Vector3(5, -5, 0)
- end
- lua_resM:setImageSprite(self, self.unusableImg:GetComponent("Image"), "bag_asset", "bag_ui_6", true, load_callback)
-
- if self.identifyImg then
- self.identifyImg:SetActive(false)
- end
- else
- if self.unusableImg then
- self.unusableImg:SetActive(false)
- end
- end
- end
-
- --装备中状态
- function EquipShowItem:ChangeUseState(state)
- if state then
- if self.useImg == nil then
- self.useImg = UiFactory.createChild(self.transform, UIType.Image, "useImg")
- else
- self.useImg:SetActive(true)
- end
- local function load_callback()
- self.useImg.transform.pivot = Vector2(0, 1)
- self.useImg.transform.localPosition = Vector3(5, -5, 0)
- end
- lua_resM:setImageSprite(self, self.useImg:GetComponent("Image"), "chat_asset", "chat_eq_zbz", true, load_callback)
- else
- if self.useImg then
- self.useImg:SetActive(false)
- end
- end
- end
-
- function EquipShowItem:SetSelect(bool)
- if bool then
- -- SetSizeDelta(self.selectImage.transform,84,84)
- self.selectImage:SetActive(true)
- else
- self.selectImage:SetActive(false)
- end
- end
- function EquipShowItem:SetSelfActive(bool)
- if self.is_loaded then
- -- if type(state) == "boolean" and self.gameObject.activeSelf ~= state then
- self.gameObject:SetActive(state)
- --end
- end
- end
|