From 25daff6d8cdea77ac1884877ca166fe592464c5b Mon Sep 17 00:00:00 2001 From: xlj <543978819@qq.com> Date: Thu, 25 Sep 2025 11:20:03 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9F=B3=E9=A2=91=E6=92=AD=E6=94=BEbug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Scenes/MainScene.scene | 2 +- assets/Scripts/Main/Common/GButton.ts | 1 - assets/Scripts/Main/Config/Config18x.ts | 4 + assets/Scripts/Main/Config/Resource.ts | 60 ----- assets/Scripts/Main/Config/Resource.ts.meta | 9 - assets/Scripts/Main/Manager/AudioManager.ts | 228 ++++++++--------- assets/Scripts/Main/Manager/PhysicsManager.ts | 4 +- .../Scripts/Main/Manager/PlayerDataManager.ts | 233 +++++++++--------- assets/Scripts/Main/Manager/ResManager.ts | 41 ++- assets/Scripts/Sub/UI/PreloadUI.ts | 5 +- .../chat18x/ui/panels/PersonalPanel.ts | 8 - .../Scripts/chat18x/ui/panels/SettingPanel.ts | 2 + .../{xzg_422653.mp3 => sound/mainBGM.mp3} | Bin .../mainBGM.mp3.meta} | 0 14 files changed, 270 insertions(+), 327 deletions(-) delete mode 100644 assets/Scripts/Main/Config/Resource.ts delete mode 100644 assets/Scripts/Main/Config/Resource.ts.meta rename assets/resources/{xzg_422653.mp3 => sound/mainBGM.mp3} (100%) rename assets/resources/{xzg_422653.mp3.meta => sound/mainBGM.mp3.meta} (100%) diff --git a/assets/Scenes/MainScene.scene b/assets/Scenes/MainScene.scene index c59d14cb..702e31ac 100644 --- a/assets/Scenes/MainScene.scene +++ b/assets/Scenes/MainScene.scene @@ -2290,7 +2290,7 @@ "__id__": 44 }, "_children": [], - "_active": true, + "_active": false, "_components": [ { "__id__": 64 diff --git a/assets/Scripts/Main/Common/GButton.ts b/assets/Scripts/Main/Common/GButton.ts index fee1e402..2312858a 100644 --- a/assets/Scripts/Main/Common/GButton.ts +++ b/assets/Scripts/Main/Common/GButton.ts @@ -1,5 +1,4 @@ import { _decorator, Button, EventTouch, Node, Vec3 } from "cc"; -import AudioManager from "../Manager/AudioManager"; const { ccclass, property } = _decorator; let _vec3 = new Vec3(); diff --git a/assets/Scripts/Main/Config/Config18x.ts b/assets/Scripts/Main/Config/Config18x.ts index fc68b874..f5c9983b 100644 --- a/assets/Scripts/Main/Config/Config18x.ts +++ b/assets/Scripts/Main/Config/Config18x.ts @@ -4,4 +4,8 @@ Lock, UnKnown, } + + export enum AudioConfig { + MainBGM = "sound/mainBGM", + } } diff --git a/assets/Scripts/Main/Config/Resource.ts b/assets/Scripts/Main/Config/Resource.ts deleted file mode 100644 index 2e770f86..00000000 --- a/assets/Scripts/Main/Config/Resource.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { _decorator } from "cc"; -import Utils from "../Common/Utils"; - -const { ccclass, property } = _decorator; - -//配置表管理器 -@ccclass('Resource') -export default class Resource { - - static instance: Resource = null; - private _config = {};//策划数值表 - - static getInstance() { - if (!this.instance) this.init(); - return this.instance; - } - //初始化 - static init() { - if (!this.instance) { - this.instance = new Resource(); - (window as any).Resource = this; - } - } - - /**加载子包时添加 */ - static addSubJsonConfig(name, tab) { - let _instance = this.getInstance(); - if (!_instance._config) _instance._config = {}; - if (!_instance._config[name]) _instance._config[name] = {}; - let json_SS, json_key1, json_key2 - for (const key in tab) { - json_SS = tab[key]; - if (!json_key1){ - json_key1 = json_SS.id ? "id" : "ID" //默认用id - } - json_key2 = json_SS[json_key1] - _instance._config[name][json_key2] = json_SS; - } - } - - /** - * 获取表数据 - * @param table 表名 - */ - static getConfig(table: string) { - if (!table) { - Utils.Log('策划数值表名为空!', table); - return null; - } - let _instance = this.getInstance(); - if (!_instance._config) _instance._config = {}; - if (!_instance._config[table]) { - // _instance._config[table] = {}; - Utils.Error("配置表未找到:", table) - return null; - } - let config_D = _instance._config[table]; - return config_D; - } -} \ No newline at end of file diff --git a/assets/Scripts/Main/Config/Resource.ts.meta b/assets/Scripts/Main/Config/Resource.ts.meta deleted file mode 100644 index 0ae19c35..00000000 --- a/assets/Scripts/Main/Config/Resource.ts.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "4.0.24", - "importer": "typescript", - "imported": true, - "uuid": "34d91d70-8aac-44b4-9b4a-1a60185b2235", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/Scripts/Main/Manager/AudioManager.ts b/assets/Scripts/Main/Manager/AudioManager.ts index df8935bb..319654ab 100644 --- a/assets/Scripts/Main/Manager/AudioManager.ts +++ b/assets/Scripts/Main/Manager/AudioManager.ts @@ -1,129 +1,133 @@ -import { _decorator, Node, AudioClip, AudioSource, director, assetManager } from "cc"; +import { + _decorator, + Node, + AudioClip, + AudioSource, + director, + assetManager, +} from "cc"; import PlayerDataManager from "./PlayerDataManager"; import ResManager from "./ResManager"; -import Resource from "../Config/Resource"; import { logger } from "db://assets/Scripts/Main/Common/Logger"; +import { Config18x } from "../Config/Config18x"; const { ccclass, property } = _decorator; //音频管理器 -@ccclass('AudioManager') +@ccclass("AudioManager") export default class AudioManager { + private _audoSource: AudioSource; + private curBgId: string; //当前播放中的背景乐id 用于记录 + private lastBgId: string; //上次播放的背景乐id 用于音乐开关切换时播放 + private curBgId_confirm: string; //当前播放中的背景乐id 实际播放 - private _audoSource: AudioSource; - private curBgId: number = -1; //当前播放中的背景乐id 用于记录 - private lastBgId: number = -1; //上次播放的背景乐id 用于音乐开关切换时播放 - private curBgId_confirm: number = -1; //当前播放中的背景乐id 实际播放 + private static _I: AudioManager = null; + public static get I(): AudioManager { + if (!AudioManager._I) { + AudioManager._I = new AudioManager(); + AudioManager._I.init(); + } + return AudioManager._I; + } + private init() { + let audioMgr = new Node(); + audioMgr.name = "__audioMgr__"; + director.getScene().addChild(audioMgr); + director.addPersistRootNode(audioMgr); + this._audoSource = audioMgr.addComponent(AudioSource); + } - private static _I: AudioManager = null; - public static get I(): AudioManager { - if (!AudioManager._I) { - AudioManager._I = new AudioManager(); - AudioManager._I.init(); + /**播放音效 */ + PlayEffect(sound: string, volume: number = 1.0) { + if (!sound) return; + if (!PlayerDataManager.I.IsSoundOn) { + return; + } + + //let cfgs = + //if (!cfgs[sound]) return; + + //let path = `Sound/${cfgs[sound].AssetName}` + logger.log("PlayEffect:", sound); + ResManager.I.getAudio(sound, (res: AudioClip) => { + this._audoSource.playOneShot(res, volume); + }); + } + + /**播放背景乐 */ + PlayMusic(sound: string, loop: boolean = true, volume: number = 1.0) { + if (!sound || sound == this.curBgId_confirm) return; + + //let cfgs = Resource.getConfig("Music") + //if (!cfgs[sound]) return; + + this.lastBgId = sound; + + if (!PlayerDataManager.I.IsMusicOn) { + return; //这个放在记录后面判断,防止开关打开时,没有记录 + } + + this.StopMusic(); + this.curBgId = sound; + this.curBgId_confirm = sound; + //let path = `Music/${cfgs[sound].AssetName}` + logger.log("PlayMusic:", sound); + ResManager.I.getAudio(sound, (res: AudioClip) => { + this._audoSource.clip = res; + this._audoSource.play(); + this._audoSource.volume = volume; + this._audoSource.loop = loop; + }); + } + + /**播放远程背景乐 */ + PlayRemoteMusic(url, loop: boolean = true, volume: number = 1.0) { + logger.log(`下载远程背景乐: url= ${url}`); + assetManager.loadRemote( + url, + { ext: ".mp3" }, + (err, res: AudioClip) => { + if (err) { + logger.log(err); + return; } - return AudioManager._I; + logger.log(`播放远程背景乐: res= ${res}`); + this.StopMusic(); + this._audoSource.clip = res; + this._audoSource.play(); + this._audoSource.volume = volume; + this._audoSource.loop = loop; + } + ); + } + + /**停止播放背景乐 */ + StopMusic() { + if (this.curBgId != null) { + this.lastBgId = this.curBgId; } + this._audoSource.stop(); + this.curBgId = null; + this.curBgId_confirm = null; + } - private init(){ - let audioMgr = new Node(); - audioMgr.name = '__audioMgr__'; - director.getScene().addChild(audioMgr); - director.addPersistRootNode(audioMgr); - this._audoSource = audioMgr.addComponent(AudioSource); - } + // 重新播放背景乐 + ReplayMusic(): boolean { + if (this.curBgId != null) return false; + if (this.lastBgId == null) return false; - - /**播放音效 */ - PlayEffect(sound, volume:number=1.0) { - if (!sound) return; - if (!PlayerDataManager.I.IsSoundOn) { - return; - } - - let cfgs = Resource.getConfig("Sound") - if (!cfgs[sound]) return; + this.PlayMusic(this.lastBgId); + return true; + } - let path = `Sound/${cfgs[sound].AssetName}` - logger.log("PlayEffect:", sound, path) - ResManager.I.getBundleAudio(path, (res: AudioClip)=>{ - this._audoSource.playOneShot(res, volume) - }); - } + /**暂停播放背景乐 */ + PauseMusic() { + this._audoSource.pause(); + } - - /**播放背景乐 */ - PlayMusic(sound, loop:boolean = true, volume:number=1.0) { - if (!sound || sound == this.curBgId_confirm) return; - - let cfgs = Resource.getConfig("Music") - if (!cfgs[sound]) return; - - this.lastBgId = sound; - - if (!PlayerDataManager.I.IsMusicOn) { - return; //这个放在记录后面判断,防止开关打开时,没有记录 - } - - this.StopMusic() - this.curBgId = sound; - this.curBgId_confirm = sound; - let path = `Music/${cfgs[sound].AssetName}` - logger.log("PlayMusic:", sound, path) - ResManager.I.getBundleAudio(path, (res: AudioClip)=>{ - this._audoSource.clip = res - this._audoSource.play() - this._audoSource.volume = volume - this._audoSource.loop = loop - }); - } - - - /**播放远程背景乐 */ - PlayRemoteMusic(url, loop:boolean = true, volume:number=1.0) { - logger.log(`下载远程背景乐: url= ${url}`) - assetManager.loadRemote(url, { ext: '.mp3'}, (err, res: AudioClip) => { - if (err) { - logger.log(err); - return - } - logger.log(`播放远程背景乐: res= ${res}`) - this.StopMusic() - this._audoSource.clip = res - this._audoSource.play() - this._audoSource.volume = volume - this._audoSource.loop = loop - }) - - } - - - /**停止播放背景乐 */ - StopMusic(){ - this._audoSource.stop() - this.curBgId = -1 - this.curBgId_confirm = -1 - } - - // 重新播放背景乐 - ReplayMusic(){ - if (this.curBgId > -1) - return - if (this.lastBgId < 0) - return - - this.PlayMusic(this.lastBgId) - } - - /**暂停播放背景乐 */ - PauseMusic(){ - this._audoSource.pause() - } - - - /**继续播放背景乐 */ - ResumeMusic(){ - this._audoSource.play() - } - -} \ No newline at end of file + /**继续播放背景乐 */ + ResumeMusic() { + this._audoSource.play(); + } +} diff --git a/assets/Scripts/Main/Manager/PhysicsManager.ts b/assets/Scripts/Main/Manager/PhysicsManager.ts index ca34e1c5..d5a5a61c 100644 --- a/assets/Scripts/Main/Manager/PhysicsManager.ts +++ b/assets/Scripts/Main/Manager/PhysicsManager.ts @@ -1,7 +1,5 @@ import { _decorator, Node, AudioClip, AudioSource, director, PhysicsSystem2D, EPhysics2DDrawFlags, Vec2, PHYSICS_2D_PTM_RATIO, v2 } from "cc"; -import PlayerDataManager from "./PlayerDataManager"; -import ResManager from "./ResManager"; -import Resource from "../Config/Resource"; + const { ccclass, property } = _decorator; diff --git a/assets/Scripts/Main/Manager/PlayerDataManager.ts b/assets/Scripts/Main/Manager/PlayerDataManager.ts index 716960b9..df817cbd 100644 --- a/assets/Scripts/Main/Manager/PlayerDataManager.ts +++ b/assets/Scripts/Main/Manager/PlayerDataManager.ts @@ -4,127 +4,140 @@ import { CommonConfig } from "../Config/CommonConfig"; import AudioManager from "./AudioManager"; import { logger } from "db://assets/Scripts/Main/Common/Logger"; -const { ccclass, property } = _decorator; +const { ccclass } = _decorator; -@ccclass('PlayerDataManager') +@ccclass("PlayerDataManager") export default class PlayerDataManager { - private static _I: PlayerDataManager = null; - public static get I(): PlayerDataManager { - if (!PlayerDataManager._I) { - PlayerDataManager._I = new PlayerDataManager(); - PlayerDataManager._I.init() - } - return PlayerDataManager._I; + private static _I: PlayerDataManager = null; + public static get I(): PlayerDataManager { + if (!PlayerDataManager._I) { + PlayerDataManager._I = new PlayerDataManager(); + PlayerDataManager._I.init(); } + return PlayerDataManager._I; + } - private isShakeOn: boolean = true; //震动 - private isMusicOn: boolean = true; //音乐 - private isSoundOn: boolean = true; //音效 - private guideMainFinished: boolean = false; //主界面引导是否完成 - private guideTalkFinished: boolean = false; //聊天界面引导是否完成 + private isShakeOn: boolean = true; //震动 + private isMusicOn: boolean = true; //音乐 + private isSoundOn: boolean = true; //音效 + private guideMainFinished: boolean = false; //主界面引导是否完成 + private guideTalkFinished: boolean = false; //聊天界面引导是否完成 + public get IsShakeOn(): boolean { + return this.isShakeOn; + } + public get IsMusicOn(): boolean { + return this.isMusicOn; + } + public get IsSoundOn(): boolean { + return this.isSoundOn; + } + public get GuideMainFinished(): boolean { + return this.guideMainFinished; + } + public get GuideTalkFinished(): boolean { + return this.guideTalkFinished; + } - public get IsShakeOn() : boolean {return this.isShakeOn;} - public get IsMusicOn() : boolean {return this.isMusicOn;} - public get IsSoundOn() : boolean {return this.isSoundOn;} - public get GuideMainFinished() : boolean {return this.guideMainFinished;} - public get GuideTalkFinished() : boolean {return this.guideTalkFinished;} + private init() { + this.InitPlayerData(); + } + public initEmpty() {} + private InitPlayerData() { + // this.isShakeOn = PlayerDataManager.getForKey(CommonConfig.StorageConfig.SETTING_SHAKEON, true) + this.isMusicOn = PlayerDataManager.getForKey( + CommonConfig.StorageConfig.SETTING_MUSIC, + true + ); + this.isSoundOn = PlayerDataManager.getForKey( + CommonConfig.StorageConfig.SETTING_SOUND, + true + ); + this.guideMainFinished = PlayerDataManager.getForKey( + CommonConfig.StorageConfig.GUIDE_MAIN, + false + ); + this.guideTalkFinished = PlayerDataManager.getForKey( + CommonConfig.StorageConfig.GUIDE_TALK, + false + ); + logger.log( + "InitPlayerData", + `music=${this.isMusicOn}, sound=${this.isSoundOn}, guideMain=${this.guideMainFinished}, guideTalk=${this.guideTalkFinished}` + ); + } - private init(){ - this.InitPlayerData(); - } - public initEmpty(){ - + public SetMusicOn(bo: boolean) { + if (this.isMusicOn == bo) return; + this.isMusicOn = bo; + PlayerDataManager.setForKey(CommonConfig.StorageConfig.SETTING_MUSIC, bo); + if (bo) { + AudioManager.I.ReplayMusic(); + } else AudioManager.I.StopMusic(); + } + + public SetSoundOn(bo: boolean) { + if (this.isSoundOn == bo) return; + this.isSoundOn = bo; + PlayerDataManager.setForKey(CommonConfig.StorageConfig.SETTING_SOUND, bo); + } + + /**主界面引导完成*/ + public SetGuideMainFinish(bo: boolean) { + if (this.guideMainFinished == bo) return; + this.guideMainFinished = bo; + PlayerDataManager.setForKey(CommonConfig.StorageConfig.GUIDE_MAIN, bo); + } + /**聊天界面引导完成*/ + public SetGuideTalkFinish(bo: boolean) { + if (this.guideTalkFinished == bo) return; + this.guideTalkFinished = bo; + PlayerDataManager.setForKey(CommonConfig.StorageConfig.GUIDE_TALK, bo); + } + + /** + * 类型内部处理,外层部分类型 isBindingId //标识位数据需要绑定 playerid的时候,默认值为 true,若是传 false,则不进入绑定 + * */ + static setForKey(key: number | string, data) { + if (!key || void 0 === data) { + Utils.Log("key can`t nil"); + return; } + key = key + ""; + sys.localStorage.setItem(key, JSON.stringify(data)); + } - - private InitPlayerData() { - // this.isShakeOn = PlayerDataManager.getForKey(CommonConfig.StorageConfig.SETTING_SHAKEON, true) - this.isMusicOn = PlayerDataManager.getForKey(CommonConfig.StorageConfig.SETTING_MUSIC, true) - this.isSoundOn = PlayerDataManager.getForKey(CommonConfig.StorageConfig.SETTING_SOUND, true) - this.guideMainFinished = PlayerDataManager.getForKey(CommonConfig.StorageConfig.GUIDE_MAIN, false) - this.guideTalkFinished = PlayerDataManager.getForKey(CommonConfig.StorageConfig.GUIDE_TALK, false) - logger.log("InitPlayerData", `music=${this.isMusicOn}, sound=${this.isSoundOn}, guideMain=${this.guideMainFinished}, guideTalk=${this.guideTalkFinished}`) + static getForKey(key: number | string, defaultVal): any { + if (!key) { + Utils.Log("key can`t nil"); + return; } - - - public SetMusicOn(bo: boolean) { - if (this.isMusicOn == bo) - return - this.isMusicOn = bo - PlayerDataManager.setForKey(CommonConfig.StorageConfig.SETTING_MUSIC, bo) - if (bo) - AudioManager.I.ReplayMusic() - else - AudioManager.I.StopMusic() + key = key + ""; + let jsonObj; + try { + let str = sys.localStorage.getItem(key); + try { + jsonObj = JSON.parse(str); + } catch (error) { + jsonObj = str; + } + } catch (error) { + Utils.Log(`getForKey--->>>解析${key}的值的时候报错`); } + if (jsonObj == null) { + jsonObj = defaultVal; + } + return jsonObj; + } - public SetSoundOn(bo: boolean) { - if (this.isSoundOn == bo) - return - this.isSoundOn = bo - PlayerDataManager.setForKey(CommonConfig.StorageConfig.SETTING_SOUND, bo) - } + static removeForKey(key: number | string): void { + key = key + ""; + sys.localStorage.setItem(key, ""); + } - /**主界面引导完成*/ - public SetGuideMainFinish(bo: boolean) { - if (this.guideMainFinished == bo) - return - this.guideMainFinished = bo - PlayerDataManager.setForKey(CommonConfig.StorageConfig.GUIDE_MAIN, bo) - } - /**聊天界面引导完成*/ - public SetGuideTalkFinish(bo: boolean) { - if (this.guideTalkFinished == bo) - return - this.guideTalkFinished = bo - PlayerDataManager.setForKey(CommonConfig.StorageConfig.GUIDE_TALK, bo) - } - - - /** - * 类型内部处理,外层部分类型 isBindingId //标识位数据需要绑定 playerid的时候,默认值为 true,若是传 false,则不进入绑定 - * */ - static setForKey(key: number | string, data) { - if (!key || void (0) === data) { - Utils.Log("key can`t nil"); - return; - } - key = key + ""; - sys.localStorage.setItem(key, JSON.stringify(data)); - } - - static getForKey(key: number | string, defaultVal): any { - if (!key) { - Utils.Log("key can`t nil"); - return; - } - key = key + ""; - let jsonObj; - try { - let str = sys.localStorage.getItem(key); - try { - jsonObj = JSON.parse(str); - } catch (error) { - jsonObj = str; - } - } catch (error) { - Utils.Log(`getForKey--->>>解析${key}的值的时候报错`); - } - if (jsonObj == null){ - jsonObj = defaultVal; - } - return jsonObj; - } - - static removeForKey(key: number | string): void { - key = key + ""; - sys.localStorage.setItem(key, ""); - } - - /**清档 */ - static clearAll(): void { - sys.localStorage.clear(); - } -} \ No newline at end of file + /**清档 */ + static clearAll(): void { + sys.localStorage.clear(); + } +} diff --git a/assets/Scripts/Main/Manager/ResManager.ts b/assets/Scripts/Main/Manager/ResManager.ts index b2dec6a9..5a2107db 100644 --- a/assets/Scripts/Main/Manager/ResManager.ts +++ b/assets/Scripts/Main/Manager/ResManager.ts @@ -307,28 +307,25 @@ export default class ResManager { } /** 加载bundle中的音频文件*/ - getBundleAudio(url: string, cb) { - let bundle = assetManager.getBundle("Audio"); - if (bundle) { - bundle.load(url, AudioClip, (err, res: AudioClip) => { - if (err) { - logger.log(err); - return; - } - cb && cb(res); - }); - } else { - assetManager.loadBundle( - "Audio", - (err: Error, _bundle: AssetManager.Bundle) => { - if (err) { - logger.log(err); - return; - } - this.getBundleAudio(url, cb); - } - ); - } + getAudio(url: string, cb) { + //let bundle = assetManager.getBundle("Audio"); + // if (bundle) { + // bundle.load(url, AudioClip, (err, res: AudioClip) => { + // if (err) { + // logger.log(err); + // return; + // } + // cb && cb(res); + // }); + // } else { + resources.load(url, AudioClip, (err, res: AudioClip) => { + if (err) { + logger.log(err); + return; + } + cb && cb(res); + }); + //} } /** 加载bundle中的配置表*/ diff --git a/assets/Scripts/Sub/UI/PreloadUI.ts b/assets/Scripts/Sub/UI/PreloadUI.ts index 930bc003..332d6e26 100644 --- a/assets/Scripts/Sub/UI/PreloadUI.ts +++ b/assets/Scripts/Sub/UI/PreloadUI.ts @@ -19,7 +19,6 @@ import { } from "cc"; import { GButton } from "../../Main/Common/GButton"; import ResManager from "../../Main/Manager/ResManager"; -import Resource from "../../Main/Config/Resource"; import { SDKManager } from "../../Main/Channel/SDKManager"; import HttpUnit from "../../Main/Common/HttpUnit"; import GlobalValue from "../../Main/Common/GlobalValue"; @@ -47,6 +46,8 @@ import { ViewManager } from "../../Main/Manager/ViewManager"; import { MainScene } from "../MainScene"; import { prodConfig } from "../../chat18x/config/env/prod"; import { logger } from "db://assets/Scripts/Main/Common/Logger"; +import AudioManager from "../../Main/Manager/AudioManager"; +import { Config18x } from "../../Main/Config/Config18x"; const { ccclass, property } = _decorator; @@ -109,6 +110,8 @@ export class PreloadUI extends Component { // 设备号 DeviceIdService.I.init(); + AudioManager.I.PlayMusic(Config18x.AudioConfig.MainBGM); + SDKManager.init(); this.preloadFiles(); diff --git a/assets/Scripts/chat18x/ui/panels/PersonalPanel.ts b/assets/Scripts/chat18x/ui/panels/PersonalPanel.ts index 1b239b73..bd257dd4 100644 --- a/assets/Scripts/chat18x/ui/panels/PersonalPanel.ts +++ b/assets/Scripts/chat18x/ui/panels/PersonalPanel.ts @@ -1,25 +1,17 @@ import { _decorator, - Component, - Node, Label, Sprite, - Button, - tween, - Vec3, } from "cc"; import Utils from "../../../Main/Common/Utils"; import li_BaseView from "../../../Main/Common/li_BaseView"; import { GButton } from "../../../Main/Common/GButton"; -import PlayerDataManager from "../../../Main/Manager/PlayerDataManager"; import { DataManager, DataId } from "../../data/DataManager"; import { PlayerData } from "../../data/PlayerData"; import { AccountData } from "../../data/AccountData"; import { WalletData } from "../../data/WalletData"; import LanguageUtils, { - LanguageType, } from "../../../Main/Common/LanguageUtils"; -import AudioManager from "../../../Main/Manager/AudioManager"; import { NavigationManager, PageTransitionType, diff --git a/assets/Scripts/chat18x/ui/panels/SettingPanel.ts b/assets/Scripts/chat18x/ui/panels/SettingPanel.ts index 0e130ab9..09290644 100644 --- a/assets/Scripts/chat18x/ui/panels/SettingPanel.ts +++ b/assets/Scripts/chat18x/ui/panels/SettingPanel.ts @@ -18,6 +18,7 @@ import LanguageUtils, { import AudioManager from "../../../Main/Manager/AudioManager"; import PlayerDataManager from "../../../Main/Manager/PlayerDataManager"; import { NavigationManager } from "../../manager/NavigationManager"; +import { Config18x } from "../../../Main/Config/Config18x"; const { ccclass, property } = _decorator; interface LanguageButton { @@ -190,6 +191,7 @@ export class SettingPanel extends li_BaseView { switchMusic() { const currentState = PlayerDataManager.I.IsMusicOn; PlayerDataManager.I.SetMusicOn(!currentState); + this.updateAudioButtonStates(); } diff --git a/assets/resources/xzg_422653.mp3 b/assets/resources/sound/mainBGM.mp3 similarity index 100% rename from assets/resources/xzg_422653.mp3 rename to assets/resources/sound/mainBGM.mp3 diff --git a/assets/resources/xzg_422653.mp3.meta b/assets/resources/sound/mainBGM.mp3.meta similarity index 100% rename from assets/resources/xzg_422653.mp3.meta rename to assets/resources/sound/mainBGM.mp3.meta