Commit 4a0c27b0 authored by haiyoucuv's avatar haiyoucuv

init

parent c7efd18e
...@@ -14,7 +14,7 @@ import "./base/mix.ts"; ...@@ -14,7 +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.meta.env.DEV && initDevtools({});
export function getApp(): Application { export function getApp(): Application {
return window["__app"]; return window["__app"];
...@@ -29,9 +29,6 @@ class Top extends React.Component<any, any> { ...@@ -29,9 +29,6 @@ class Top extends React.Component<any, any> {
game: Game = null; game: Game = null;
async componentDidMount() { async componentDidMount() {
import.meta.env.DEV && initDevtools({});
await initBundle(); await initBundle();
await this.initStage(); await this.initStage();
} }
...@@ -39,7 +36,11 @@ class Top extends React.Component<any, any> { ...@@ -39,7 +36,11 @@ class Top extends React.Component<any, any> {
componentWillUnmount() { componentWillUnmount() {
Tween.removeAllTweens(); Tween.removeAllTweens();
this.app.ticker.remove(this.onUpdate); this.app.ticker.remove(this.onUpdate);
this.game.destroy(); this.game.destroy({
children: true,
texture: false,
textureSource: false,
});
} }
async initStage() { async initStage() {
......
import { Container, Ticker } from "pixi.js"; import { Container, Ticker, DestroyOptions } from "pixi.js";
export interface IBase { export interface IBase {
onLoad: () => void, onLoad: () => void,
...@@ -27,12 +27,8 @@ export class Base extends Container implements IBase { ...@@ -27,12 +27,8 @@ export class Base extends Container implements IBase {
} }
destroy() { destroy(options?: DestroyOptions) {
this.onDestroy(); this.onDestroy();
super.destroy({ super.destroy(options);
children: true,
texture: false,
textureSource: false,
});
} }
} }
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