Commit 5b1737e8 authored by wildfirecode's avatar wildfirecode

1

parent 61085011
......@@ -126,7 +126,9 @@ export default class MapScene extends Scene {
this.stage.once(egret.TouchEvent.TOUCH_TAP, () => {
if (!MapScene['firstPlayBgTag']) {
if(getBgOn()) {
playBg();
}
MapScene['firstPlayBgTag'] = true;
}
}, this);
......
let soundOn = true;
if (localStorage.getItem('soundOn') == null) {
soundOn = true;
localStorage.setItem('soundOn', "1");
}
else
soundOn = localStorage.getItem('soundOn') == '1';
let bgOn = true;
if (localStorage.getItem('bgOn') == null) {
bgOn = true;
localStorage.setItem('bgOn', "1");
}
else
bgOn = localStorage.getItem('bgOn') == '1';
let bgChannel: egret.SoundChannel;
let loading = false;
export const getSoundOn = () => {
......@@ -11,14 +25,17 @@ export const getBgOn = () => {
export const toggleSound = () => {
soundOn = !soundOn;
localStorage.setItem('soundOn', soundOn ? "1" : "0")
}
export const toggleBgStatus = ()=>{
export const toggleBgStatus = () => {
bgOn = !bgOn;
localStorage.setItem('bgOn', bgOn ? "1" : "0")
}
export const toggleBg = () => {
bgOn = !bgOn;
localStorage.setItem('bgOn', bgOn ? "1" : "0")
if (bgChannel) {
if (!bgOn) {
bgChannel.stop();
......
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