移除所有egret 依赖。移除renderablecomponent及所有依赖,移除camera。保持ecs基础框架
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
///<reference path="../ECS/Core.ts" />
|
||||
module es {
|
||||
export class Colors {
|
||||
public static renderableBounds = 0xffff00;
|
||||
public static renderableCenter = 0x9932CC;
|
||||
public static colliderBounds = 0x555555;
|
||||
public static colliderEdge = 0x8B0000;
|
||||
public static colliderPosition = 0xFFFF00;
|
||||
public static colliderCenter = 0xFF0000;
|
||||
}
|
||||
|
||||
export class Size {
|
||||
public static get lineSizeMultiplier(){
|
||||
return Math.max(Math.ceil(Core.scene.x / Core.scene.width), 1);
|
||||
}
|
||||
}
|
||||
|
||||
export class Debug {
|
||||
private static _debugDrawItems: DebugDrawItem[] = [];
|
||||
|
||||
public static drawHollowRect(rectanle: Rectangle, color: number, duration = 0) {
|
||||
this._debugDrawItems.push(new DebugDrawItem(rectanle, color, duration));
|
||||
}
|
||||
|
||||
public static render() {
|
||||
if (this._debugDrawItems.length > 0) {
|
||||
let debugShape = new egret.Shape();
|
||||
if (Core.scene) {
|
||||
Core.scene.addChild(debugShape);
|
||||
}
|
||||
|
||||
for (let i = this._debugDrawItems.length - 1; i >= 0; i--) {
|
||||
let item = this._debugDrawItems[i];
|
||||
if (item.draw(debugShape))
|
||||
this._debugDrawItems.removeAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
module es {
|
||||
export enum DebugDrawType {
|
||||
line,
|
||||
hollowRectangle,
|
||||
pixel,
|
||||
text
|
||||
}
|
||||
|
||||
export class DebugDrawItem {
|
||||
public rectangle: Rectangle;
|
||||
public color: number;
|
||||
public duration: number;
|
||||
public drawType: DebugDrawType;
|
||||
public text: string;
|
||||
public start: Vector2;
|
||||
public end: Vector2;
|
||||
public x: number;
|
||||
public y: number;
|
||||
public size: number;
|
||||
|
||||
constructor(rectangle: Rectangle, color: number, duration: number) {
|
||||
this.rectangle = rectangle;
|
||||
this.color = color;
|
||||
this.duration = duration;
|
||||
this.drawType = DebugDrawType.hollowRectangle;
|
||||
}
|
||||
|
||||
public draw(shape: egret.Shape): boolean {
|
||||
switch (this.drawType) {
|
||||
case DebugDrawType.line:
|
||||
// DrawUtils.drawLine(shape, this.start, this.end, this.color);
|
||||
break;
|
||||
case DebugDrawType.hollowRectangle:
|
||||
// DrawUtils.drawHollowRect(shape, this.rectangle, this.color);
|
||||
break;
|
||||
case DebugDrawType.pixel:
|
||||
// DrawUtils.drawPixel(shape, new Vector2(this.x, this.y), this.color, this.size);
|
||||
break;
|
||||
case DebugDrawType.text:
|
||||
break;
|
||||
}
|
||||
|
||||
this.duration -= Time.deltaTime;
|
||||
return this.duration < 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user