12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- import { _decorator, Component, Node } from 'cc';
- import { AudioManager } from 'db://assets/script/Manager/AudioMgr';
- import { User } from 'db://assets/script/Manager/LocalDataMgr';
- const { ccclass, property } = _decorator;
- @ccclass('page_set')
- export class page_set extends Component {
- @property(Node)
- yinxiao_kai: Node = null
- @property(Node)
- yinxiao_guan: Node = null
- @property(Node)
- yinyue_guan: Node = null
- @property(Node)
- yinyue_kai: Node = null
- protected start(): void {
- if (User.userData.sound) {
- this.yinxiao_kai.active = false
- this.yinxiao_guan.active = true
- } else {
- this.yinxiao_kai.active = true
- this.yinxiao_guan.active = false
- }
- if (User.userData.music) {
- this.yinyue_kai.active = false
- this.yinyue_guan.active = true
- } else {
- this.yinyue_kai.active = true
- this.yinyue_guan.active = false
- }
- }
- OnClickYinxiao() {
- AudioManager.instance.playBundleAudio("button")
- if (User.userData.sound) {
- User.setUserData({ sound: false })
- AudioManager.instance.yinxiaoValue = 0
- this.yinxiao_kai.active = true
- this.yinxiao_guan.active = false
- } else {
- User.setUserData({ sound: true })
- AudioManager.instance.yinxiaoValue = 1
- this.yinxiao_kai.active = false
- this.yinxiao_guan.active = true
- }
- }
- OnClickYinyue() {
- AudioManager.instance.playBundleAudio("button")
- if (User.userData.music) {
- User.setUserData({ music: false })
- AudioManager.instance.yinyueValue = 0
- this.yinyue_kai.active = true
- this.yinyue_guan.active = false
- AudioManager.instance.stop()
- } else {
- AudioManager.instance.playBgm("bgm");
- User.setUserData({ music: true })
- AudioManager.instance.yinyueValue = 1
- this.yinyue_kai.active = false
- this.yinyue_guan.active = true
- }
- }
- OnClickBack() {
- AudioManager.instance.playBundleAudio("button")
- this.node.destroy()
- }
- }
|