Commit 2eb8b77b authored by wildfirecode's avatar wildfirecode

1

parent 20ed613c
...@@ -35,6 +35,8 @@ import MainScene from "../../src/mainScene/MainScene"; ...@@ -35,6 +35,8 @@ import MainScene from "../../src/mainScene/MainScene";
import { Loading2 } from "../../src/something/uis/Loading2"; import { Loading2 } from "../../src/something/uis/Loading2";
import Box2Panel from "../../src/panels/Box2Panel"; import Box2Panel from "../../src/panels/Box2Panel";
import Prize2Panel from "../../src/panels/Prize2Panel"; import Prize2Panel from "../../src/panels/Prize2Panel";
import { stopBg, playBg, getBgOn } from "../../src/soundCtrl";
import { stopGamebg, playGameBg } from "../../src/soundCtrl2";
export default class MainBase extends eui.UILayer { export default class MainBase extends eui.UILayer {
constructor() { constructor() {
...@@ -283,5 +285,23 @@ export default class MainBase extends eui.UILayer { ...@@ -283,5 +285,23 @@ export default class MainBase extends eui.UILayer {
}); });
document.addEventListener("visibilitychange", ()=> {
if (document.visibilityState == "visible") {
if(getBgOn()){
if(SceneCtrl.instance.currentScene instanceof MapScene)
playBg();
else if(SceneCtrl.instance.currentScene instanceof MainScene)
playGameBg();
}
}
if (document.visibilityState == "hidden") {
stopBg();
stopGamebg();
}
})
} }
} }
\ No newline at end of file
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
"num": 10 "num": 10
} }
], ],
"remainEnargy": 0, "remainEnargy": 10,
"askForEnergy": false, "askForEnergy": false,
"canReceiveTreasureBoxNum": 10, "canReceiveTreasureBoxNum": 10,
"nextRangeStarsNum": 150 "nextRangeStarsNum": 150
......
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