SocialityGiftRecordReceiveView = SocialityGiftRecordReceiveView or BaseClass(BaseItem)
|
|
local SocialityGiftRecordReceiveView = SocialityGiftRecordReceiveView
|
|
|
|
function SocialityGiftRecordReceiveView:__init()
|
|
self.base_file = "sociality"
|
|
self.layout_file = "SocialityGiftRecordReceiveView"
|
|
self.model = SocialityModel:getInstance()
|
|
|
|
self:Load()
|
|
end
|
|
|
|
function SocialityGiftRecordReceiveView:Load_callback()
|
|
|
|
self.nodes = {
|
|
"ScrollView", "ScrollView/Viewport/Content",
|
|
"empty:obj", "empty/girl:raw",
|
|
"empty/image:raw",
|
|
}
|
|
self:GetChildren(self.nodes)
|
|
|
|
-- self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT, 22302)
|
|
|
|
lua_resM:setOutsideRawImage(self, self.girl_raw, GameResPath.GetRoleBg("team_empty_bg_267_589"), false)
|
|
lua_resM:setOutsideRawImage(self, self.image_raw, GameResPath.GetViewBigBg("com_empty_bg1"))
|
|
|
|
self:AddEvents()
|
|
if self.need_refreshData then
|
|
-- self:UpdateView()
|
|
self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT, 22302)
|
|
end
|
|
end
|
|
|
|
function SocialityGiftRecordReceiveView:AddEvents( )
|
|
local function update_recive_view()
|
|
if self.call_back then
|
|
self.call_back()
|
|
end
|
|
self:UpdateView()
|
|
end
|
|
self:BindEvent(self.model,SocialityModel.UPDATE_RECEIVE_VIEW,update_recive_view)
|
|
end
|
|
|
|
function SocialityGiftRecordReceiveView:UpdateView( )
|
|
local info = self.model:GetReceiveInfo(2)
|
|
if not info then
|
|
self.empty_obj:SetActive(true)
|
|
return
|
|
end
|
|
|
|
local arg = {"time",}
|
|
local condition = {Array.UPPER}
|
|
SortTools.MoreKeysSorter(info, arg, condition)
|
|
table.sort( info, function ( a,b )
|
|
return a.time > b.time
|
|
end )
|
|
|
|
if not self.item_list_com then
|
|
self.item_list_com = self:AddUIComponent(UI.ItemListCreator)
|
|
end
|
|
local info = {
|
|
data_list = info,
|
|
item_con = self.Content,
|
|
item_class = SocialityReceiveItem,
|
|
item_width = 915,
|
|
item_height = 106,
|
|
space_y = 3,
|
|
scroll_view = self.ScrollView,
|
|
create_frequency = 0.02,
|
|
reuse_item_num = 7,
|
|
on_update_item = function(item, i, v)
|
|
item:SetData(v)
|
|
end,
|
|
}
|
|
self.item_list_com:UpdateItems(info)
|
|
end
|
|
|
|
function SocialityGiftRecordReceiveView:SetData(call_back)
|
|
self.call_back = call_back
|
|
if self.is_loaded then
|
|
self.need_refreshData = false
|
|
-- self:UpdateView()
|
|
self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT, 22302)
|
|
else
|
|
self.need_refreshData = true
|
|
end
|
|
end
|
|
|
|
function SocialityGiftRecordReceiveView:__delete( )
|
|
|
|
end
|