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

174 lines
10 KiB

ChannelSettingView = ChannelSettingView or BaseClass(BaseItem)
function ChannelSettingView:__init()
self.base_file = "setting"
self.layout_file = "channelSettingView"
self.is_delay_callback = true
self.layer_name = "UI"
self.destroy_imm = true
-- self.open_callback = function ()
-- self:SetTotalCheckState()
-- end
self.need_refresh = false
--self.use_local_view = true
self:Load()
end
function ChannelSettingView:__delete()
self:Clear()
end
function ChannelSettingView:Load_callback( )
self:LoadSuccess()
end
function ChannelSettingView:Clear()
if self.update_setting_id then
SettingModel:getInstance():UnBind(self.update_setting_id)
self.update_setting_id = nil
end
end
function ChannelSettingView:LoadSuccess()
--self.closeBtn = self:GetChild("Window/closeBtn").gameObject
self.sys_check = self:GetChild("channelCon/channelBtn1/Background/Checkmark").gameObject
self.world_check = self:GetChild("channelCon/channelBtn2/Background/Checkmark").gameObject
self.near_check = self:GetChild("channelCon/channelBtn3/Background/Checkmark").gameObject
self.society_check = self:GetChild("channelCon/channelBtn4/Background/Checkmark").gameObject
self.team_check = self:GetChild("channelCon/channelBtn5/Background/Checkmark").gameObject
self.friend_check = self:GetChild("channelCon/channelBtn6/Background/Checkmark").gameObject
self.career_check = self:GetChild("channelCon/channelBtn7/Background/Checkmark").gameObject --跨服频道
self.sys_btn = self:GetChild("channelCon/channelBtn1/Background").gameObject
self.world_btn = self:GetChild("channelCon/channelBtn2/Background").gameObject
self.near_btn = self:GetChild("channelCon/channelBtn3/Background").gameObject
self.society_btn = self:GetChild("channelCon/channelBtn4/Background").gameObject
self.team_btn = self:GetChild("channelCon/channelBtn5/Background").gameObject
self.friend_btn = self:GetChild("channelCon/channelBtn6/Background").gameObject
self.career_btn = self:GetChild("channelCon/channelBtn7/Background").gameObject
self.voice2txt_check = self:GetChild("voiceCon/voiceBtn1/Background/Checkmark").gameObject
self.world_voice_check = self:GetChild("voiceCon/voiceBtn2/Background/Checkmark").gameObject
self.around_voice_check = self:GetChild("voiceCon/voiceBtn3/Background/Checkmark").gameObject
self.guild_voice_check = self:GetChild("voiceCon/voiceBtn4/Background/Checkmark").gameObject
self.team_voice_check = self:GetChild("voiceCon/voiceBtn5/Background/Checkmark").gameObject
self.friend_voice_check = self:GetChild("voiceCon/voiceBtn6/Background/Checkmark").gameObject
self.career_voice_check = self:GetChild("voiceCon/voiceBtn7/Background/Checkmark").gameObject --跨服频道
self.voice2txt_btn = self:GetChild("voiceCon/voiceBtn1/Background").gameObject
self.world_voice_btn = self:GetChild("voiceCon/voiceBtn2/Background").gameObject
self.around_voice_btn = self:GetChild("voiceCon/voiceBtn3/Background").gameObject
self.guild_voice_btn = self:GetChild("voiceCon/voiceBtn4/Background").gameObject
self.team_voice_btn = self:GetChild("voiceCon/voiceBtn5/Background").gameObject
self.friend_voice_btn = self:GetChild("voiceCon/voiceBtn6/Background").gameObject
self.career_voice_btn = self:GetChild("voiceCon/voiceBtn7/Background").gameObject
self.auto_play_btn = self:GetChild("wifiBtn/Background").gameObject
self.auto_play_check = self:GetChild("wifiBtn/Background/Checkmark").gameObject
self:InitEvent()
if self.need_refresh then
self:SetTotalCheckState()
end
end
function ChannelSettingView:InitEvent()
local function onBtnClickHandler(target)
-- if target == self.closeBtn then
-- self:Close()
if target == self.sys_btn then
SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.SYSTEM,self.sys_check.activeSelf and 0 or 1)
elseif target == self.world_btn then
SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.WORLD,self.world_check.activeSelf and 0 or 1)
elseif target == self.near_btn then
SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.AROUND,self.near_check.activeSelf and 0 or 1)
elseif target == self.society_btn then
SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.GUILD,self.society_check.activeSelf and 0 or 1)
elseif target == self.team_btn then
SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.TEAM,self.team_check.activeSelf and 0 or 1)
elseif target == self.friend_btn then
SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.FRIEND,self.friend_check.activeSelf and 0 or 1)
elseif target == self.career_btn then
SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.CROSS,self.career_check.activeSelf and 0 or 1)
elseif target == self.voice2txt_btn then
SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.TEXTONLY,self.voice2txt_check.activeSelf and 0 or 1)
elseif target == self.world_voice_btn then
SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.WORLD,self.world_voice_check.activeSelf and 0 or 1)
elseif target == self.around_voice_btn then
SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.AROUND,self.around_voice_check.activeSelf and 0 or 1)
elseif target == self.guild_voice_btn then
SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.GUILD,self.guild_voice_check.activeSelf and 0 or 1)
elseif target == self.team_voice_btn then
SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.TEAM,self.team_voice_check.activeSelf and 0 or 1)
elseif target == self.friend_voice_btn then
SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.FRIEND,self.friend_voice_check.activeSelf and 0 or 1)
elseif target == self.career_voice_btn then
SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.CROSS,self.career_voice_check.activeSelf and 0 or 1)
elseif target == self.auto_play_btn then
SettingModel:getInstance():Fire(SettingModel.RequestSetSubtype,SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.AUTOPLAY,self.auto_play_check.activeSelf and 0 or 1)
end
end
--AddClickEvent(self.closeBtn,onBtnClickHandler)
AddClickEvent(self.sys_btn,onBtnClickHandler)
AddClickEvent(self.world_btn,onBtnClickHandler)
AddClickEvent(self.near_btn,onBtnClickHandler)
AddClickEvent(self.society_btn,onBtnClickHandler)
AddClickEvent(self.team_btn,onBtnClickHandler)
AddClickEvent(self.friend_btn,onBtnClickHandler)
AddClickEvent(self.career_btn,onBtnClickHandler)
AddClickEvent(self.voice2txt_btn,onBtnClickHandler)
AddClickEvent(self.world_voice_btn,onBtnClickHandler)
AddClickEvent(self.around_voice_btn,onBtnClickHandler)
AddClickEvent(self.guild_voice_btn,onBtnClickHandler)
AddClickEvent(self.team_voice_btn,onBtnClickHandler)
AddClickEvent(self.friend_voice_btn,onBtnClickHandler)
AddClickEvent(self.career_voice_btn,onBtnClickHandler)
AddClickEvent(self.auto_play_btn,onBtnClickHandler)
local function onUpdateSetting()
self:SetTotalCheckState()
end
self.update_setting_id = SettingModel:getInstance():Bind(SettingModel.BROADCAST_SETTING_CHANGE,onUpdateSetting)
end
function ChannelSettingView:SetData( )
if self.is_loaded then
self:SetTotalCheckState()
else
self.need_refresh = true
end
end
function ChannelSettingView:SetTotalCheckState()
self.sys_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.SYSTEM) == 1)
self.world_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.WORLD) == 1)
self.near_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.AROUND) == 1)
self.society_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.GUILD) == 1)
self.team_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.TEAM) == 1)
self.friend_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.FRIEND) == 1)
self.career_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.TEXT,SettingModel.SUBTYPE.CROSS) == 1)
self.voice2txt_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.TEXTONLY) == 1)
self.world_voice_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.WORLD) == 1)
self.around_voice_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.AROUND) == 1)
self.guild_voice_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.GUILD) == 1)
self.team_voice_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.TEAM) == 1)
self.friend_voice_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.FRIEND) == 1)
self.career_voice_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.CROSS) == 1)
self.auto_play_check:SetActive(SettingModel:getInstance():GetSettingInfo(SettingModel.TYPE.VOICE,SettingModel.SUBTYPE.AUTOPLAY) == 1)
end
-- function ChannelSettingView:InitChatVoiceSetting()
-- self.voice2txt_check:SetActive(lua_settingM:GetChatVoiceProperty("textOnly"))
-- self.world_voice_check:SetActive(lua_settingM:GetChatVoiceProperty("world"))
-- self.voice2txt_check:SetActive(lua_settingM:GetChatVoiceProperty("around"))
-- self.voice2txt_check:SetActive(lua_settingM:GetChatVoiceProperty("guild"))
-- self.voice2txt_check:SetActive(lua_settingM:GetChatVoiceProperty("team"))
-- self.voice2txt_check:SetActive(lua_settingM:GetChatVoiceProperty("friend"))
-- self.voice2txt_check:SetActive(lua_settingM:GetChatVoiceProperty("career"))
-- end