|
|
- CSGWarRecordSmallItem = CSGWarRecordSmallItem or BaseClass(BaseItem)
- local CSGWarRecordSmallItem = CSGWarRecordSmallItem
-
- function CSGWarRecordSmallItem:__init()
- self.base_file = "CSGWar"
- self.layout_file = "CSGWarRecordSmallItem"
- self.model = CSGWarModel:GetInstance()
- self:Load()
- end
-
- function CSGWarRecordSmallItem:Load_callback()
- self.nodes = {
- "guild_text:tmp", "city_text:tmp", "name_text:tmp", "bg:img", "role_con"
- }
- self:GetChildren(self.nodes)
- self.role_head_item = HeadRoleItem.New(self.role_con)
- self.role_head_item:SetItemSize(70,70)
-
- self:AddEvents()
- if self.need_refreshData then
- self:UpdateView()
- end
- end
-
- function CSGWarRecordSmallItem:AddEvents( )
-
- end
-
- function CSGWarRecordSmallItem:UpdateView( )
- if self.p_index == 1 then
- lua_resM:setOutsideImageSprite(self, self.bg_img, GameResPath.GetCSGWarImage("csgwar_record_bg1"),false)
- else
- lua_resM:setOutsideImageSprite(self, self.bg_img, GameResPath.GetCSGWarImage("csgwar_record_bg2"),false)
- end
- -- local cfg = Config.Crossguildwarscene
- -- if cfg[self.index] then
- -- local city_name = Trim(cfg[self.index].name)
- -- end
- self.city_text_tmp.text = CSGWarConst.OVERLORD_POS_DESC[self.index]
- if self.data then
- self.guild_text_tmp.text = GetCSLongName(self.data.guild_name, self.data.server_num, false, ColorUtil.GREEN_DARK)
- self.name_text_tmp.text = HtmlColorTxt(self.data.chief_name, ColorUtil.YELLOW_DARK)
- local info = self.data
- local head_data = {
- vo = {
- id = info.role_id,
- server_id = info.ser_id,
- career = info.career,
- sex = info.sex,
- turn = info.turn,
- picture_ver = info.picture_ver,
- picture = info.picture,
- profile_photo_id = info.profile_photo_id,
- dress_board_id = info.dress_board or info.dress_id,
- level = info.level,
- empty_head = false, -- 是否是空数据头像
- }
- }
- self.role_head_item:SetData(head_data)
- else
- self.guild_text_tmp.text = "暂无社团占领"
- self.name_text_tmp.text = "暂无"
- local info = {}
- local head_data = {
- vo = {
- id = info.role_id,
- server_id = info.ser_id,
- career = info.career,
- sex = info.sex,
- turn = info.turn,
- picture_ver = info.picture_ver,
- picture = info.picture,
- profile_photo_id = info.profile_photo_id,
- dress_board_id = info.dress_board or info.dress_id,
- level = info.level,
- empty_head = true, -- 是否是空数据头像
- }
- }
- self.role_head_item:SetData(head_data)
- end
-
- end
-
- function CSGWarRecordSmallItem:SetData(index, data, p_index )
- self.index = index
- self.data = data
- self.p_index = p_index
- if self.is_loaded then
- self.need_refreshData = false
- self:UpdateView()
- else
- self.need_refreshData = true
- end
- end
-
- function CSGWarRecordSmallItem:__delete( )
- if self.role_head_item then
- self.role_head_item:DeleteMe()
- self.role_head_item = nil
- end
- end
|