74 lines
2.0 KiB
TypeScript
74 lines
2.0 KiB
TypeScript
import { _decorator, Label, Node, Toggle } from 'cc';
|
|
import { GButton } from '../../Main/Common/GButton';
|
|
import AudioManager from '../../Main/Manager/AudioManager';
|
|
import Utils from '../../Main/Common/Utils';
|
|
import li_BaseView from '../../Main/Common/li_BaseView';
|
|
import PlayerDataManager from '../../Main/Manager/PlayerDataManager';
|
|
import { InnerMsgCode } from '../../Main/Config/InnerMsgCode';
|
|
import { SDKManager } from '../../Main/Channel/SDKManager';
|
|
import SubManager from '../SubManager';
|
|
const { ccclass, property } = _decorator;
|
|
|
|
//GM命令
|
|
@ccclass('GM_UI')
|
|
export class GM_UI extends li_BaseView {
|
|
|
|
private _nodeTab: any = {};
|
|
|
|
onLoad() {
|
|
this._nodeTab = {}
|
|
}
|
|
|
|
start() {
|
|
|
|
Utils.parseNode(this.node, this._nodeTab)
|
|
|
|
GButton.BandClick(this._nodeTab.BtnClose, this.onCloseClick, this);
|
|
GButton.BandClick(this._nodeTab.btnClearCundang, this.onQingdangClick, this);
|
|
|
|
let musicTg: Toggle = this._nodeTab.musicTg.getComponent(Toggle)
|
|
musicTg.isChecked = PlayerDataManager.I.IsMusicOn
|
|
let soudTg: Toggle = this._nodeTab.soudTg.getComponent(Toggle)
|
|
soudTg.isChecked = PlayerDataManager.I.IsSoundOn
|
|
|
|
//GM Log
|
|
let gmLog = this._nodeTab.gmLogLable.getComponent(Label)
|
|
gmLog.string = "GM Log:\n" + SDKManager.GMLogString
|
|
}
|
|
|
|
update(deltaTime: number) {
|
|
|
|
}
|
|
|
|
|
|
//音效开关变化事件 prefab中调用
|
|
onSoundEvent(target: Toggle, arg2) {
|
|
if (target) {
|
|
PlayerDataManager.I.SetSoundOn(target.isChecked)
|
|
}
|
|
}
|
|
|
|
//音乐开关变化事件 prefab中调用
|
|
onMusicEvent(target: Toggle, arg2) {
|
|
if (target) {
|
|
PlayerDataManager.I.SetMusicOn(target.isChecked)
|
|
}
|
|
}
|
|
|
|
|
|
//清除存档
|
|
onQingdangClick() {
|
|
PlayerDataManager.clearAll()
|
|
SubManager.ShowPrompt("清除存档成功")
|
|
}
|
|
|
|
//关闭按钮
|
|
onCloseClick() {
|
|
this.onClose()
|
|
Utils.sendInnerMsg(InnerMsgCode.GM_UI_Close, {id:1})
|
|
}
|
|
|
|
}
|
|
|
|
|