全部移动至es模块
This commit is contained in:
Vendored
+576
-298
File diff suppressed because it is too large
Load Diff
+1897
-1116
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+576
-298
File diff suppressed because it is too large
Load Diff
+1897
-1116
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+122
@@ -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 HashSet,并将加权节点添加到weightedNodes
|
* 将walls添加到walls HashSet,并将加权节点添加到weightedNodes
|
||||||
*/
|
*/
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
enum CoreEvents{
|
module es {
|
||||||
|
export enum CoreEvents{
|
||||||
/** 当场景发生变化时触发 */
|
/** 当场景发生变化时触发 */
|
||||||
SceneChanged,
|
SceneChanged,
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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 {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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 {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
|
module es {
|
||||||
/**
|
/**
|
||||||
* 帮助处理位掩码的实用程序类
|
* 帮助处理位掩码的实用程序类
|
||||||
* 除了isFlagSet之外,所有方法都期望flag参数是一个非移位的标志
|
* 除了isFlagSet之外,所有方法都期望flag参数是一个非移位的标志
|
||||||
* 允许您使用普通的(0、1、2、3等)来设置/取消您的标记
|
* 允许您使用普通的(0、1、2、3等)来设置/取消您的标记
|
||||||
*/
|
*/
|
||||||
class Flags {
|
export class Flags {
|
||||||
/**
|
/**
|
||||||
* 检查位标志是否已在数值中设置
|
* 检查位标志是否已在数值中设置
|
||||||
* 检查期望标志是否已经移位
|
* 检查期望标志是否已经移位
|
||||||
@@ -60,3 +61,4 @@ class Flags {
|
|||||||
return ~self;
|
return ~self;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
|
module es {
|
||||||
/**
|
/**
|
||||||
* 三角剖分
|
* 三角剖分
|
||||||
*/
|
*/
|
||||||
class Triangulator {
|
export class Triangulator {
|
||||||
/**
|
/**
|
||||||
* 最后一次三角调用中使用的点列表的三角形列表项的索引
|
* 最后一次三角调用中使用的点列表的三角形列表项的索引
|
||||||
*/
|
*/
|
||||||
@@ -109,3 +110,4 @@ class Triangulator {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user