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

89 lines
2.1 KiB

  1. ChatSettingView = ChatSettingView or BaseClass(BaseView)
  2. ChatSettingView.TabList = {"频道设置","个性设置"}
  3. function ChatSettingView:__init()
  4. self.base_file = "chat"
  5. self.layout_file = "ChatSettingView"
  6. self.destroy_imm = false
  7. self.use_background = true
  8. self.layer_name = "UI"
  9. self.panel_list = {}
  10. self.cur_select_index = 0
  11. self.load_callback = function ()
  12. self:LoadSuccess()
  13. self:SetData()
  14. self:SeletedTabbar(1)
  15. end
  16. self.destroy_callback = function ()
  17. end
  18. self:AddPreLoadList("uiComponent",{"TabButton"})
  19. end
  20. function ChatSettingView:__delete()
  21. self:Clear()
  22. end
  23. function ChatSettingView:Clear()
  24. if self.TabWindowComponent then
  25. self.TabWindowComponent:DeleteMe()
  26. self.TabWindowComponent = nil
  27. end
  28. end
  29. function ChatSettingView:LoadSuccess()
  30. for i=1,#ChatSettingView.TabList do
  31. local panel = GameObject("Panel_"..i).transform
  32. panel.parent = self.transform
  33. panel.localPosition = Vector3.zero
  34. panel.localScale = Vector3.one
  35. table.insert(self.panel_list, panel)
  36. end
  37. if self.TabWindowComponent == nil then
  38. local select_callback = function(index)
  39. self:SeletedTabbar(index)
  40. end
  41. local close_callback = function()
  42. self:Close()
  43. end
  44. self.TabWindowComponent = TabWindowComponent.New(self.transform, "聊天设置", ChatSettingView.TabList, 615, 675, 332, 54, select_callback, close_callback, nil, self.background_wnd)
  45. end
  46. end
  47. function ChatSettingView:InitEvent()
  48. end
  49. function ChatSettingView:SetData()
  50. end
  51. function ChatSettingView:SeletedTabbar(index)
  52. local current_index = self.TabWindowComponent:GetCurrentSelectIndex()
  53. if current_index == index then return end
  54. if self.TabWindowComponent then
  55. self.TabWindowComponent:SetTabBarIndex(index)
  56. self:SwitchBar()
  57. end
  58. end
  59. function ChatSettingView:SwitchBar()
  60. local index = self.TabWindowComponent:GetCurrentSelectIndex()
  61. if index == 1 then
  62. if self.ChannelSettingView == nil then
  63. self.ChannelSettingView = ChannelSettingView.New(self.panel_list[index])
  64. end
  65. self:PopUpChild(self.ChannelSettingView)
  66. elseif index == 2 then
  67. -- if self.BubbleSettingView == nil then
  68. -- self.BubbleSettingView = BubbleSettingView.New(self.panel_list[index])
  69. -- end
  70. end
  71. end