源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
3.8 KiB

  1. DailyRechargeRecordView = DailyRechargeRecordView or BaseClass(BaseView)
  2. local DailyRechargeRecordView = DailyRechargeRecordView
  3. DailyRechargeRecordView.PageSize = 100
  4. function DailyRechargeRecordView:__init()
  5. self.base_file = "dailyRecharge"
  6. self.layout_file = "DailyRechargeRecordView"
  7. self.layer_name = "Activity"
  8. self.destroy_imm = true
  9. self.change_scene_close = true
  10. self.append_to_ctl_queue = false --是否要添加进界面堆栈
  11. self.need_show_money = false --是否要显示顶部的金钱栏
  12. -- self.is_set_zdepth = true
  13. self.click_bg_toClose = true
  14. self.blur_activity_bg = true
  15. ------------------------
  16. -- 一级全屏界面:
  17. self.hide_maincancas = true --隐藏主界面
  18. self.use_background = true --不一定显示遮罩
  19. -- 二级界面:
  20. -- self.hide_maincancas = false --是否需要隐藏主界面,看策划需求
  21. -- self.use_background = true --需要遮罩
  22. ------------------------
  23. self.model = RechargeActivityModel:getInstance()
  24. self.model:ResetPelletRecordInfo()
  25. self.load_callback = function ()
  26. self:LoadSuccess()
  27. self:AddEvent()
  28. end
  29. self.open_callback = function ( )
  30. self:OpenSuccess()
  31. end
  32. self.close_win_callback = function ( )
  33. self:Close()
  34. end
  35. self.destroy_callback = function ( )
  36. self:DestroySuccess()
  37. end
  38. end
  39. function DailyRechargeRecordView:Open( )
  40. BaseView.Open(self)
  41. end
  42. function DailyRechargeRecordView:LoadSuccess()
  43. local nodes = {
  44. "lb_tip:tmp","scroll","scroll/Viewport/Content","nodata_bg/lb_empty:tmp","container","nodata_bg:obj", "nodata_bg/girl_bg:raw",
  45. }
  46. self:GetChildren(nodes)
  47. self.tabWindowComponent = UITabWindow.New(self.transform,{},nil,
  48. self.close_win_callback,self.background_wnd,self.container, UITabWindow.SizeSmallNoTab, nil,nil,nil)
  49. self.tabWindowComponent:SetBackgroundRes("WindowNew2_bg")
  50. self.tabWindowComponent:SetTitleText( "弹珠日志" )
  51. self.lb_tip_tmp.text = "弹珠日志仅显示最近100条记录"
  52. self.lb_empty_tmp.text = "暂无弹珠记录~"
  53. lua_resM:setOutsideRawImage(self, self.girl_bg_raw, GameResPath.GetRoleBg("team_empty_bg_267_589"), false)
  54. end
  55. function DailyRechargeRecordView:AddEvent()
  56. local function ANS_PELLET_RECORD_INFO( )
  57. self:UpdateView()
  58. end
  59. self:BindEvent(self.model, RechargeActivityModel.ANS_PELLET_RECORD_INFO, ANS_PELLET_RECORD_INFO)
  60. end
  61. function DailyRechargeRecordView:OpenSuccess()
  62. CustomActivityModel:getInstance():Fire(CustomActivityModel.PROTO_CCMD_EVENT, 33183, DailyRechargeRecordView.PageSize, 1)
  63. end
  64. function DailyRechargeRecordView:UpdateView()
  65. -- local show_data = {
  66. -- [1] = {
  67. -- id = 0,
  68. -- index = 1,
  69. -- name = "舒服1",
  70. -- goods_type_id = 109004,
  71. -- goods_num = 3,
  72. -- get_type = 0,
  73. -- },
  74. -- [2] = {
  75. -- id = 0,
  76. -- index = 2,
  77. -- name = "舒服2",
  78. -- goods_type_id = 109004,
  79. -- goods_num = 6,
  80. -- get_type = 1,
  81. -- }
  82. -- }
  83. local show_data = DeepCopy(self.model:GetPelletRecordInfo())
  84. local function sort_call( a,b )
  85. return a.index < b.index
  86. end
  87. table.sort( show_data, sort_call )
  88. self.nodata_bg_obj:SetActive(TableSize(show_data) == 0)
  89. for i=1,10 do
  90. show_data[i] = show_data[i] or {is_empty = true}
  91. end
  92. self.item_list = self.item_list or self:AddUIComponent(UI.ItemListCreator)
  93. local data = {
  94. data_list = show_data or {},
  95. item_con = self.Content,
  96. item_class = DailyRechargeRecordItem,
  97. item_width = DailyRechargeRecordItem.Width,
  98. item_height = DailyRechargeRecordItem.Height,
  99. -- space_x = 0,
  100. space_y = -2,
  101. -- start_x = 0,
  102. start_y = 3,
  103. scroll_view = self.scroll,
  104. -- create_frequency = 0.10,
  105. on_update_item = function(item, i, v)
  106. item:SetData(i,v)
  107. end,
  108. }
  109. self.item_list:UpdateItems(data)
  110. end
  111. function DailyRechargeRecordView:DestroySuccess( )
  112. if self.tabWindowComponent then
  113. self.tabWindowComponent:DeleteMe()
  114. end
  115. self.tabWindowComponent = nil
  116. self.model:ResetPelletRecordInfo()
  117. end