Skip to content

Commit

Permalink
Fix/1.1.6 cr (#129)
Browse files Browse the repository at this point in the history
* fix: animation event

* fix: multi scene params interface

* fix: types/matterjs dependencies

* fix: application params options
  • Loading branch information
fanmingfei authored Sep 2, 2021
1 parent be8e37b commit 1332180
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 13 deletions.
12 changes: 6 additions & 6 deletions examples/src/spriteAnimation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ export async function init(canvas) {
);

frame.play(4);
frame.on('onComplete', () => {
console.log('onComplete');
frame.on('complete', () => {
console.log('complete');
});
frame.on('onLoop', () => {
console.log('onLoop');
frame.on('loop', () => {
console.log('loop');
});
frame.on('onFrameChange', () => {
console.log('onFrameChange');
frame.on('frameChange', () => {
console.log('frameChange');
});

game.scene.addChild(cut);
Expand Down
23 changes: 21 additions & 2 deletions packages/eva.js/lib/game/Game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import System from '../core/System';
import Component from '../core/Component';
import { setSystemObserver, initObserver } from '../core/observer';
import EventEmitter from 'eventemitter3';
import type { RendererSystemParams } from 'packages/plugin-renderer/lib/System';


/** eva plugin struct */
export interface PluginStruct {
Expand Down Expand Up @@ -35,7 +35,26 @@ export enum LOAD_SCENE_MODE {
interface LoadSceneParams {
scene: Scene;
mode?: LOAD_SCENE_MODE;
params?: RendererSystemParams;
params?: {
width?: number;
height?: number;
canvas?: HTMLCanvasElement
renderType?: number
autoStart?: boolean;
sharedTicker?: boolean;
sharedLoader?: boolean;
transparent?: boolean;
antialias?: boolean;
preserveDrawingBuffer?: boolean;
resolution?: number;
backgroundColor?: number;
clearBeforeRender?: boolean;
roundPixels?: boolean;
forceFXAA?: boolean;
legacy?: boolean;
autoResize?: boolean;
powerPreference?: "high-performance";
};
}

const triggerStart = (obj: System | Component) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-matterjs/lib/PhysicsSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default class PhysicsSystem extends System<PhysicsSystemParams> {
switch (changed.type) {
case OBSERVER_TYPE.CHANGE: {
if ((changed.component as Transform).parent) {
let physics = changed.gameObject.getComponent(Physics) as Physics;
let physics = changed.gameObject.getComponent(Physics);
if (physics && !physics.body) {
this.engine.add(physics);
}
Expand Down
4 changes: 1 addition & 3 deletions packages/plugin-matterjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
"homepage": "https://eva.js.org",
"dependencies": {
"@eva/eva.js": "1.1.6-alpha.4",
"@types/matter-js": "^0.17.5",
"poly-decomp": "^0.3.0"
},
"devDependencies": {
"@types/matter-js": "^0.17.5"
}
}
2 changes: 1 addition & 1 deletion packages/renderer-adapter/lib/Application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Application as PIXIApplication } from 'pixi.js';
import type { ApplicationOptions } from "pixi.js";

export default class Application extends PIXIApplication {
constructor(params?: ApplicationOptions) {
constructor(params: ApplicationOptions) {
params.autoStart = false;
super(params);
}
Expand Down

0 comments on commit 1332180

Please sign in to comment.