DailyRechargeRecordView = DailyRechargeRecordView or BaseClass(BaseView) local DailyRechargeRecordView = DailyRechargeRecordView DailyRechargeRecordView.PageSize = 100 function DailyRechargeRecordView:__init() self.base_file = "dailyRecharge" self.layout_file = "DailyRechargeRecordView" self.layer_name = "Activity" self.destroy_imm = true self.change_scene_close = true self.append_to_ctl_queue = false --是否要添加进界面堆栈 self.need_show_money = false --是否要显示顶部的金钱栏 -- self.is_set_zdepth = true self.click_bg_toClose = true self.blur_activity_bg = true ------------------------ -- 一级全屏界面: self.hide_maincancas = true --隐藏主界面 self.use_background = true --不一定显示遮罩 -- 二级界面: -- self.hide_maincancas = false --是否需要隐藏主界面,看策划需求 -- self.use_background = true --需要遮罩 ------------------------ self.model = RechargeActivityModel:getInstance() self.model:ResetPelletRecordInfo() self.load_callback = function () self:LoadSuccess() self:AddEvent() end self.open_callback = function ( ) self:OpenSuccess() end self.close_win_callback = function ( ) self:Close() end self.destroy_callback = function ( ) self:DestroySuccess() end end function DailyRechargeRecordView:Open( ) BaseView.Open(self) end function DailyRechargeRecordView:LoadSuccess() local nodes = { "lb_tip:tmp","scroll","scroll/Viewport/Content","nodata_bg/lb_empty:tmp","container","nodata_bg:obj", "nodata_bg/girl_bg:raw", } self:GetChildren(nodes) self.tabWindowComponent = UITabWindow.New(self.transform,{},nil, self.close_win_callback,self.background_wnd,self.container, UITabWindow.SizeSmallNoTab, nil,nil,nil) self.tabWindowComponent:SetBackgroundRes("WindowNew2_bg") self.tabWindowComponent:SetTitleText( "弹珠日志" ) self.lb_tip_tmp.text = "弹珠日志仅显示最近100条记录" self.lb_empty_tmp.text = "暂无弹珠记录~" lua_resM:setOutsideRawImage(self, self.girl_bg_raw, GameResPath.GetRoleBg("team_empty_bg_267_589"), false) end function DailyRechargeRecordView:AddEvent() local function ANS_PELLET_RECORD_INFO( ) self:UpdateView() end self:BindEvent(self.model, RechargeActivityModel.ANS_PELLET_RECORD_INFO, ANS_PELLET_RECORD_INFO) end function DailyRechargeRecordView:OpenSuccess() CustomActivityModel:getInstance():Fire(CustomActivityModel.PROTO_CCMD_EVENT, 33183, DailyRechargeRecordView.PageSize, 1) end function DailyRechargeRecordView:UpdateView() -- local show_data = { -- [1] = { -- id = 0, -- index = 1, -- name = "舒服1", -- goods_type_id = 109004, -- goods_num = 3, -- get_type = 0, -- }, -- [2] = { -- id = 0, -- index = 2, -- name = "舒服2", -- goods_type_id = 109004, -- goods_num = 6, -- get_type = 1, -- } -- } local show_data = DeepCopy(self.model:GetPelletRecordInfo()) local function sort_call( a,b ) return a.index < b.index end table.sort( show_data, sort_call ) self.nodata_bg_obj:SetActive(TableSize(show_data) == 0) for i=1,10 do show_data[i] = show_data[i] or {is_empty = true} end self.item_list = self.item_list or self:AddUIComponent(UI.ItemListCreator) local data = { data_list = show_data or {}, item_con = self.Content, item_class = DailyRechargeRecordItem, item_width = DailyRechargeRecordItem.Width, item_height = DailyRechargeRecordItem.Height, -- space_x = 0, space_y = -2, -- start_x = 0, start_y = 3, scroll_view = self.scroll, -- create_frequency = 0.10, on_update_item = function(item, i, v) item:SetData(i,v) end, } self.item_list:UpdateItems(data) end function DailyRechargeRecordView:DestroySuccess( ) if self.tabWindowComponent then self.tabWindowComponent:DeleteMe() end self.tabWindowComponent = nil self.model:ResetPelletRecordInfo() end