This commit is contained in:
2026-07-14 11:44:07 +08:00
commit 4409c7b031
5906 changed files with 6959792 additions and 0 deletions
+95
View File
@@ -0,0 +1,95 @@
import { _decorator, Button, Component, Label, Node, Tween, tween, Vec3 } from 'cc';
import { LocalSaveMgr } from '../framework/data/LocalSaveMgr';
import { UIManager } from '../framework/ui/UIManager';
import { UISwitcher } from '../framework/ui/UISwitcher';
import { AudioMgr } from '../framework/audio/AudioMgr';
import { PanelBase } from '../framework/ui/PanelBase';
import { AssetController } from '../AssetController';
import { GameController } from '../GameController';
const { ccclass, property } = _decorator;
@ccclass('SettingPanel')
export class SettingPanel extends PanelBase {
static instance: SettingPanel;
@property({ type: Button })
restartBtn: Button = null;
@property({ type: Button })
closeBtn: Button = null;
@property({ type: Button })
toMainBtn: Button = null;
@property({ type: UISwitcher })
soundSwitcher: UISwitcher = null;
@property({ type: UISwitcher })
musicSwitcher: UISwitcher = null;
@property({ type: Node })
music: Node = null;
@property({ type: Node })
sound: Node = null;
onLoad() {
SettingPanel.instance = this;
this.closeBtn.node.on(Button.EventType.CLICK, this.closeBtnCallBack, this);
this.restartBtn.node.on(Button.EventType.CLICK, this.restartCallBack, this);
this.toMainBtn.node.on(Button.EventType.CLICK, this.toMainCallBack, this);
this.node.active = false;
this.soundSwitcher.addCallBack(this.soundCallBack)
this.musicSwitcher.addCallBack(this.musicCallBack)
}
restartCallBack() {
AudioMgr.inst.playOneShot(AssetController.instance.click)
GameController.getInstance().gameRestart()
}
toMainCallBack() {
AudioMgr.inst.playOneShot(AssetController.instance.click)
GameController.getInstance().backMain()
}
soundCallBack() {
AudioMgr.inst.playOneShot(AssetController.instance.click)
LocalSaveMgr.instance.activeSound(SettingPanel.instance.soundSwitcher.value)
}
musicCallBack() {
AudioMgr.inst.playOneShot(AssetController.instance.click)
console.log("musicCallBack")
LocalSaveMgr.instance.activeMusic(SettingPanel.instance.musicSwitcher.value)
}
refresh() {
GameController.getInstance().curLevel.pause()
}
protected onOpen(): void {
SettingPanel.instance.refresh()
SettingPanel.instance.soundSwitcher.SetValue(!LocalSaveMgr.instance.playerData.muteSound)
SettingPanel.instance.musicSwitcher.SetValue(!LocalSaveMgr.instance.playerData.muteMusic)
}
closeBtnCallBack(button: Button) {
GameController.getInstance().curLevel.ContinueRun()
AudioMgr.inst.playOneShot(AssetController.instance.click)
// AudioMgr.inst.playOneShot(AssetController.instance.click)
UIManager.instance.closePanel(SettingPanel)
}
start() {
}
}