|
EquipCollectTipItem = EquipCollectTipItem or BaseClass(BaseItem)
|
|
local EquipCollectTipItem = EquipCollectTipItem
|
|
|
|
function EquipCollectTipItem:__init()
|
|
self.base_file = "equipCollect"
|
|
self.layout_file = "EquipCollectEquipItem"
|
|
self.model = EquipCollectModel:GetInstance()
|
|
|
|
self:Load()
|
|
end
|
|
|
|
function EquipCollectTipItem:Load_callback()
|
|
self.nodes = {
|
|
"default_image:obj", "click_con:obj", "type_image:img", "icon_con", "get_tip:tmp",
|
|
}
|
|
self:GetChildren(self.nodes)
|
|
self.awardItem = UIObjPool:getInstance():PopItem(UIObjPool.UIType.AwardItem,self.icon_con)
|
|
self.awardItem:SetEnableClick(false)
|
|
self.awardItem:SetItemSize(78, 78)
|
|
local x_ratio = 0.75
|
|
self.transform.localScale = Vector2(x_ratio, x_ratio)
|
|
|
|
self:AddEvents()
|
|
if self.need_refreshData then
|
|
self:UpdateView()
|
|
end
|
|
if self.need_reaction then
|
|
self:StartAction(self.need_action_data)
|
|
end
|
|
end
|
|
|
|
function EquipCollectTipItem:AddEvents( )
|
|
|
|
end
|
|
|
|
function EquipCollectTipItem:UpdateView( )
|
|
if self.view_type == "suit_view" then
|
|
self.is_empty = false
|
|
self.awardItem:SetData(self.data.type_id)
|
|
self.awardItem:SetVisible(true)
|
|
self.transform.localScale = Vector2(1, 1)
|
|
self.default_image_obj:SetActive(false)
|
|
else
|
|
if self.data.type_id > 0 and (not self.data.need_action) then
|
|
self.is_empty = false
|
|
self.awardItem:SetData(self.data.type_id)
|
|
self.awardItem:SetVisible(true)
|
|
else
|
|
self.is_empty = true
|
|
self.awardItem:SetVisible(false)
|
|
end
|
|
self.get_tip_tmp.text = ""
|
|
lua_resM:setImageSprite(self,self.type_image_img,"common_asset","com_equip_pos_".. self.data.pos_id, true)
|
|
end
|
|
end
|
|
|
|
function EquipCollectTipItem:StartAction( need_action_data )
|
|
self.need_action_data = need_action_data
|
|
if not self.is_loaded then
|
|
self.need_reaction = true
|
|
return
|
|
end
|
|
local x_offset = 68
|
|
local end_pos_x = x_offset * (need_action_data.index - 1) - 202
|
|
local end_pos_y = -10
|
|
self.transform.pivot = Vector2(0.5, 0.5)
|
|
self.transform.anchorMin = Vector2(0.5, 0.5)
|
|
self.transform.anchorMax = Vector2(0.5, 0.5)
|
|
SetAnchoredPosition(self.transform, end_pos_x - 100, end_pos_y+200)
|
|
SetLocalScale(self.transform, 0.8,0.8,0.8)
|
|
local function onCompleted3( ... )
|
|
self.is_action = false
|
|
end
|
|
local function onCompleted2( ... )
|
|
TweenLite.to(self, self.transform, TweenLite.UiAnimationType.SCALE, Vector3(0.75,0.75,0.75), 0.5, onCompleted2)
|
|
end
|
|
local function onCompleted()
|
|
TweenLite.to(self, self.transform, TweenLite.UiAnimationType.SCALE, Vector3(0.8,0.8,0.8), 0.3, onCompleted2)
|
|
end
|
|
self.is_action = true
|
|
TweenLite.to(self, self.transform, TweenLite.UiAnimationType.ANCHORED_POS, Vector2(end_pos_x, end_pos_y), 0.5, onCompleted)
|
|
end
|
|
|
|
function EquipCollectTipItem:SetData( data,view_type )
|
|
self.data = data
|
|
self.view_type = view_type
|
|
if self.is_loaded then
|
|
self.need_refreshData = false
|
|
self:UpdateView()
|
|
else
|
|
self.need_refreshData = true
|
|
end
|
|
end
|
|
|
|
function EquipCollectTipItem:__delete( )
|
|
if self.awardItem then
|
|
UIObjPool:getInstance():PushItem(UIObjPool.UIType.AwardItem, self.awardItem)
|
|
self.awardItem = nil
|
|
end
|
|
end
|