-- <*
|
|
-- @Author: Saber
|
|
-- @Description: 跨服社团排行场景内采集buff道具信息节点
|
|
-- *>
|
|
GuildCSGRSceneBuffItem = GuildCSGRSceneBuffItem or BaseClass(BaseItem)
|
|
local GuildCSGRSceneBuffItem = GuildCSGRSceneBuffItem
|
|
|
|
function GuildCSGRSceneBuffItem:__init(parent_wnd,prefab_asset,layer_name)
|
|
self.base_file = "guildCSGR"
|
|
self.layout_file = "GuildCSGRSceneBuffItem"
|
|
self.parent_wnd = parent_wnd
|
|
self.layer_name = layer_name
|
|
|
|
self.model = GuildModel:getInstance()
|
|
self:Load()
|
|
end
|
|
|
|
function GuildCSGRSceneBuffItem:Load_callback()
|
|
local nodes = {
|
|
"buff_icon:img",
|
|
"effect_desc:txt", "left_num:txt",
|
|
}
|
|
self:GetChildren(nodes)
|
|
|
|
self:AddEvents()
|
|
if self.need_refreshData then
|
|
self:UpdateView()
|
|
end
|
|
end
|
|
|
|
function GuildCSGRSceneBuffItem:AddEvents( )
|
|
local function update_buff_num()
|
|
self:UpdateView()
|
|
end
|
|
self:BindEvent(self.model, GuildModel.UPDATE_CSGR_COLLECTBUFF, update_buff_num)
|
|
end
|
|
|
|
function GuildCSGRSceneBuffItem:SetData( data )
|
|
self.data = data
|
|
if self.is_loaded then
|
|
self.need_refreshData = false
|
|
self:UpdateView()
|
|
else
|
|
self.need_refreshData = true
|
|
end
|
|
end
|
|
|
|
function GuildCSGRSceneBuffItem:UpdateView( )
|
|
if self.data then
|
|
lua_resM:setImageSprite(self, self.buff_icon_img, "guildCSGR_asset", "csgr_attr_"..self.data[1])
|
|
local buff_data = self.model:GetCSGRCollectBuffs(self.data[1])
|
|
local attr_name = WordManager:GetProperties(self.data[2])
|
|
local attr_val = WordManager:GetPropertyValue(self.data[2], self.data[3] * (buff_data and buff_data.num or 0))
|
|
self.effect_desc_txt.text = string.format("%s:<color=%s>%s</color>", attr_name, ColorUtil.GREEN_DARK, attr_val)
|
|
self.left_num_txt.text = string.format("物资数量:<color=%s>%s</color>", ColorUtil.GREEN_DARK, buff_data and buff_data.num or 0)
|
|
end
|
|
end
|
|
|
|
function GuildCSGRSceneBuffItem:__delete( )
|
|
|
|
end
|