init
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
import { _decorator, Node, Sprite, Toggle } from 'cc';
|
||||
import { GButton } from '../../Main/Common/GButton';
|
||||
import AudioManager from '../../Main/Manager/AudioManager';
|
||||
import Utils from '../../Main/Common/Utils';
|
||||
import { ViewManager } from '../../Main/Manager/ViewManager';
|
||||
import { InnerMsgCode } from '../../Main/Config/InnerMsgCode';
|
||||
import li_BaseView from '../../Main/Common/li_BaseView';
|
||||
import GameRootUI from '../../Main/Common/GameRootUI';
|
||||
import ResManager from '../../Main/Manager/ResManager';
|
||||
import PlayerDataManager from '../../Main/Manager/PlayerDataManager';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//设置界面
|
||||
@ccclass('Setting_UI')
|
||||
export class Setting extends li_BaseView {
|
||||
private _nodeTab: any = {};
|
||||
private _data;
|
||||
private _musicOn: boolean = true; //音乐开关
|
||||
private _soundOn: boolean = true; //音效开关
|
||||
private tgMusic: Toggle = null;
|
||||
private tgSound: Toggle = null;
|
||||
|
||||
//----重写父类接口---------------------------------------
|
||||
onLoadCT() {
|
||||
this.registerListenner();
|
||||
}
|
||||
openUIDataCT(data: any): void {
|
||||
this._data = data
|
||||
}
|
||||
|
||||
|
||||
registerListenner() {
|
||||
// Utils.addInnerEL(InnerMsgCode.GM_UI_Close, this, this.resiveGMClose)
|
||||
}
|
||||
|
||||
|
||||
start() {
|
||||
Utils.parseNode(this.node, this._nodeTab)
|
||||
|
||||
GButton.BandClick(this._nodeTab.bgmask, ()=>{
|
||||
this.onClose()
|
||||
}, this);
|
||||
GButton.BandClick(this._nodeTab.btnClose, ()=>{
|
||||
this.onClose()
|
||||
}, this);
|
||||
// GButton.BandClick(this._nodeTab.tgMusic, ()=>{
|
||||
// this.onClose()
|
||||
// }, this);
|
||||
// GButton.BandClick(this._nodeTab.tgSound, ()=>{
|
||||
// this.onClose()
|
||||
// }, this);
|
||||
|
||||
this.tgMusic = this._nodeTab.tgMusic.getComponent(Toggle);
|
||||
this.tgSound = this._nodeTab.tgSound.getComponent(Toggle);
|
||||
|
||||
this.tgMusic.isChecked = PlayerDataManager.I.IsMusicOn;
|
||||
this.tgSound.isChecked = PlayerDataManager.I.IsSoundOn;
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
//背景乐开关,在UI里设置
|
||||
onTgMusicClick(tg:any, ev:any) {
|
||||
PlayerDataManager.I.SetMusicOn(this.tgMusic.isChecked)
|
||||
}
|
||||
//音效开关,在UI里设置
|
||||
onTgSoundClick(tg:any, ev:any) {
|
||||
PlayerDataManager.I.SetSoundOn(this.tgSound.isChecked)
|
||||
}
|
||||
|
||||
|
||||
//开始游戏
|
||||
onStartClick() {
|
||||
Utils.Log("点击开始游戏");
|
||||
// GameRootUI.ShowCrossUI()
|
||||
// ResManager.I.goGameScene()
|
||||
}
|
||||
|
||||
//设置
|
||||
onSettingClick() {
|
||||
ViewManager.I.openBundlesView("UI/GM_UI")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user