|
--[[
|
|
@description:装备鉴定tips
|
|
]]
|
|
EquipIdentifyTips = EquipIdentifyTips or BaseClass(BaseView)
|
|
function EquipIdentifyTips:__init()
|
|
self.base_file = "common"
|
|
self.layout_file = "EquipIdentifyTips"
|
|
self.layer_name = "Top"
|
|
self.close_mode = CloseMode.CloseDestroy
|
|
self.destroy_imm = true
|
|
self.use_background = true
|
|
self.click_bg_toClose = true
|
|
self.goods_vo = nil
|
|
self.pos_x = 0
|
|
self.pos_y = 0
|
|
self.model = GoodsModel:getInstance()
|
|
self.is_show_btn = false
|
|
self.curr_height = 0
|
|
self.load_callback = function ()
|
|
self:LoadSuccess()
|
|
end
|
|
self.open_callback = function ()
|
|
self:SetData()
|
|
end
|
|
self.close_callback = function ()
|
|
end
|
|
self.destroy_callback = function ()
|
|
if self.icon_item then
|
|
self.icon_item:DeleteMe()
|
|
end
|
|
end
|
|
end
|
|
|
|
function EquipIdentifyTips:LoadSuccess()
|
|
self.bg = self:GetChild("bg")
|
|
self.icon = self:GetChild("icon")
|
|
self.nameText = self:GetChild("nameText"):GetComponent("Text")
|
|
self.num = self:GetChild("num"):GetComponent("Text")
|
|
self.level = self:GetChild("level"):GetComponent("Text")
|
|
self.desc = self:GetChild("desc"):GetComponent("Text")
|
|
self.cost = self:GetChild("conta/cost"):GetComponent("Text")
|
|
self.okBtn = self:GetChild("okBtn").gameObject
|
|
self.sellBtn = self:GetChild("sellBtn").gameObject
|
|
self.contaObj = self:GetChild("conta").gameObject
|
|
|
|
self.icon_item = AwardItem.New(self.icon, false)
|
|
self.icon_item:ChangeCountVisible(false)
|
|
|
|
self:InitEvent()
|
|
end
|
|
|
|
function EquipIdentifyTips:InitEvent()
|
|
local function onClickBtnHandler(target)
|
|
if self.goods_vo and self.is_show_btn then
|
|
if target == self.okBtn then
|
|
EquipModel:getInstance():Fire(EquipModel.EQUIP_IDENTIFY, self.goods_vo.goods_id)
|
|
elseif target == self.sellBtn then
|
|
GlobalEventSystem:Fire(EventName.OPEN_SEll_VIEW, self.goods_vo)
|
|
end
|
|
end
|
|
self:Close()
|
|
end
|
|
AddClickEvent(self.okBtn, onClickBtnHandler)
|
|
AddClickEvent(self.sellBtn, onClickBtnHandler)
|
|
end
|
|
|
|
function EquipIdentifyTips:Open(type_id, x, y, goods_vo)
|
|
self.is_show_btn = goods_vo ~= nil
|
|
self.goods_vo = goods_vo or GoodsModel:getInstance():GetGoodsBasicByTypeId(type_id)
|
|
if self.goods_vo == nil then return print("物品db里面没有物品数据") end
|
|
self.pos_x = x
|
|
self.pos_y = y
|
|
BaseView.Open(self)
|
|
end
|
|
|
|
function EquipIdentifyTips:SetData()
|
|
if self.goods_vo == nil then return end
|
|
|
|
self.icon_item:SetData(tonumber(self.goods_vo.type_id), 1, self.goods_vo.color)
|
|
local type_id, name, icon = EquipModel:getInstance():GetIdentifyGoodsNameAndIcon(self.goods_vo.type_id, RoleManager.Instance.mainRoleInfo.career, self.goods_vo.color)
|
|
self.nameText.text = name
|
|
self.num.text = GoodsModel:getInstance():GetTypeGoodsNum(self.goods_vo.type_id)
|
|
if self.goods_vo.level > RoleManager.Instance.mainRoleInfo.level then
|
|
self.level.text = "<color='#de4141'>" .. self.goods_vo.level .. "级</color>"
|
|
else
|
|
self.level.text = self.goods_vo.level .. "级"
|
|
end
|
|
self.desc.text = Trim(self.goods_vo.intro)
|
|
|
|
local config = Config.Equipidentifycost[self.goods_vo.type_id]
|
|
if config then
|
|
local reward_list = ErlangParser:GetInstance():Parse(config.object_list)
|
|
if reward_list and reward_list[1][3] then
|
|
self.cost.text = reward_list[1][3]
|
|
end
|
|
end
|
|
|
|
if self.is_show_btn then
|
|
self.contaObj:SetActive(true)
|
|
self.okBtn:SetActive(true)
|
|
self.sellBtn:SetActive(true)
|
|
else
|
|
self.contaObj:SetActive(false)
|
|
self.okBtn:SetActive(false)
|
|
self.sellBtn:SetActive(false)
|
|
self.num.text = "1"
|
|
end
|
|
end
|