Commit 24a5fae8 authored by wjf's avatar wjf

l

parent f6ecede4
...@@ -48,7 +48,7 @@ import { createData } from '../startScene/StartScene'; ...@@ -48,7 +48,7 @@ import { createData } from '../startScene/StartScene';
import { Loading2 } from '../something/uis/Loading2'; import { Loading2 } from '../something/uis/Loading2';
import { BonusTime } from '../something/uis/BonusTime'; import { BonusTime } from '../something/uis/BonusTime';
import { NetName } from '../../libs/tw/enum/NetName'; import { NetName } from '../../libs/tw/enum/NetName';
import { playGameBg } from '../soundCtrl2'; import { playGameBg, toggleGameBg, getGameBgOn } from '../soundCtrl2';
const aniClass = { const aniClass = {
"BoomAni": BoomAni, "BoomAni": BoomAni,
...@@ -198,8 +198,6 @@ export default class MainScene extends Scene { ...@@ -198,8 +198,6 @@ export default class MainScene extends Scene {
bonusTime: BonusTime; bonusTime: BonusTime;
start(data) { start(data) {
super.start(); super.start();
stopBg();
playGameBg();
//初始化索引信息 //初始化索引信息
Tool.init(); Tool.init();
//第几关 //第几关
...@@ -371,9 +369,12 @@ export default class MainScene extends Scene { ...@@ -371,9 +369,12 @@ export default class MainScene extends Scene {
this.soundBtn.source = "mainSoundBtnOff_png" this.soundBtn.source = "mainSoundBtnOff_png"
} }
if (getBgOn()) { if (getBgOn()) {
this.musicBtn.source = "mainMusicBtnOn_png" this.musicBtn.source = "mainMusicBtnOn_png";
stopBg();
playGameBg();
} else { } else {
this.musicBtn.source = "mainMusicBtnOff_png" this.musicBtn.source = "mainMusicBtnOff_png";
stopBg();
} }
//初始化道具信息 //初始化道具信息
var arrObj = ["boomBtnNum", "hammerBtnNum", "stepBtnNum"]; var arrObj = ["boomBtnNum", "hammerBtnNum", "stepBtnNum"];
...@@ -757,8 +758,9 @@ export default class MainScene extends Scene { ...@@ -757,8 +758,9 @@ export default class MainScene extends Scene {
} }
} }
onTap_musicBtn() { onTap_musicBtn() {
toggleBg(); // toggleBg();
if (getBgOn()) { toggleGameBg();
if (getGameBgOn()) {
this.musicBtn.source = "mainMusicBtnOn_png" this.musicBtn.source = "mainMusicBtnOn_png"
} else { } else {
this.musicBtn.source = "mainMusicBtnOff_png" this.musicBtn.source = "mainMusicBtnOff_png"
......
let bgOn = true; let bgOn = true;
let bgChannel: egret.SoundChannel; let bgChannel: egret.SoundChannel;
let loading = false; let loading = false;
export const getGameBgOn=()=>{
return bgOn
}
export const toggleGameBg = () => { export const toggleGameBg = () => {
bgOn = !bgOn; bgOn = !bgOn;
if (bgChannel) { if (bgChannel) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment