CSGWarRecordItem = CSGWarRecordItem or BaseClass(BaseItem)
|
|
local CSGWarRecordItem = CSGWarRecordItem
|
|
|
|
function CSGWarRecordItem:__init()
|
|
self.base_file = "CSGWar"
|
|
self.layout_file = "CSGWarRecordItem"
|
|
self.model = CSGWarModel:GetInstance()
|
|
self.item_list = {}
|
|
self:Load()
|
|
end
|
|
|
|
function CSGWarRecordItem:Load_callback()
|
|
self.nodes = {
|
|
"bg:img", "name_text:tmp","item_con",
|
|
}
|
|
self:GetChildren(self.nodes)
|
|
|
|
self:AddEvents()
|
|
if self.need_refreshData then
|
|
self:UpdateView()
|
|
end
|
|
end
|
|
|
|
function CSGWarRecordItem:AddEvents( )
|
|
|
|
end
|
|
|
|
function CSGWarRecordItem:UpdateView( )
|
|
local cfg = Config.Crossguildwarscene
|
|
self.name_text_tmp.text = string.format("%s 战役", TimeUtil:timeConversion(self.data.time, "yyyy.mm.dd"))
|
|
if self.index == 1 then
|
|
lua_resM:setOutsideImageSprite(self, self.bg_img, GameResPath.GetCSGWarImage("csgwar_record_sub_bg2"),true)
|
|
else
|
|
lua_resM:setOutsideImageSprite(self, self.bg_img, GameResPath.GetCSGWarImage("csgwar_record_sub_bg"),true)
|
|
end
|
|
local x_offset = 170
|
|
for i=1,5 do
|
|
local item = self.item_list[i]
|
|
if not item then
|
|
item = CSGWarRecordSmallItem.New(self.item_con)
|
|
self.item_list[i] = item
|
|
item:SetPosition((i-1)*x_offset, 0)
|
|
end
|
|
item:SetData(i, self.data.city_list[i], self.index)
|
|
end
|
|
end
|
|
|
|
function CSGWarRecordItem:SetData( index, data )
|
|
self.index = index
|
|
self.data = data
|
|
if self.is_loaded then
|
|
self.need_refreshData = false
|
|
self:UpdateView()
|
|
else
|
|
self.need_refreshData = true
|
|
end
|
|
end
|
|
|
|
function CSGWarRecordItem:__delete( )
|
|
for i,v in ipairs(self.item_list) do
|
|
v:DeleteMe()
|
|
v = nil
|
|
end
|
|
self.item_list = {}
|
|
end
|