70 lines
2.1 KiB
Lua
70 lines
2.1 KiB
Lua
--设置窗口对象
|
||
--author:--
|
||
|
||
local TableBG = import 'Game.Data.TableBG'
|
||
|
||
local SettingView = {}
|
||
|
||
local M = SettingView
|
||
setmetatable(M, { __index = BaseWindow })
|
||
|
||
function SettingView.new(blur_view)
|
||
local self = setmetatable({}, { __index = M })
|
||
self.class = 'SettingView'
|
||
self._currenIndex = 0
|
||
self._blur_view = blur_view
|
||
self.onCallback = event('onCallback', true)
|
||
self.stateIndex = 0
|
||
self.cd_time = 0
|
||
self._btn_dismiss_room_enable = true
|
||
self._close_destroy = true
|
||
self._default_bg = 0
|
||
self:init('ui://Common/SettingWindow1')
|
||
return self
|
||
end
|
||
|
||
function M:init(url)
|
||
BaseWindow.init(self, url)
|
||
|
||
local view = self._view
|
||
local slider_sound = view:GetChild('slider_vedio_sound')
|
||
local slider_music = view:GetChild('slider_vedio_music')
|
||
local btn_music = view:GetChild('btn_vedio_music')
|
||
local btn_sound = view:GetChild('btn_vedio_sound')
|
||
|
||
-- slider_sound.value = GameApplication.Instance.SoundValue
|
||
-- slider_music.value = GameApplication.Instance.MusicValue
|
||
|
||
slider_music.onChanged:Add(function()
|
||
-- GameApplication.Instance.MusicValue = slider_music.value
|
||
-- btn_music.selected = false
|
||
-- GameApplication.Instance.MusicMute = false;
|
||
end)
|
||
|
||
slider_sound.onChanged:Add(function()
|
||
-- GameApplication.Instance.SoundValue = slider_sound.value
|
||
-- btn_sound.selected = false
|
||
-- GameApplication.Instance.SoundMute = false;
|
||
end)
|
||
|
||
btn_sound.onClick:Add(function()
|
||
-- GameApplication.Instance.SoundMute = btn_sound.selected;
|
||
end)
|
||
|
||
btn_music.onClick:Add(function()
|
||
-- GameApplication.Instance.MusicMute = btn_music.selected;
|
||
end)
|
||
|
||
local _btn_logout = self._view:GetChild('btn_closeRoom')
|
||
_btn_logout.onClick:Set(function()
|
||
if self._blur_view.dismiss_room_cd_time > 0 then
|
||
ViewUtil.ErrorTip(nil, "您还处于解散冷却时间当中,请稍后重试!")
|
||
else
|
||
local _gamectr = ControllerManager.GetController(GameController)
|
||
_gamectr:AskDismissRoom()
|
||
end
|
||
end)
|
||
end
|
||
|
||
return M
|