-- <*
|
|
-- @Author: Saber
|
|
-- @Description: 招财猫活动抽奖节点
|
|
-- *>
|
|
FortuneCatRollItem = FortuneCatRollItem or BaseClass(BaseItem)
|
|
local FortuneCatRollItem = FortuneCatRollItem
|
|
|
|
function FortuneCatRollItem:__init(parent_wnd,prefab_asset,layer_name)
|
|
self.base_file = "fortuneCat"
|
|
self.layout_file = "FortuneCatRollItem"
|
|
self.parent_wnd = parent_wnd
|
|
self.layer_name = layer_name
|
|
-- self.is_selected = false
|
|
self.model = FortuneCatModel:getInstance()
|
|
self.icon_pos = {
|
|
[1] = Vector2(-3, -25),
|
|
[2] = Vector2(0, -30),
|
|
[3] = Vector2(3, -25),
|
|
[4] = Vector2(4, -27),
|
|
[5] = Vector2(0, -25),
|
|
[6] = Vector2(0, -18),
|
|
[7] = Vector2(0, -25),
|
|
[8] = Vector2(0, -20),
|
|
}
|
|
self:Load()
|
|
end
|
|
|
|
function FortuneCatRollItem:Load_callback()
|
|
local nodes = {
|
|
"times_bg_special:obj",
|
|
"icon:img",
|
|
"times:tmp",
|
|
"times_special:tmp",
|
|
}
|
|
self:GetChildren(nodes)
|
|
|
|
|
|
self:AddEvents()
|
|
if self.need_refreshData then
|
|
self:UpdateView()
|
|
end
|
|
end
|
|
|
|
function FortuneCatRollItem:AddEvents( )
|
|
|
|
end
|
|
|
|
function FortuneCatRollItem:SetData( data, index )
|
|
self.data = data
|
|
self.index = index
|
|
self.sort = self.data.sort
|
|
if self.is_loaded then
|
|
self.need_refreshData = false
|
|
self:UpdateView()
|
|
else
|
|
self.need_refreshData = true
|
|
end
|
|
end
|
|
|
|
function FortuneCatRollItem:UpdateView( )
|
|
-- 倍率后端返回的数值放大了100倍,这里要乘以0.01
|
|
local is_special = self.data.mult >= 150
|
|
-- 不同倍率下使用不同的节点表现内容
|
|
self.times_tmp.text = not is_special and string.format("x%s倍", 0.01 * self.data.mult) or ""
|
|
self.times_special_tmp.text = is_special and string.format("x%s倍", 0.01 * self.data.mult) or ""
|
|
|
|
self.times_bg_special_obj:SetActive(is_special)
|
|
|
|
lua_resM:setImageSprite(self, self.icon_img, "fortuneCat_asset", "fc_reward_icon" .. self.index, true)
|
|
local icon_pos = self.icon_pos[self.index]
|
|
SetAnchoredPosition(self.icon, icon_pos.x, icon_pos.y)
|
|
end
|
|
|
|
function FortuneCatRollItem:SetSelected(is_selected)
|
|
-- self.is_selected = is_selected
|
|
-- if self.is_loaded then
|
|
-- if self.selected_obj.activeSelf ~= self.is_selected then
|
|
-- self.selected_obj:SetActive(self.is_selected)
|
|
-- end
|
|
-- end
|
|
end
|
|
|
|
function FortuneCatRollItem:__delete( )
|
|
|
|
end
|