--[[
|
|
@description:CommonTips
|
|
]]
|
|
CommonTips = CommonTips or BaseClass(BaseView)
|
|
function CommonTips:__init()
|
|
self.base_file = "common"
|
|
self.layout_file = "CommonTips"
|
|
self.layer_name = "Top"
|
|
self.close_mode = CloseMode.CloseDestroy
|
|
self.destroy_imm = true
|
|
self.use_background = true
|
|
self.click_bg_toClose = true
|
|
self.pos_x = 0
|
|
self.pos_y = 0
|
|
|
|
self.model = GoodsModel:getInstance()
|
|
|
|
self.goodsVo = nil
|
|
self.main_type = 0
|
|
|
|
self.load_callback = function ()
|
|
self:LoadSuccess()
|
|
end
|
|
self.open_callback = function ()
|
|
self:SetData()
|
|
end
|
|
self.close_callback = function ()
|
|
|
|
end
|
|
|
|
self.destroy_callback = function ()
|
|
self:Remove()
|
|
end
|
|
end
|
|
|
|
function CommonTips:Remove()
|
|
if self.award_item then
|
|
self.award_item:DeleteMe()
|
|
self.award_item = nil
|
|
end
|
|
end
|
|
|
|
function CommonTips:LoadSuccess()
|
|
-- self.goodsBorder = self:GetChild("goodsBorder"):GetComponent("Image")
|
|
-- self.goodsIcon = self:GetChild("goodsBorder/goodsIcon"):GetComponent("Image")
|
|
self.goods_conta = self:GetChild("goodsBorder")
|
|
self.award_item = AwardItem.New(self.goods_conta, false)
|
|
self.name = self:GetChild("name"):GetComponent("Text")
|
|
|
|
--英灵石组件
|
|
self.main_type_20 = self:GetChild("main_type_20").gameObject
|
|
self.only = self:GetChild("main_type_20/only").gameObject
|
|
self.stone_fighting = self:GetChild("main_type_20/imgFight/fight"):GetComponent("Text")
|
|
self.stone_pos = self:GetChild("main_type_20/txtPos/pos"):GetComponent("Text")
|
|
self.stone_level = self:GetChild("main_type_20/txtLevel/level"):GetComponent("Text")
|
|
self.stone_pro = self:GetChild("main_type_20/txtAttr/pro"):GetComponent("Text")
|
|
|
|
--通用信息面板
|
|
self.main_type_0 = self:GetChild("main_type_0").gameObject
|
|
self.com_introduce = self:GetChild("main_type_0/introduce"):GetComponent("Text")
|
|
|
|
self:InitEvent()
|
|
end
|
|
|
|
function CommonTips:InitEvent()
|
|
local function onClickBtnHandler(target)
|
|
self:Close()
|
|
end
|
|
--AddClickEvent(self.offBtn, onClickBtnHandler)
|
|
|
|
self:HideAllPanel()
|
|
end
|
|
|
|
function CommonTips:Open(goods_id , x , y , main_type)
|
|
print("-------------goods_id:", goods_id)
|
|
self.goodsVo = GoodsModel:getInstance():GetGoodsBasicByTypeId(goods_id)
|
|
self.main_type = main_type or 0
|
|
self.pos_x = x or 0
|
|
self.pos_y = y or 0
|
|
if self.goodsVo == nil then return end
|
|
|
|
BaseView.Open(self)
|
|
end
|
|
|
|
function CommonTips:SetData()
|
|
local goods_icon = self.goodsVo.goods_icon
|
|
local name = self.goodsVo.goods_name
|
|
if self.goodsVo.type == 11 and (self.goodsVo.subtype == 10 or self.goodsVo.subtype == 11)then --装备鉴定物, 碎片,显示鉴定物对应的装备图标
|
|
local type_id, _name, icon = EquipModel:getInstance():GetIdentifyGoodsNameAndIcon(self.goodsVo.type_id, RoleManager.Instance.mainRoleInfo.career, self.goodsVo.color)
|
|
goods_icon = icon
|
|
name = _name
|
|
end
|
|
self.award_item:SetData(self.goodsVo.type_id)
|
|
|
|
|
|
-- lua_resM:setImageSprite(self,self.goodsBorder,"alphaCommon_asset","com_icon_bg_"..self.goodsVo.color)
|
|
-- lua_resM:setOutsideImageSprite(self,self.goodsIcon,GameResPath.GetGoodsIcon(goods_icon))
|
|
self.name.text = GoodsModel.GetRealGoodsName(self.goodsVo)
|
|
|
|
if self.main_type == 20 then --英灵石
|
|
self:SetEquipStoneData()
|
|
else
|
|
self:SetCommonData()
|
|
end
|
|
|
|
-- self.transform.localPosition = Vector3(self.pos_x, self.pos_y)
|
|
-- self.background_wnd.transform.localPosition = Vector3(-self.pos_x, -self.pos_y)
|
|
end
|
|
|
|
function CommonTips:HideAllPanel()
|
|
self.main_type_20:SetActive(false)
|
|
self.main_type_0:SetActive(false)
|
|
end
|
|
|
|
--设置英灵石数据
|
|
function CommonTips:SetEquipStoneData()
|
|
self.main_type_20:SetActive(true)
|
|
|
|
local cfg = EquipModel:getInstance():GetEquipStoneConfig(self.goodsVo.type_id)
|
|
if cfg then
|
|
self.stone_fighting.text = cfg.combat_power
|
|
if tonumber(cfg.unique) == 1 then
|
|
self.only:SetActive(true)
|
|
else
|
|
self.only:SetActive(false)
|
|
end
|
|
end
|
|
|
|
self.stone_pos.text = WordManager:GetEquipStyleStr(self.goodsVo.subtype)
|
|
self.stone_level.text = self.goodsVo.level
|
|
|
|
local pro_str = EquipModel:getInstance():GetStoneProStr(self.goodsVo.type_id)
|
|
self.stone_pro.text = pro_str
|
|
end
|
|
|
|
--设置物品简介
|
|
function CommonTips:SetCommonData()
|
|
self.main_type_0:SetActive(true)
|
|
|
|
self.com_introduce.text = self.goodsVo.intro
|
|
end
|