Commit 9a403c19 authored by haiyoucuv's avatar haiyoucuv

init

parent 6b50108c
{"proSetting":{"projectxIDs":{"testId":[{"label":"test","value":"pd71a2911"}],"prodId":[]},"skinVariables":[],"mockSetting":{"projectId":"","pageId":""}},"envSetting":{},"psdSetting":{"psdFSSetting":true,"psdCenterSetting":true}} {"proSetting":{"projectxIDs":{"testId":[{"label":"test","value":"pd71a2911"},{"label":"test2","value":"p960d47b7"}],"prodId":[]},"skinVariables":[],"mockSetting":{"projectId":"","pageId":""}},"envSetting":{},"psdSetting":{"psdFSSetting":true,"psdCenterSetting":true}}
...@@ -14,6 +14,7 @@ import "./base/mix.ts"; ...@@ -14,6 +14,7 @@ import "./base/mix.ts";
import handSvga from "@/assets/svga/3牌子转动.svga"; import handSvga from "@/assets/svga/3牌子转动.svga";
import { initDevtools } from '@pixi/devtools'; import { initDevtools } from '@pixi/devtools';
import { unwatchPageVisibility, watchPageVisibility } from "@/core/page-visibility-notify.ts";
import.meta.env.DEV && initDevtools({}); import.meta.env.DEV && initDevtools({});
export function getApp(): Application { export function getApp(): Application {
...@@ -31,9 +32,11 @@ class Top extends React.Component<any, any> { ...@@ -31,9 +32,11 @@ class Top extends React.Component<any, any> {
async componentDidMount() { async componentDidMount() {
await initBundle(); await initBundle();
await this.initStage(); await this.initStage();
watchPageVisibility(this.pageVisibilityChange);
} }
componentWillUnmount() { componentWillUnmount() {
unwatchPageVisibility(this.pageVisibilityChange);
Tween.removeAllTweens(); Tween.removeAllTweens();
this.app.ticker.remove(this.onUpdate); this.app.ticker.remove(this.onUpdate);
this.game.destroy({ this.game.destroy({
...@@ -43,6 +46,12 @@ class Top extends React.Component<any, any> { ...@@ -43,6 +46,12 @@ class Top extends React.Component<any, any> {
}); });
} }
pageVisibilityChange = (visible) => {
if (visible) {
store.updateIndex();
}
}
async initStage() { async initStage() {
// if (!gameCanvas) { // if (!gameCanvas) {
......
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