Commit 24a5fae8 authored by wjf's avatar wjf

l

parent f6ecede4
......@@ -48,7 +48,7 @@ import { createData } from '../startScene/StartScene';
import { Loading2 } from '../something/uis/Loading2';
import { BonusTime } from '../something/uis/BonusTime';
import { NetName } from '../../libs/tw/enum/NetName';
import { playGameBg } from '../soundCtrl2';
import { playGameBg, toggleGameBg, getGameBgOn } from '../soundCtrl2';
const aniClass = {
"BoomAni": BoomAni,
......@@ -198,8 +198,6 @@ export default class MainScene extends Scene {
bonusTime: BonusTime;
start(data) {
super.start();
stopBg();
playGameBg();
//初始化索引信息
Tool.init();
//第几关
......@@ -371,9 +369,12 @@ export default class MainScene extends Scene {
this.soundBtn.source = "mainSoundBtnOff_png"
}
if (getBgOn()) {
this.musicBtn.source = "mainMusicBtnOn_png"
this.musicBtn.source = "mainMusicBtnOn_png";
stopBg();
playGameBg();
} else {
this.musicBtn.source = "mainMusicBtnOff_png"
this.musicBtn.source = "mainMusicBtnOff_png";
stopBg();
}
//初始化道具信息
var arrObj = ["boomBtnNum", "hammerBtnNum", "stepBtnNum"];
......@@ -757,8 +758,9 @@ export default class MainScene extends Scene {
}
}
onTap_musicBtn() {
toggleBg();
if (getBgOn()) {
// toggleBg();
toggleGameBg();
if (getGameBgOn()) {
this.musicBtn.source = "mainMusicBtnOn_png"
} else {
this.musicBtn.source = "mainMusicBtnOff_png"
......
let bgOn = true;
let bgChannel: egret.SoundChannel;
let loading = false;
export const getGameBgOn=()=>{
return bgOn
}
export const toggleGameBg = () => {
bgOn = !bgOn;
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