源战役客户端
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

173 righe
10 KiB

  1. ChannelSettingView = ChannelSettingView or BaseClass(BaseItem)
  2. function ChannelSettingView:__init()
  3. self.base_file = "setting"
  4. self.layout_file = "channelSettingView"
  5. self.is_delay_callback = true
  6. self.layer_name = "UI"
  7. self.destroy_imm = true
  8. -- self.open_callback = function ()
  9. -- self:SetTotalCheckState()
  10. -- end
  11. self.need_refresh = false
  12. --self.use_local_view = true
  13. self:Load()
  14. end
  15. function ChannelSettingView:__delete()
  16. self:Clear()
  17. end
  18. function ChannelSettingView:Load_callback( )
  19. self:LoadSuccess()
  20. end
  21. function ChannelSettingView:Clear()
  22. if self.update_setting_id then
  23. SettingModel:getInstance():UnBind(self.update_setting_id)
  24. self.update_setting_id = nil
  25. end
  26. end
  27. function ChannelSettingView:LoadSuccess()
  28. --self.closeBtn = self:GetChild("Window/closeBtn").gameObject
  29. self.sys_check = self:GetChild("channelCon/channelBtn1/Background/Checkmark").gameObject
  30. self.world_check = self:GetChild("channelCon/channelBtn2/Background/Checkmark").gameObject
  31. self.near_check = self:GetChild("channelCon/channelBtn3/Background/Checkmark").gameObject
  32. self.society_check = self:GetChild("channelCon/channelBtn4/Background/Checkmark").gameObject
  33. self.team_check = self:GetChild("channelCon/channelBtn5/Background/Checkmark").gameObject
  34. self.friend_check = self:GetChild("channelCon/channelBtn6/Background/Checkmark").gameObject
  35. self.career_check = self:GetChild("channelCon/channelBtn7/Background/Checkmark").gameObject --跨服频道
  36. self.sys_btn = self:GetChild("channelCon/channelBtn1/Background").gameObject
  37. self.world_btn = self:GetChild("channelCon/channelBtn2/Background").gameObject
  38. self.near_btn = self:GetChild("channelCon/channelBtn3/Background").gameObject
  39. self.society_btn = self:GetChild("channelCon/channelBtn4/Background").gameObject
  40. self.team_btn = self:GetChild("channelCon/channelBtn5/Background").gameObject
  41. self.friend_btn = self:GetChild("channelCon/channelBtn6/Background").gameObject
  42. self.career_btn = self:GetChild("channelCon/channelBtn7/Background").gameObject
  43. self.voice2txt_check = self:GetChild("voiceCon/voiceBtn1/Background/Checkmark").gameObject
  44. self.world_voice_check = self:GetChild("voiceCon/voiceBtn2/Background/Checkmark").gameObject
  45. self.around_voice_check = self:GetChild("voiceCon/voiceBtn3/Background/Checkmark").gameObject
  46. self.guild_voice_check = self:GetChild("voiceCon/voiceBtn4/Background/Checkmark").gameObject
  47. self.team_voice_check = self:GetChild("voiceCon/voiceBtn5/Background/Checkmark").gameObject
  48. self.friend_voice_check = self:GetChild("voiceCon/voiceBtn6/Background/Checkmark").gameObject
  49. self.career_voice_check = self:GetChild("voiceCon/voiceBtn7/Background/Checkmark").gameObject --跨服频道
  50. self.voice2txt_btn = self:GetChild("voiceCon/voiceBtn1/Background").gameObject
  51. self.world_voice_btn = self:GetChild("voiceCon/voiceBtn2/Background").gameObject
  52. self.around_voice_btn = self:GetChild("voiceCon/voiceBtn3/Background").gameObject
  53. self.guild_voice_btn = self:GetChild("voiceCon/voiceBtn4/Background").gameObject
  54. self.team_voice_btn = self:GetChild("voiceCon/voiceBtn5/Background").gameObject
  55. self.friend_voice_btn = self:GetChild("voiceCon/voiceBtn6/Background").gameObject
  56. self.career_voice_btn = self:GetChild("voiceCon/voiceBtn7/Background").gameObject
  57. self.auto_play_btn = self:GetChild("wifiBtn/Background").gameObject
  58. self.auto_play_check = self:GetChild("wifiBtn/Background/Checkmark").gameObject
  59. self:InitEvent()
  60. if self.need_refresh then
  61. self:SetTotalCheckState()
  62. end
  63. end
  64. function ChannelSettingView:InitEvent()
  65. local function onBtnClickHandler(target)
  66. -- if target == self.closeBtn then
  67. -- self:Close()
  68. if target == self.sys_btn then
  69. SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.SYSTEM,self.sys_check.activeSelf and 0 or 1)
  70. elseif target == self.world_btn then
  71. SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.WORLD,self.world_check.activeSelf and 0 or 1)
  72. elseif target == self.near_btn then
  73. SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.AROUND,self.near_check.activeSelf and 0 or 1)
  74. elseif target == self.society_btn then
  75. SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.GUILD,self.society_check.activeSelf and 0 or 1)
  76. elseif target == self.team_btn then
  77. SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.TEAM,self.team_check.activeSelf and 0 or 1)
  78. elseif target == self.friend_btn then
  79. SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.FRIEND,self.friend_check.activeSelf and 0 or 1)
  80. elseif target == self.career_btn then
  81. SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.CROSS,self.career_check.activeSelf and 0 or 1)
  82. elseif target == self.voice2txt_btn then
  83. SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.TEXTONLY,self.voice2txt_check.activeSelf and 0 or 1)
  84. elseif target == self.world_voice_btn then
  85. SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.WORLD,self.world_voice_check.activeSelf and 0 or 1)
  86. elseif target == self.around_voice_btn then
  87. SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.AROUND,self.around_voice_check.activeSelf and 0 or 1)
  88. elseif target == self.guild_voice_btn then
  89. SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.GUILD,self.guild_voice_check.activeSelf and 0 or 1)
  90. elseif target == self.team_voice_btn then
  91. SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.TEAM,self.team_voice_check.activeSelf and 0 or 1)
  92. elseif target == self.friend_voice_btn then
  93. SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.FRIEND,self.friend_voice_check.activeSelf and 0 or 1)
  94. elseif target == self.career_voice_btn then
  95. SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.CROSS,self.career_voice_check.activeSelf and 0 or 1)
  96. elseif target == self.auto_play_btn then
  97. SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.AUTOPLAY,self.auto_play_check.activeSelf and 0 or 1)
  98. end
  99. end
  100. --AddClickEvent(self.closeBtn,onBtnClickHandler)
  101. AddClickEvent(self.sys_btn,onBtnClickHandler)
  102. AddClickEvent(self.world_btn,onBtnClickHandler)
  103. AddClickEvent(self.near_btn,onBtnClickHandler)
  104. AddClickEvent(self.society_btn,onBtnClickHandler)
  105. AddClickEvent(self.team_btn,onBtnClickHandler)
  106. AddClickEvent(self.friend_btn,onBtnClickHandler)
  107. AddClickEvent(self.career_btn,onBtnClickHandler)
  108. AddClickEvent(self.voice2txt_btn,onBtnClickHandler)
  109. AddClickEvent(self.world_voice_btn,onBtnClickHandler)
  110. AddClickEvent(self.around_voice_btn,onBtnClickHandler)
  111. AddClickEvent(self.guild_voice_btn,onBtnClickHandler)
  112. AddClickEvent(self.team_voice_btn,onBtnClickHandler)
  113. AddClickEvent(self.friend_voice_btn,onBtnClickHandler)
  114. AddClickEvent(self.career_voice_btn,onBtnClickHandler)
  115. AddClickEvent(self.auto_play_btn,onBtnClickHandler)
  116. local function onUpdateSetting()
  117. self:SetTotalCheckState()
  118. end
  119. self.update_setting_id = SettingModel:getInstance():Bind(SettingModel.BROADCAST_SETTING_CHANGE,onUpdateSetting)
  120. end
  121. function ChannelSettingView:SetData( )
  122. if self.is_loaded then
  123. self:SetTotalCheckState()
  124. else
  125. self.need_refresh = true
  126. end
  127. end
  128. function ChannelSettingView:SetTotalCheckState()
  129. self.sys_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.SYSTEM) == 1)
  130. self.world_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.WORLD) == 1)
  131. self.near_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.AROUND) == 1)
  132. self.society_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.GUILD) == 1)
  133. self.team_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.TEAM) == 1)
  134. self.friend_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.FRIEND) == 1)
  135. self.career_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.CROSS) == 1)
  136. self.voice2txt_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.TEXTONLY) == 1)
  137. self.world_voice_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.WORLD) == 1)
  138. self.around_voice_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.AROUND) == 1)
  139. self.guild_voice_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.GUILD) == 1)
  140. self.team_voice_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.TEAM) == 1)
  141. self.friend_voice_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.FRIEND) == 1)
  142. self.career_voice_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.CROSS) == 1)
  143. self.auto_play_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.AUTOPLAY) == 1)
  144. end
  145. -- function ChannelSettingView:InitChatVoiceSetting()
  146. -- self.voice2txt_check:SetActive(lua_settingM:GetChatVoiceProperty("textOnly"))
  147. -- self.world_voice_check:SetActive(lua_settingM:GetChatVoiceProperty("world"))
  148. -- self.voice2txt_check:SetActive(lua_settingM:GetChatVoiceProperty("around"))
  149. -- self.voice2txt_check:SetActive(lua_settingM:GetChatVoiceProperty("guild"))
  150. -- self.voice2txt_check:SetActive(lua_settingM:GetChatVoiceProperty("team"))
  151. -- self.voice2txt_check:SetActive(lua_settingM:GetChatVoiceProperty("friend"))
  152. -- self.voice2txt_check:SetActive(lua_settingM:GetChatVoiceProperty("career"))
  153. -- end