源战役客户端
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.

95 rivejä
2.7 KiB

1 kuukausi sitten
  1. StrengthBaseView = StrengthBaseView or BaseClass(BaseView)
  2. StrengthBaseView.Index2Name = {
  3. [1] = {name = "我要变强", light_res = "icon_strong_wybq_h", dark_res = "icon_strong_wybq_n"},
  4. [2] = {name = "我要装备", light_res = "icon_strong_wyzb_h", dark_res = "icon_strong_wyzb_n"},
  5. [3] = {name = "我要经验", light_res = "icon_strong_exp_h", dark_res = "icon_strong_exp_n"},
  6. [4] = {name = "我要金币", light_res = "icon_strong_wyjb_h", dark_res = "icon_strong_wyjb_n"},
  7. [5] = {name = "我要红钻", light_res = "icon_strong_wyzs_h", dark_res = "icon_strong_wyzs_n"},
  8. }
  9. function StrengthBaseView:__init()
  10. self.base_file = "strength"
  11. self.layout_file = "StrengthBaseView"
  12. self.layer_name = "UI"
  13. self.use_background = true
  14. self.close_mode = CloseMode.CloseDestroy
  15. self.destroy_imm = true
  16. self.append_to_ctl_queue = true
  17. -- self.use_local_view = true
  18. self.model = StrengthModel:getInstance()
  19. self.mainRoleVo = RoleManager.Instance.mainRoleInfo
  20. self.load_callback = function ()
  21. --GlobalEventSystem:Fire(EventName.STOP_AUTO_DO_TASK)
  22. self:LoadSuccess()
  23. self:InitEvent()
  24. end
  25. self.open_callback = function ()
  26. self:SeletedTabbar(self.index)
  27. end
  28. self.close_callback = function ()
  29. -- GlobalEventSystem:Fire(EventName.START_AUTO_DO_TASK)
  30. end
  31. self.destroy_callback = function ()
  32. self:Remove()
  33. end
  34. end
  35. function StrengthBaseView:Open(index)
  36. self.index = index or 1
  37. BaseView.Open(self)
  38. end
  39. function StrengthBaseView:Close()
  40. BaseView.Close(self)
  41. end
  42. function StrengthBaseView:LoadSuccess()
  43. self.contanier = GetChildTransforms(self.transform, {"contanier",})
  44. local select_callback = function (index)
  45. self:SeletedTabbar(index)
  46. end
  47. local close_callback = function()
  48. self:Close()
  49. end
  50. local menu_list = {}
  51. for k,v in ipairs(StrengthBaseView.Index2Name) do
  52. table.insert(menu_list, StrengthBaseView.Index2Name[k])
  53. end
  54. self.tabWindowComponent = TabWindowComponent.New(self.transform, "变 强", menu_list, 1264, 632, 306, 52,
  55. select_callback, close_callback, Vector3(0,0,0), self.background_wnd, "strength_asset")
  56. end
  57. function StrengthBaseView:InitEvent()
  58. -- body
  59. end
  60. function StrengthBaseView:SeletedTabbar(index)
  61. local current_index = self.tabWindowComponent:GetCurrentSelectIndex()
  62. if current_index == index then return end
  63. if self.tabWindowComponent then
  64. self.tabWindowComponent:SetTabBarIndex(index)
  65. end
  66. if self.main_view == nil then
  67. self.main_view = StrengthMainView.New(self.contanier)
  68. end
  69. self.main_view:SetData(index)
  70. self.index = index
  71. end
  72. function StrengthBaseView:Remove()
  73. if self.tabWindowComponent then
  74. self.tabWindowComponent:DeleteMe()
  75. self.tabWindowComponent = nil
  76. end
  77. if self.main_view then
  78. self.main_view:DeleteMe()
  79. self.main_view = nil
  80. end
  81. end