全部移动至es模块

This commit is contained in:
yhh
2020-07-23 11:00:46 +08:00
parent 814234ca61
commit 1b52bc5fd1
71 changed files with 19273 additions and 16907 deletions
+576 -298
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+576 -298
View File
File diff suppressed because it is too large Load Diff
+1897 -1116
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
File diff suppressed because one or more lines are too long
+122
View File
@@ -1008,7 +1008,129 @@ declare class Video {
*/ */
exitFullScreen(): Promise<void>; exitFullScreen(): Promise<void>;
} }
/**
*
*/
declare class Camera {
/**
*
*/
x: number;
/**
*
*/
y: number;
/**
*
*/
width: number;
/**
*
*/
height: number;
/**
*
*/
devicePosition: "front" | "back";
/**
*
*/
flash: "auto" | "on" | "off";
/**
*
*/
size: "small" | "medium" | "large";
/**
*
* @param quality
*/
takePhoto(quality?: "high" | "normal" | "low"): Promise<{
/**
*
*/
tempImagePath: string,
/**
*
*/
width: string,
/**
*
*/
height: string
}>;
/**
*
*/
startRecord(): Promise<void>;
/**
*
* @param compressed
*/
stopRecord(compressed: boolean): Promise<{
/**
*
*/
tempThumbPath: string,
/**
*
*/
tempVideoPath: string
}>;
/**
* 使
* @param callback
*/
onAuthCancel(callback: () => void): void;
/**
* 退
* @param callback
*/
onStop(callback: () => void): void;
/**
*
*/
onCameraFrame(callback: (res: {
/**
*
*/
width: number,
/**
*
*/
height: number,
/**
* rgba
*/
data: ArrayBuffer
}) => void): void;
/**
*
*/
listenFrameChange(): void;
/**
*
*/
closeFrameChange(): void;
/**
*
*/
destroy(): void;
}
/** /**
* banner 广banner 广 Canvas Canvas banner 广 BannerAd.show() banner 广 BannerAd.onResize() * banner 广banner 广 Canvas Canvas banner 广 BannerAd.show() banner 广 BannerAd.onResize()
*/ */
@@ -1,8 +1,9 @@
///<reference path="./PriorityQueueNode.ts" /> ///<reference path="./PriorityQueueNode.ts" />
module es {
/** /**
* IAstarGraph和开始/ * IAstarGraph和开始/
*/ */
class AStarPathfinder { export class AStarPathfinder {
/** /**
* null * null
* @param graph * @param graph
@@ -91,7 +92,7 @@ class AStarPathfinder {
/** /**
* 使PriorityQueue需要的额外字段将原始数据封装在一个小类中 * 使PriorityQueue需要的额外字段将原始数据封装在一个小类中
*/ */
class AStarNode<T> extends PriorityQueueNode { export class AStarNode<T> extends PriorityQueueNode {
public data: T; public data: T;
constructor(data: T){ constructor(data: T){
@@ -99,3 +100,4 @@ class AStarNode<T> extends PriorityQueueNode {
this.data = data; this.data = data;
} }
} }
}
@@ -1,8 +1,9 @@
module es {
/** /**
* A*使 * A*使
* walls添加到walls HashSetweightedNodes * walls添加到walls HashSetweightedNodes
*/ */
class AstarGridGraph implements IAstarGraph<Vector2> { export class AstarGridGraph implements IAstarGraph<Vector2> {
public dirs: Vector2[] = [ public dirs: Vector2[] = [
new Vector2(1, 0), new Vector2(1, 0),
new Vector2(0, -1), new Vector2(0, -1),
@@ -70,3 +71,4 @@ class AstarGridGraph implements IAstarGraph<Vector2> {
} }
} }
}
@@ -1,7 +1,8 @@
module es {
/** /**
* graph的接口AstarPathfinder.search方法 * graph的接口AstarPathfinder.search方法
*/ */
interface IAstarGraph<T> { export interface IAstarGraph<T> {
/** /**
* getNeighbors方法应该返回从传入的节点可以到达的任何相邻节点 * getNeighbors方法应该返回从传入的节点可以到达的任何相邻节点
* @param node * @param node
@@ -20,3 +21,4 @@ interface IAstarGraph<T> {
*/ */
heuristic(node: T, goal: T); heuristic(node: T, goal: T);
} }
}
@@ -1,9 +1,10 @@
module es {
/** /**
* 使 O(1) * 使 O(1)
* 使5-10 * 使5-10
* IPriorityQueue.contains() * IPriorityQueue.contains()
*/ */
class PriorityQueue<T extends PriorityQueueNode> { export class PriorityQueue<T extends PriorityQueueNode> {
private _numNodes: number; private _numNodes: number;
private _nodes: T[]; private _nodes: T[];
private _numNodesEverEnqueued; private _numNodesEverEnqueued;
@@ -232,3 +233,4 @@ class PriorityQueue<T extends PriorityQueueNode> {
(higher.priority == lower.priority && higher.insertionIndex < lower.insertionIndex)); (higher.priority == lower.priority && higher.insertionIndex < lower.insertionIndex));
} }
} }
}
@@ -1,4 +1,5 @@
class PriorityQueueNode { module es {
export class PriorityQueueNode {
/** /**
* *
*/ */
@@ -12,3 +13,4 @@ class PriorityQueueNode {
*/ */
public queueIndex: number = 0; public queueIndex: number = 0;
} }
}
@@ -1,7 +1,8 @@
module es {
/** /**
* IUnweightedGraph和开始/ * IUnweightedGraph和开始/
*/ */
class BreadthFirstPathfinder { export class BreadthFirstPathfinder {
public static search<T>(graph: IUnweightedGraph<T>, start: T, goal: T): T[]{ public static search<T>(graph: IUnweightedGraph<T>, start: T, goal: T): T[]{
let foundPath = false; let foundPath = false;
let frontier = []; let frontier = [];
@@ -39,3 +40,4 @@ class BreadthFirstPathfinder {
return false; return false;
} }
} }
}
@@ -1,7 +1,9 @@
interface IUnweightedGraph<T>{ module es {
export interface IUnweightedGraph<T>{
/** /**
* getNeighbors方法应该返回从传入的节点可以到达的任何相邻节点 * getNeighbors方法应该返回从传入的节点可以到达的任何相邻节点
* @param node * @param node
*/ */
getNeighbors(node: T): T[]; getNeighbors(node: T): T[];
} }
}
@@ -1,8 +1,9 @@
module es {
/** /**
* *
* *
*/ */
class UnweightedGraph<T> implements IUnweightedGraph<T> { export class UnweightedGraph<T> implements IUnweightedGraph<T> {
public edges: Map<T, T[]> = new Map<T, T[]>(); public edges: Map<T, T[]> = new Map<T, T[]>();
public addEdgesForNode(node: T, edges: T[]){ public addEdgesForNode(node: T, edges: T[]){
@@ -14,3 +15,4 @@ class UnweightedGraph<T> implements IUnweightedGraph<T> {
return this.edges.get(node); return this.edges.get(node);
} }
} }
}
@@ -1,8 +1,9 @@
///<reference path="../../../Math/Vector2.ts" /> ///<reference path="../../../Math/Vector2.ts" />
module es {
/** /**
* BreadthFirstPathfinder * BreadthFirstPathfinder
*/ */
class UnweightedGridGraph implements IUnweightedGraph<Vector2> { export class UnweightedGridGraph implements IUnweightedGraph<Vector2> {
private static readonly CARDINAL_DIRS: Vector2[] = [ private static readonly CARDINAL_DIRS: Vector2[] = [
new Vector2(1, 0), new Vector2(1, 0),
new Vector2(0, -1), new Vector2(0, -1),
@@ -59,3 +60,4 @@ class UnweightedGridGraph implements IUnweightedGraph<Vector2> {
return BreadthFirstPathfinder.search(this, start, goal); return BreadthFirstPathfinder.search(this, start, goal);
} }
} }
}
@@ -1,4 +1,5 @@
interface IWeightedGraph<T>{ module es {
export interface IWeightedGraph<T>{
/** /**
* *
* @param node * @param node
@@ -12,3 +13,4 @@ interface IWeightedGraph<T>{
*/ */
cost(from: T, to: T): number; cost(from: T, to: T): number;
} }
}
@@ -1,8 +1,9 @@
///<reference path="../../../Math/Vector2.ts" /> ///<reference path="../../../Math/Vector2.ts" />
module es {
/** /**
* *
*/ */
class WeightedGridGraph implements IWeightedGraph<Vector2> { export class WeightedGridGraph implements IWeightedGraph<Vector2> {
public static readonly CARDINAL_DIRS = [ public static readonly CARDINAL_DIRS = [
new Vector2(1, 0), new Vector2(1, 0),
new Vector2(0, -1), new Vector2(0, -1),
@@ -65,3 +66,4 @@ class WeightedGridGraph implements IWeightedGraph<Vector2> {
return this.weightedNodes.find(t => JSON.stringify(t) == JSON.stringify(to)) ? this.weightedNodeWeight : this.defaultWeight; return this.weightedNodes.find(t => JSON.stringify(t) == JSON.stringify(to)) ? this.weightedNodeWeight : this.defaultWeight;
} }
} }
}
@@ -1,4 +1,5 @@
class WeightedNode<T> extends PriorityQueueNode { module es {
export class WeightedNode<T> extends PriorityQueueNode {
public data: T; public data: T;
constructor(data: T){ constructor(data: T){
@@ -7,7 +8,7 @@ class WeightedNode<T> extends PriorityQueueNode {
} }
} }
class WeightedPathfinder { export class WeightedPathfinder {
public static search<T>(graph: IWeightedGraph<T>, start: T, goal: T){ public static search<T>(graph: IWeightedGraph<T>, start: T, goal: T){
let foundPath = false; let foundPath = false;
@@ -81,3 +82,4 @@ class WeightedPathfinder {
return path; return path;
} }
} }
}
+3 -1
View File
@@ -1,4 +1,5 @@
class Debug { module es {
export class Debug {
private static _debugDrawItems: DebugDrawItem[] = []; private static _debugDrawItems: DebugDrawItem[] = [];
public static drawHollowRect(rectanle: Rectangle, color: number, duration = 0){ public static drawHollowRect(rectanle: Rectangle, color: number, duration = 0){
@@ -20,3 +21,4 @@ class Debug {
} }
} }
} }
}
+3 -1
View File
@@ -1,4 +1,6 @@
class DebugDefaults { module es {
export class DebugDefaults {
public static verletParticle = 0xDC345E; public static verletParticle = 0xDC345E;
public static verletConstraintEdge = 0x433E36; public static verletConstraintEdge = 0x433E36;
} }
}
+5 -2
View File
@@ -1,11 +1,12 @@
enum DebugDrawType { module es {
export enum DebugDrawType {
line, line,
hollowRectangle, hollowRectangle,
pixel, pixel,
text text
} }
class DebugDrawItem { export class DebugDrawItem {
public rectangle: Rectangle; public rectangle: Rectangle;
public color: number; public color: number;
public duration: number; public duration: number;
@@ -43,4 +44,6 @@ class DebugDrawItem {
return this.duration < 0; return this.duration < 0;
} }
} }
}
+3 -1
View File
@@ -1,4 +1,6 @@
enum CoreEvents{ module es {
export enum CoreEvents{
/** 当场景发生变化时触发 */ /** 当场景发生变化时触发 */
SceneChanged, SceneChanged,
} }
}
+1 -1
View File
@@ -36,7 +36,7 @@ module es {
*/ */
public static createWithDefaultRenderer(){ public static createWithDefaultRenderer(){
let scene = new Scene(); let scene = new Scene();
scene.addRenderer(new DefaultRenderer()) scene.addRenderer(new DefaultRenderer());
return scene; return scene;
} }
+3 -1
View File
@@ -1,5 +1,6 @@
module es {
/** 运行时的场景管理。 */ /** 运行时的场景管理。 */
class SceneManager { export class SceneManager {
private static _scene: Scene; private static _scene: Scene;
private static _nextScene: Scene; private static _nextScene: Scene;
public static sceneTransition: SceneTransition; public static sceneTransition: SceneTransition;
@@ -142,3 +143,4 @@ class SceneManager {
TimeRuler.Instance.endMark("update"); TimeRuler.Instance.endMark("update");
} }
} }
}
@@ -1,8 +1,9 @@
///<reference path="./EntitySystem.ts" /> ///<reference path="./EntitySystem.ts" />
module es {
/** /**
* *
*/ */
abstract class EntityProcessingSystem extends EntitySystem { export abstract class EntityProcessingSystem extends EntitySystem {
constructor(matcher: Matcher) { constructor(matcher: Matcher) {
super(matcher); super(matcher);
} }
@@ -30,3 +31,4 @@ abstract class EntityProcessingSystem extends EntitySystem {
entities.forEach(entity => this.lateProcessEntity(entity)); entities.forEach(entity => this.lateProcessEntity(entity));
} }
} }
}
+3 -1
View File
@@ -1,4 +1,5 @@
class EntitySystem { module es {
export class EntitySystem {
private _scene: Scene; private _scene: Scene;
private _entities: Entity[] = []; private _entities: Entity[] = [];
private _matcher: Matcher; private _matcher: Matcher;
@@ -77,3 +78,4 @@ class EntitySystem {
} }
} }
}
+3 -1
View File
@@ -1,4 +1,5 @@
abstract class PassiveSystem extends EntitySystem { module es {
export abstract class PassiveSystem extends EntitySystem {
public onChanged(entity: Entity){ public onChanged(entity: Entity){
} }
@@ -9,3 +10,4 @@ abstract class PassiveSystem extends EntitySystem {
this.end(); this.end();
} }
} }
}
+3 -1
View File
@@ -1,5 +1,6 @@
/** 用于协调其他系统的通用系统基类 */ /** 用于协调其他系统的通用系统基类 */
abstract class ProcessingSystem extends EntitySystem { module es {
export abstract class ProcessingSystem extends EntitySystem {
public onChanged(entity: Entity){ public onChanged(entity: Entity){
} }
@@ -13,3 +14,4 @@ abstract class ProcessingSystem extends EntitySystem {
/** 处理我们的系统 每帧调用 */ /** 处理我们的系统 每帧调用 */
public abstract processSystem(); public abstract processSystem();
} }
}
+1 -1
View File
@@ -160,7 +160,7 @@ module es {
this.updateLists(); this.updateLists();
for (let i = 0; i < this._entities.length; i ++){ for (let i = 0; i < this._entities.length; i ++){
this._entities[i]._isDestoryed = true; this._entities[i]._isDestroyed = true;
this._entities[i].onRemovedFromScene(); this._entities[i].onRemovedFromScene();
this._entities[i].scene = null; this._entities[i].scene = null;
} }
+3 -1
View File
@@ -1,4 +1,5 @@
class Matcher{ module es {
export class Matcher{
protected allSet = new BitSet(); protected allSet = new BitSet();
protected exclusionSet = new BitSet(); protected exclusionSet = new BitSet();
protected oneSet = new BitSet(); protected oneSet = new BitSet();
@@ -60,3 +61,4 @@ class Matcher{
return this; return this;
} }
} }
}
+3 -1
View File
@@ -1,7 +1,8 @@
module es {
/** /**
* *
*/ */
class TextureUtils { export class TextureUtils {
public static sharedCanvas: HTMLCanvasElement; public static sharedCanvas: HTMLCanvasElement;
public static sharedContext: CanvasRenderingContext2D; public static sharedContext: CanvasRenderingContext2D;
@@ -152,3 +153,4 @@ class TextureUtils {
} }
} }
} }
}
+3 -1
View File
@@ -1,5 +1,6 @@
module es {
/** 提供帧定时信息 */ /** 提供帧定时信息 */
class Time { export class Time {
/** deltaTime的未缩放版本。不受时间尺度的影响 */ /** deltaTime的未缩放版本。不受时间尺度的影响 */
public static unscaledDeltaTime; public static unscaledDeltaTime;
/** 前一帧到当前帧的时间增量,按时间刻度进行缩放 */ /** 前一帧到当前帧的时间增量,按时间刻度进行缩放 */
@@ -36,3 +37,4 @@ class Time {
return (this._timeSinceSceneLoad / interval) > ((this._timeSinceSceneLoad - this.deltaTime) / interval); return (this._timeSinceSceneLoad / interval) > ((this._timeSinceSceneLoad - this.deltaTime) / interval);
} }
} }
}
@@ -1,4 +1,5 @@
class GaussianBlurEffect extends egret.CustomFilter { module es {
export class GaussianBlurEffect extends egret.CustomFilter {
// private static blur_frag = "precision mediump float;\n" + // private static blur_frag = "precision mediump float;\n" +
// "uniform vec2 blur;\n" + // "uniform vec2 blur;\n" +
// "uniform sampler2D uSampler;\n" + // "uniform sampler2D uSampler;\n" +
@@ -70,3 +71,4 @@ class GaussianBlurEffect extends egret.CustomFilter {
}); });
} }
} }
}
@@ -1,4 +1,5 @@
class PolygonLightEffect extends egret.CustomFilter { module es {
export class PolygonLightEffect extends egret.CustomFilter {
private static vertSrc = "attribute vec2 aVertexPosition;\n" + private static vertSrc = "attribute vec2 aVertexPosition;\n" +
"attribute vec2 aTextureCoord;\n" + "attribute vec2 aTextureCoord;\n" +
@@ -32,3 +33,4 @@ class PolygonLightEffect extends egret.CustomFilter {
super(PolygonLightEffect.vertSrc, PolygonLightEffect.fragmentSrc); super(PolygonLightEffect.vertSrc, PolygonLightEffect.fragmentSrc);
} }
} }
}
+3 -1
View File
@@ -1,4 +1,5 @@
class GraphicsCapabilities extends egret.Capabilities { module es {
export class GraphicsCapabilities extends egret.Capabilities {
public initialize(device: GraphicsDevice){ public initialize(device: GraphicsDevice){
this.platformInitialize(device); this.platformInitialize(device);
@@ -25,3 +26,4 @@ class GraphicsCapabilities extends egret.Capabilities {
capabilities["language"] = language; capabilities["language"] = language;
} }
} }
}
+3 -1
View File
@@ -1,4 +1,5 @@
class GraphicsDevice { module es {
export class GraphicsDevice {
private viewport: Viewport; private viewport: Viewport;
public graphicsCapabilities: GraphicsCapabilities; public graphicsCapabilities: GraphicsCapabilities;
@@ -8,3 +9,4 @@ class GraphicsDevice {
this.graphicsCapabilities.initialize(this); this.graphicsCapabilities.initialize(this);
} }
} }
}
@@ -1,4 +1,5 @@
class PostProcessor { module es {
export class PostProcessor {
public enabled: boolean; public enabled: boolean;
public effect: egret.Filter; public effect: egret.Filter;
public scene: Scene; public scene: Scene;
@@ -56,3 +57,4 @@ class PostProcessor {
this.scene = null; this.scene = null;
} }
} }
}
@@ -1,6 +1,8 @@
class GaussianBlurPostProcessor extends PostProcessor { module es {
export class GaussianBlurPostProcessor extends PostProcessor {
public onAddedToScene(scene: Scene){ public onAddedToScene(scene: Scene){
super.onAddedToScene(scene); super.onAddedToScene(scene);
this.effect = new GaussianBlurEffect(); this.effect = new GaussianBlurEffect();
} }
} }
}
@@ -1,5 +1,6 @@
///<reference path="./Renderer.ts" /> ///<reference path="./Renderer.ts" />
class DefaultRenderer extends Renderer { module es {
export class DefaultRenderer extends Renderer {
public render(scene: Scene) { public render(scene: Scene) {
let cam = this.camera ? this.camera : scene.camera; let cam = this.camera ? this.camera : scene.camera;
this.beginRender(cam); this.beginRender(cam);
@@ -11,3 +12,4 @@ class DefaultRenderer extends Renderer {
} }
} }
} }
}
@@ -1,4 +1,5 @@
class PolyLight extends RenderableComponent { module es {
export class PolyLight extends RenderableComponent {
public power: number; public power: number;
protected _radius: number; protected _radius: number;
private _lightEffect; private _lightEffect;
@@ -44,3 +45,4 @@ class PolyLight extends RenderableComponent {
} }
} }
}
+3 -1
View File
@@ -1,7 +1,8 @@
module es {
/** /**
* RenderableComponent的实际调用 * RenderableComponent的实际调用
*/ */
abstract class Renderer { export abstract class Renderer {
/** /**
* () * ()
* *
@@ -36,3 +37,4 @@ abstract class Renderer {
renderable.render(cam); renderable.render(cam);
} }
} }
}
@@ -1,7 +1,9 @@
module es {
/** /**
* 使 * 使
*/ */
class ScreenSpaceRenderer extends Renderer { export class ScreenSpaceRenderer extends Renderer {
public render(scene: Scene) { public render(scene: Scene) {
} }
} }
}
@@ -1,5 +1,6 @@
///<reference path="./SceneTransition.ts"/> ///<reference path="./SceneTransition.ts"/>
class FadeTransition extends SceneTransition { module es {
export class FadeTransition extends SceneTransition {
public fadeToColor: number = 0x000000; public fadeToColor: number = 0x000000;
public fadeOutDuration = 0.4; public fadeOutDuration = 0.4;
public fadeEaseType: Function = egret.Ease.quadInOut; public fadeEaseType: Function = egret.Ease.quadInOut;
@@ -36,3 +37,4 @@ class FadeTransition extends SceneTransition {
this._mask.graphics.endFill(); this._mask.graphics.endFill();
} }
} }
}
@@ -1,7 +1,8 @@
module es {
/** /**
* SceneTransition用于从一个场景过渡到另一个场景或在一个有效果的场景中过渡 * SceneTransition用于从一个场景过渡到另一个场景或在一个有效果的场景中过渡
*/ */
abstract class SceneTransition { export abstract class SceneTransition {
private _hasPreviousSceneRender: boolean; private _hasPreviousSceneRender: boolean;
/** 是否加载新场景的标志 */ /** 是否加载新场景的标志 */
public loadsNewScene: boolean; public loadsNewScene: boolean;
@@ -73,3 +74,4 @@ abstract class SceneTransition {
}); });
} }
} }
}
@@ -1,4 +1,5 @@
class WindTransition extends SceneTransition { module es {
export class WindTransition extends SceneTransition {
private _mask: egret.Shape; private _mask: egret.Shape;
private _windEffect: egret.CustomFilter; private _windEffect: egret.CustomFilter;
@@ -63,3 +64,4 @@ class WindTransition extends SceneTransition {
SceneManager.stage.removeChild(this._mask); SceneManager.stage.removeChild(this._mask);
} }
} }
}
+3 -1
View File
@@ -1,4 +1,5 @@
class Viewport { module es {
export class Viewport {
private _x: number; private _x: number;
private _y: number; private _y: number;
private _width: number; private _width: number;
@@ -32,3 +33,4 @@ class Viewport {
} }
} }
}
+3 -1
View File
@@ -1,5 +1,6 @@
module es {
/** 贝塞尔帮助类 */ /** 贝塞尔帮助类 */
class Bezier { export class Bezier {
/** /**
* 线 * 线
* @param p0 * @param p0
@@ -119,3 +120,4 @@ class Bezier {
this.recursiveGetOptimizedDrawingPoints(pt1234, pt234, pt34, end, points, distanceTolerance); this.recursiveGetOptimizedDrawingPoints(pt1234, pt234, pt34, end, points, distanceTolerance);
} }
} }
}
+3 -1
View File
@@ -1,9 +1,10 @@
module es {
/** /**
* *
* isFlagSet之外flag参数是一个非移位的标志 * isFlagSet之外flag参数是一个非移位的标志
* 使(0123)/ * 使(0123)/
*/ */
class Flags { export class Flags {
/** /**
* *
* *
@@ -60,3 +61,4 @@ class Flags {
return ~self; return ~self;
} }
} }
}
+3 -1
View File
@@ -1,4 +1,5 @@
class MathHelper { module es {
export class MathHelper {
public static readonly Epsilon: number = 0.00001; public static readonly Epsilon: number = 0.00001;
public static readonly Rad2Deg = 57.29578; public static readonly Rad2Deg = 57.29578;
public static readonly Deg2Rad = 0.0174532924; public static readonly Deg2Rad = 0.0174532924;
@@ -76,3 +77,4 @@ class MathHelper {
return Math.atan2(to.y - from.y, to.x - from.x); return Math.atan2(to.y - from.y, to.x - from.x);
} }
} }
}
+3 -1
View File
@@ -1,7 +1,8 @@
module es {
/** /**
* 3 * 3 * 3 * 3
*/ */
class Matrix2D { export class Matrix2D {
public m11: number = 0; public m11: number = 0;
public m12: number = 0; public m12: number = 0;
@@ -215,3 +216,4 @@ class Matrix2D {
return matrix; return matrix;
} }
} }
}
+3 -1
View File
@@ -1,4 +1,5 @@
class Rectangle extends egret.Rectangle { module es {
export class Rectangle extends egret.Rectangle {
/** /**
* *
*/ */
@@ -181,3 +182,4 @@ class Rectangle extends egret.Rectangle {
return this.fromMinMax(minX, minY, maxX, maxY); return this.fromMinMax(minX, minY, maxX, maxY);
} }
} }
}
+3 -1
View File
@@ -1,5 +1,6 @@
module es {
/** 2d 向量 */ /** 2d 向量 */
class Vector2 { export class Vector2 {
public x: number = 0; public x: number = 0;
public y: number = 0; public y: number = 0;
@@ -181,3 +182,4 @@ class Vector2 {
return result; return result;
} }
} }
}
+3 -1
View File
@@ -1,4 +1,5 @@
class Vector3 { module es {
export class Vector3 {
public x: number; public x: number;
public y: number; public y: number;
public z: number; public z: number;
@@ -9,3 +10,4 @@ class Vector3 {
this.z = z; this.z = z;
} }
} }
}
+6 -2
View File
@@ -1,5 +1,8 @@
/** 移动器使用的帮助器类,用于管理触发器碰撞器交互并调用itriggerlistener。 */ module es {
class ColliderTriggerHelper { /**
* 使itriggerlistener
*/
export class ColliderTriggerHelper {
private _entity: Entity; private _entity: Entity;
/** 存储当前帧中发生的所有活动交集对 */ /** 存储当前帧中发生的所有活动交集对 */
private _activeTriggerIntersections: Pair<Collider>[] = []; private _activeTriggerIntersections: Pair<Collider>[] = [];
@@ -99,3 +102,4 @@ class ColliderTriggerHelper {
} }
} }
} }
}
+4 -2
View File
@@ -1,4 +1,5 @@
enum PointSectors { module es {
export enum PointSectors {
center = 0, center = 0,
top = 1, top = 1,
bottom = 2, bottom = 2,
@@ -10,7 +11,7 @@ enum PointSectors {
bottomRight = 6 bottomRight = 6
} }
class Collisions { export class Collisions {
public static isLineToLine(a1: Vector2, a2: Vector2, b1: Vector2, b2: Vector2): boolean { public static isLineToLine(a1: Vector2, a2: Vector2, b1: Vector2, b2: Vector2): boolean {
let b = Vector2.subtract(a2, a1); let b = Vector2.subtract(a2, a1);
let d = Vector2.subtract(b2, b1); let d = Vector2.subtract(b2, b1);
@@ -166,3 +167,4 @@ class Collisions {
return sector; return sector;
} }
} }
}
+3 -1
View File
@@ -1,4 +1,5 @@
class Physics { module es {
export class Physics {
private static _spatialHash: SpatialHash; private static _spatialHash: SpatialHash;
/** 调用reset并创建一个新的SpatialHash时使用的单元格大小 */ /** 调用reset并创建一个新的SpatialHash时使用的单元格大小 */
public static spatialHashCellSize = 100; public static spatialHashCellSize = 100;
@@ -62,3 +63,4 @@ class Physics {
this._spatialHash.debugDraw(secondsToDisplay, 2); this._spatialHash.debugDraw(secondsToDisplay, 2);
} }
} }
}
+3 -1
View File
@@ -1,4 +1,5 @@
class CollisionResult { module es {
export class CollisionResult {
public collider: Collider; public collider: Collider;
public minimumTranslationVector: Vector2 = Vector2.zero; public minimumTranslationVector: Vector2 = Vector2.zero;
public normal: Vector2 = Vector2.zero; public normal: Vector2 = Vector2.zero;
@@ -9,3 +10,4 @@ class CollisionResult {
this.normal = Vector2.negate(this.normal); this.normal = Vector2.negate(this.normal);
} }
} }
}
@@ -1,4 +1,5 @@
class ShapeCollisions { module es {
export class ShapeCollisions {
/** /**
* *
* @param first * @param first
@@ -300,3 +301,4 @@ class ShapeCollisions {
return new Rectangle(topLeft.x, topLeft.y, fullSize.x, fullSize.y) return new Rectangle(topLeft.x, topLeft.y, fullSize.x, fullSize.y)
} }
} }
}
+4 -2
View File
@@ -1,7 +1,8 @@
module es {
/** /**
* *
*/ */
class Layout { export class Layout {
public clientArea: Rectangle; public clientArea: Rectangle;
public safeArea: Rectangle; public safeArea: Rectangle;
@@ -49,7 +50,7 @@ class Layout {
} }
} }
enum Alignment { export enum Alignment {
none = 0, none = 0,
left = 1, left = 1,
right = 2, right = 2,
@@ -67,3 +68,4 @@ enum Alignment {
centerRight = verticalCenter | right, centerRight = verticalCenter | right,
center = verticalCenter | horizontalCenter center = verticalCenter | horizontalCenter
} }
}
+8 -6
View File
@@ -1,7 +1,8 @@
module es {
/** /**
* 使CPU使用情况 * 使CPU使用情况
*/ */
class TimeRuler { export class TimeRuler {
/** 最大条数 8 */ /** 最大条数 8 */
public static readonly maxBars = 8; public static readonly maxBars = 8;
/** */ /** */
@@ -295,7 +296,7 @@ class TimeRuler {
/** /**
* *
*/ */
class FrameLog { export class FrameLog {
public bars: MarkerCollection[]; public bars: MarkerCollection[];
constructor() { constructor() {
@@ -307,7 +308,7 @@ class FrameLog {
/** /**
* *
*/ */
class MarkerCollection { export class MarkerCollection {
public markers: Marker[] = new Array<Marker>(TimeRuler.maxSamples); public markers: Marker[] = new Array<Marker>(TimeRuler.maxSamples);
public markCount: number = 0; public markCount: number = 0;
public markerNests: number[] = new Array<number>(TimeRuler.maxNestCall); public markerNests: number[] = new Array<number>(TimeRuler.maxNestCall);
@@ -319,14 +320,14 @@ class MarkerCollection {
} }
} }
class Marker { export class Marker {
public markerId: number = 0; public markerId: number = 0;
public beginTime: number = 0; public beginTime: number = 0;
public endTime: number = 0; public endTime: number = 0;
public color: number = 0x000000; public color: number = 0x000000;
} }
class MarkerInfo { export class MarkerInfo {
public name: string; public name: string;
public logs: MarkerLog[] = new Array<MarkerLog>(TimeRuler.maxBars); public logs: MarkerLog[] = new Array<MarkerLog>(TimeRuler.maxBars);
@@ -336,7 +337,7 @@ class MarkerInfo {
} }
} }
class MarkerLog { export class MarkerLog {
public snapMin: number = 0; public snapMin: number = 0;
public snapMax: number = 0; public snapMax: number = 0;
public snapAvg: number = 0; public snapAvg: number = 0;
@@ -347,3 +348,4 @@ class MarkerLog {
public color: number = 0x000000; public color: number = 0x000000;
public initialized: boolean = false; public initialized: boolean = false;
} }
}
+3 -1
View File
@@ -1,4 +1,5 @@
class ContentManager { module es {
export class ContentManager {
protected loadedAssets: Map<string, any> = new Map<string, any>(); protected loadedAssets: Map<string, any> = new Map<string, any>();
/** 异步加载资源 */ /** 异步加载资源 */
@@ -39,3 +40,4 @@ class ContentManager {
this.loadedAssets.clear(); this.loadedAssets.clear();
} }
} }
}
+3 -1
View File
@@ -1,5 +1,6 @@
module es {
/** 各种辅助方法来辅助绘图 */ /** 各种辅助方法来辅助绘图 */
class DrawUtils { export class DrawUtils {
public static drawLine(shape: egret.Shape, start: Vector2, end: Vector2, color: number, thickness: number = 1){ public static drawLine(shape: egret.Shape, start: Vector2, end: Vector2, color: number, thickness: number = 1){
this.drawLineAngle(shape, start, MathHelper.angleBetweenVectors(start, end), Vector2.distance(start, end), color, thickness); this.drawLineAngle(shape, start, MathHelper.angleBetweenVectors(start, end), Vector2.distance(start, end), color, thickness);
} }
@@ -57,3 +58,4 @@ class DrawUtils {
return new egret.ColorMatrixFilter(colorMatrix); return new egret.ColorMatrixFilter(colorMatrix);
} }
} }
}
+16 -15
View File
@@ -1,7 +1,22 @@
module es {
/**
*
*/
export class FuncPack {
/** 函数 */
public func: Function;
/** 上下文 */
public context: any;
constructor(func: Function, context: any){
this.func = func;
this.context = context;
}
}
/** /**
* *
*/ */
class Emitter<T> { export class Emitter<T> {
private _messageTable: Map<T, FuncPack[]>; private _messageTable: Map<T, FuncPack[]>;
constructor(){ constructor(){
@@ -51,18 +66,4 @@ class Emitter<T> {
} }
} }
} }
/**
*
*/
class FuncPack {
/** 函数 */
public func: Function;
/** 上下文 */
public context: any;
constructor(func: Function, context: any){
this.func = func;
this.context = context;
}
} }
+3 -1
View File
@@ -1,4 +1,5 @@
class GlobalManager { module es {
export class GlobalManager {
public static globalManagers: GlobalManager[] = []; public static globalManagers: GlobalManager[] = [];
private _enabled: boolean; private _enabled: boolean;
@@ -44,3 +45,4 @@ class GlobalManager {
return null; return null;
} }
} }
}
+4 -2
View File
@@ -1,4 +1,5 @@
class TouchState { module es {
export class TouchState {
public x = 0; public x = 0;
public y = 0; public y = 0;
public touchPoint: number = -1; public touchPoint: number = -1;
@@ -15,7 +16,7 @@ class TouchState {
} }
} }
class Input { export class Input {
private static _init: boolean = false; private static _init: boolean = false;
private static _stage: egret.Stage; private static _stage: egret.Stage;
private static _previousTouchState: TouchState = new TouchState(); private static _previousTouchState: TouchState = new TouchState();
@@ -145,3 +146,4 @@ class Input {
return Vector2.multiply(scaledPos, this.resolutionScale); return Vector2.multiply(scaledPos, this.resolutionScale);
} }
} }
}
+3 -1
View File
@@ -1,7 +1,8 @@
module es {
/** /**
* *
*/ */
class ListPool { export class ListPool {
private static readonly _objectQueue = []; private static readonly _objectQueue = [];
/** /**
@@ -52,3 +53,4 @@ class ListPool {
obj.length = 0; obj.length = 0;
} }
} }
}
+3 -1
View File
@@ -1,7 +1,8 @@
module es {
/** /**
* DTO * DTO
*/ */
class Pair<T> { export class Pair<T> {
public first: T; public first: T;
public second: T; public second: T;
@@ -18,3 +19,4 @@ class Pair<T> {
return this.first == other.first && this.second == other.second; return this.first == other.first && this.second == other.second;
} }
} }
}
+3 -1
View File
@@ -1,4 +1,5 @@
class RectangleExt { module es {
export class RectangleExt {
/** /**
* *
* @param first * @param first
@@ -15,3 +16,4 @@ class RectangleExt {
return result; return result;
} }
} }
}
+3 -1
View File
@@ -1,7 +1,8 @@
module es {
/** /**
* *
*/ */
class Triangulator { export class Triangulator {
/** /**
* 使 * 使
*/ */
@@ -109,3 +110,4 @@ class Triangulator {
return true; return true;
} }
} }
}
+3 -1
View File
@@ -1,4 +1,5 @@
class Vector2Ext { module es {
export class Vector2Ext {
/** /**
* CCW还是CW * CCW还是CW
* @param a * @param a
@@ -83,3 +84,4 @@ class Vector2Ext {
return new Vector2(Math.round(vec.x), Math.round(vec.y)); return new Vector2(Math.round(vec.x), Math.round(vec.y));
} }
} }
}