iupdatable无法判断接口 去除改为component支持
This commit is contained in:
13
demo/libs/framework/framework.d.ts
vendored
13
demo/libs/framework/framework.d.ts
vendored
@@ -205,6 +205,7 @@ declare abstract class Component extends egret.DisplayObjectContainer {
|
||||
onEnabled(): void;
|
||||
onDisabled(): void;
|
||||
debugRender(): void;
|
||||
update(): void;
|
||||
onEntityTransformChanged(comp: TransformComponent): void;
|
||||
registerComponent(): void;
|
||||
deregisterComponent(): void;
|
||||
@@ -258,11 +259,6 @@ declare enum TransformComponent {
|
||||
scale = 1,
|
||||
position = 2
|
||||
}
|
||||
interface IUpdatable {
|
||||
enabled: boolean;
|
||||
updateOrder: number;
|
||||
update(): any;
|
||||
}
|
||||
declare class Scene extends egret.DisplayObjectContainer {
|
||||
camera: Camera;
|
||||
readonly entities: EntityList;
|
||||
@@ -314,7 +310,7 @@ declare class SceneManager {
|
||||
static registerActiveSceneChanged(current: Scene, next: Scene): void;
|
||||
onSceneChanged(): void;
|
||||
}
|
||||
declare class Camera extends Component implements IUpdatable {
|
||||
declare class Camera extends Component {
|
||||
private _zoom;
|
||||
private _origin;
|
||||
private _minimumZoom;
|
||||
@@ -430,7 +426,7 @@ declare class SpriteAnimation {
|
||||
readonly frameRate: number;
|
||||
constructor(sprites: Sprite[], frameRate: number);
|
||||
}
|
||||
declare class SpriteAnimator extends SpriteRenderer implements IUpdatable {
|
||||
declare class SpriteAnimator extends SpriteRenderer {
|
||||
onAnimationCompletedEvent: Function;
|
||||
speed: number;
|
||||
animationState: State;
|
||||
@@ -477,7 +473,7 @@ declare class Mover extends Component {
|
||||
applyMovement(motion: Vector2): void;
|
||||
move(motion: Vector2): CollisionResult;
|
||||
}
|
||||
declare abstract class Collider extends Component implements IUpdatable {
|
||||
declare abstract class Collider extends Component {
|
||||
shape: Shape;
|
||||
physicsLayer: number;
|
||||
isTrigger: boolean;
|
||||
@@ -575,7 +571,6 @@ declare class ComponentList {
|
||||
private _components;
|
||||
private _componentsToAdd;
|
||||
private _componentsToRemove;
|
||||
private _updatableComponents;
|
||||
private _tempBufferList;
|
||||
constructor(entity: Entity);
|
||||
readonly count: number;
|
||||
|
||||
@@ -1011,6 +1011,8 @@ var Component = (function (_super) {
|
||||
};
|
||||
Component.prototype.debugRender = function () {
|
||||
};
|
||||
Component.prototype.update = function () {
|
||||
};
|
||||
Component.prototype.onEntityTransformChanged = function (comp) {
|
||||
};
|
||||
Component.prototype.registerComponent = function () {
|
||||
@@ -2575,7 +2577,6 @@ var ComponentList = (function () {
|
||||
this._components = [];
|
||||
this._componentsToAdd = [];
|
||||
this._componentsToRemove = [];
|
||||
this._updatableComponents = [];
|
||||
this._tempBufferList = [];
|
||||
this._entity = entity;
|
||||
}
|
||||
@@ -2610,7 +2611,6 @@ var ComponentList = (function () {
|
||||
this.handleRemove(this._components[i]);
|
||||
}
|
||||
this._components.length = 0;
|
||||
this._updatableComponents.length = 0;
|
||||
this._componentsToAdd.length = 0;
|
||||
this._componentsToRemove.length = 0;
|
||||
};
|
||||
@@ -2619,8 +2619,6 @@ var ComponentList = (function () {
|
||||
var component = this._components[i];
|
||||
if (component instanceof RenderableComponent)
|
||||
this._entity.scene.renderableComponents.remove(component);
|
||||
if (egret.is(component, "IUpdatable"))
|
||||
this._updatableComponents.remove(component);
|
||||
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component), false);
|
||||
this._entity.scene.entityProcessors.onComponentRemoved(this._entity);
|
||||
}
|
||||
@@ -2630,8 +2628,6 @@ var ComponentList = (function () {
|
||||
var component = this._components[i];
|
||||
if (component instanceof RenderableComponent)
|
||||
this._entity.scene.renderableComponents.add(component);
|
||||
if (egret.is(component, "IUpdatable"))
|
||||
this._updatableComponents.push(component);
|
||||
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component));
|
||||
this._entity.scene.entityProcessors.onComponentAdded(this._entity);
|
||||
}
|
||||
@@ -2649,8 +2645,6 @@ var ComponentList = (function () {
|
||||
var component = this._componentsToAdd[i];
|
||||
if (component instanceof RenderableComponent)
|
||||
this._entity.scene.renderableComponents.add(component);
|
||||
if (egret.is(component, "IUpdatable"))
|
||||
this._updatableComponents.push(component);
|
||||
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component));
|
||||
this._entity.scene.entityProcessors.onComponentAdded(this._entity);
|
||||
this._components.push(component);
|
||||
@@ -2680,8 +2674,6 @@ var ComponentList = (function () {
|
||||
ComponentList.prototype.handleRemove = function (component) {
|
||||
if (component instanceof RenderableComponent)
|
||||
this._entity.scene.renderableComponents.remove(component);
|
||||
if (egret.is(component, "IUpdatable"))
|
||||
this._updatableComponents.remove(component);
|
||||
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component), false);
|
||||
this._entity.scene.entityProcessors.onComponentRemoved(this._entity);
|
||||
component.onRemovedFromEntity();
|
||||
@@ -2735,8 +2727,8 @@ var ComponentList = (function () {
|
||||
};
|
||||
ComponentList.prototype.update = function () {
|
||||
this.updateLists();
|
||||
for (var i = 0; i < this._updatableComponents.length; i++) {
|
||||
var updatable = this._updatableComponents[i];
|
||||
for (var i = 0; i < this._components.length; i++) {
|
||||
var updatable = this._components[i];
|
||||
var updateableComponent = void 0;
|
||||
if (updatable instanceof Component)
|
||||
updateableComponent = updatable;
|
||||
|
||||
2
demo/libs/framework/framework.min.js
vendored
2
demo/libs/framework/framework.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user