全部移动至es模块
This commit is contained in:
Vendored
+598
-320
File diff suppressed because it is too large
Load Diff
+2067
-1286
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
+598
-320
File diff suppressed because it is too large
Load Diff
+2067
-1286
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>;
|
||||
}
|
||||
/**
|
||||
* 相机对象
|
||||
*/
|
||||
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() 事件中提供。
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
///<reference path="./PriorityQueueNode.ts" />
|
||||
/**
|
||||
module es {
|
||||
/**
|
||||
* 计算路径给定的IAstarGraph和开始/目标位置
|
||||
*/
|
||||
class AStarPathfinder {
|
||||
export class AStarPathfinder {
|
||||
/**
|
||||
* 尽可能从开始到目标找到一条路径。如果没有找到路径,则返回null。
|
||||
* @param graph
|
||||
@@ -86,16 +87,17 @@ class AStarPathfinder {
|
||||
|
||||
return path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 使用PriorityQueue需要的额外字段将原始数据封装在一个小类中
|
||||
*/
|
||||
class AStarNode<T> extends PriorityQueueNode {
|
||||
export class AStarNode<T> extends PriorityQueueNode {
|
||||
public data: T;
|
||||
|
||||
constructor(data: T){
|
||||
super();
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
/**
|
||||
module es {
|
||||
/**
|
||||
* 基本静态网格图与A*一起使用
|
||||
* 将walls添加到walls HashSet,并将加权节点添加到weightedNodes
|
||||
*/
|
||||
class AstarGridGraph implements IAstarGraph<Vector2> {
|
||||
export class AstarGridGraph implements IAstarGraph<Vector2> {
|
||||
public dirs: Vector2[] = [
|
||||
new Vector2(1, 0),
|
||||
new Vector2(0, -1),
|
||||
@@ -69,4 +70,5 @@ class AstarGridGraph implements IAstarGraph<Vector2> {
|
||||
return Math.abs(node.x - goal.x) + Math.abs(node.y - goal.y);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
module es {
|
||||
/**
|
||||
* graph的接口,可以提供给AstarPathfinder.search方法
|
||||
*/
|
||||
interface IAstarGraph<T> {
|
||||
export interface IAstarGraph<T> {
|
||||
/**
|
||||
* getNeighbors方法应该返回从传入的节点可以到达的任何相邻节点
|
||||
* @param node
|
||||
@@ -19,4 +20,5 @@ interface IAstarGraph<T> {
|
||||
* @param goal
|
||||
*/
|
||||
heuristic(node: T, goal: T);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
/**
|
||||
module es {
|
||||
/**
|
||||
* 使用堆实现最小优先级队列 O(1)复杂度
|
||||
* 这种查找速度比使用字典快5-10倍
|
||||
* 但是,由于IPriorityQueue.contains()是许多寻路算法中调用最多的方法,因此尽可能快地实现它对于我们的应用程序非常重要。
|
||||
*/
|
||||
class PriorityQueue<T extends PriorityQueueNode> {
|
||||
export class PriorityQueue<T extends PriorityQueueNode> {
|
||||
private _numNodes: number;
|
||||
private _nodes: T[];
|
||||
private _numNodesEverEnqueued;
|
||||
@@ -231,4 +232,5 @@ class PriorityQueue<T extends PriorityQueueNode> {
|
||||
return (higher.priority < lower.priority ||
|
||||
(higher.priority == lower.priority && higher.insertionIndex < lower.insertionIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
class PriorityQueueNode {
|
||||
module es {
|
||||
export class PriorityQueueNode {
|
||||
/**
|
||||
* 插入此节点的优先级。在将节点添加到队列之前必须设置
|
||||
*/
|
||||
@@ -11,4 +12,5 @@ class PriorityQueueNode {
|
||||
* 由优先级队列使用-不要编辑此值。表示队列中的当前位置
|
||||
*/
|
||||
public queueIndex: number = 0;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
module es {
|
||||
/**
|
||||
* 计算路径给定的IUnweightedGraph和开始/目标位置
|
||||
*/
|
||||
class BreadthFirstPathfinder {
|
||||
export class BreadthFirstPathfinder {
|
||||
public static search<T>(graph: IUnweightedGraph<T>, start: T, goal: T): T[]{
|
||||
let foundPath = false;
|
||||
let frontier = [];
|
||||
@@ -38,4 +39,5 @@ class BreadthFirstPathfinder {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
interface IUnweightedGraph<T>{
|
||||
module es {
|
||||
export interface IUnweightedGraph<T>{
|
||||
/**
|
||||
* getNeighbors方法应该返回从传入的节点可以到达的任何相邻节点。
|
||||
* @param node
|
||||
*/
|
||||
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 addEdgesForNode(node: T, edges: T[]){
|
||||
@@ -13,4 +14,5 @@ class UnweightedGraph<T> implements IUnweightedGraph<T> {
|
||||
public getNeighbors(node: T){
|
||||
return this.edges.get(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
///<reference path="../../../Math/Vector2.ts" />
|
||||
/**
|
||||
module es {
|
||||
/**
|
||||
* 基本的未加权网格图形用于BreadthFirstPathfinder
|
||||
*/
|
||||
class UnweightedGridGraph implements IUnweightedGraph<Vector2> {
|
||||
export class UnweightedGridGraph implements IUnweightedGraph<Vector2> {
|
||||
private static readonly CARDINAL_DIRS: Vector2[] = [
|
||||
new Vector2(1, 0),
|
||||
new Vector2(0, -1),
|
||||
@@ -58,4 +59,5 @@ class UnweightedGridGraph implements IUnweightedGraph<Vector2> {
|
||||
public search(start: Vector2, goal: Vector2): Vector2[] {
|
||||
return BreadthFirstPathfinder.search(this, start, goal);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
interface IWeightedGraph<T>{
|
||||
module es {
|
||||
export interface IWeightedGraph<T>{
|
||||
/**
|
||||
*
|
||||
* @param node
|
||||
@@ -11,4 +12,5 @@ interface IWeightedGraph<T>{
|
||||
* @param to
|
||||
*/
|
||||
cost(from: T, to: T): number;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
///<reference path="../../../Math/Vector2.ts" />
|
||||
/**
|
||||
module es {
|
||||
/**
|
||||
* 支持一种加权节点的基本网格图
|
||||
*/
|
||||
class WeightedGridGraph implements IWeightedGraph<Vector2> {
|
||||
export class WeightedGridGraph implements IWeightedGraph<Vector2> {
|
||||
public static readonly CARDINAL_DIRS = [
|
||||
new Vector2(1, 0),
|
||||
new Vector2(0, -1),
|
||||
@@ -64,4 +65,5 @@ class WeightedGridGraph implements IWeightedGraph<Vector2> {
|
||||
public cost(from: Vector2, to: Vector2): number{
|
||||
return this.weightedNodes.find(t => JSON.stringify(t) == JSON.stringify(to)) ? this.weightedNodeWeight : this.defaultWeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
class WeightedNode<T> extends PriorityQueueNode {
|
||||
module es {
|
||||
export class WeightedNode<T> extends PriorityQueueNode {
|
||||
public data: T;
|
||||
|
||||
constructor(data: T){
|
||||
super();
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class WeightedPathfinder {
|
||||
export class WeightedPathfinder {
|
||||
public static search<T>(graph: IWeightedGraph<T>, start: T, goal: T){
|
||||
let foundPath = false;
|
||||
|
||||
@@ -80,4 +81,5 @@ class WeightedPathfinder {
|
||||
|
||||
return path;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
class Debug {
|
||||
module es {
|
||||
export class Debug {
|
||||
private static _debugDrawItems: DebugDrawItem[] = [];
|
||||
|
||||
public static drawHollowRect(rectanle: Rectangle, color: number, duration = 0){
|
||||
@@ -19,4 +20,5 @@ class Debug {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
class DebugDefaults {
|
||||
module es {
|
||||
export class DebugDefaults {
|
||||
public static verletParticle = 0xDC345E;
|
||||
public static verletConstraintEdge = 0x433E36;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
enum DebugDrawType {
|
||||
module es {
|
||||
export enum DebugDrawType {
|
||||
line,
|
||||
hollowRectangle,
|
||||
pixel,
|
||||
text
|
||||
}
|
||||
}
|
||||
|
||||
class DebugDrawItem {
|
||||
export class DebugDrawItem {
|
||||
public rectangle: Rectangle;
|
||||
public color: number;
|
||||
public duration: number;
|
||||
@@ -42,5 +43,7 @@ class DebugDrawItem {
|
||||
this.duration -= Time.deltaTime;
|
||||
return this.duration < 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
enum CoreEvents{
|
||||
module es {
|
||||
export enum CoreEvents{
|
||||
/** 当场景发生变化时触发 */
|
||||
SceneChanged,
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ module es {
|
||||
*/
|
||||
public static createWithDefaultRenderer(){
|
||||
let scene = new Scene();
|
||||
scene.addRenderer(new DefaultRenderer());
|
||||
scene.addRenderer(new DefaultRenderer());
|
||||
return scene;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/** 运行时的场景管理。 */
|
||||
class SceneManager {
|
||||
module es {
|
||||
/** 运行时的场景管理。 */
|
||||
export class SceneManager {
|
||||
private static _scene: Scene;
|
||||
private static _nextScene: Scene;
|
||||
public static sceneTransition: SceneTransition;
|
||||
@@ -141,4 +142,5 @@ class SceneManager {
|
||||
private static endDebugUpdate(){
|
||||
TimeRuler.Instance.endMark("update");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
///<reference path="./EntitySystem.ts" />
|
||||
/**
|
||||
module es {
|
||||
/**
|
||||
* 基本实体处理系统。将其用作处理具有特定组件的许多实体的基础
|
||||
*/
|
||||
abstract class EntityProcessingSystem extends EntitySystem {
|
||||
export abstract class EntityProcessingSystem extends EntitySystem {
|
||||
constructor(matcher: Matcher) {
|
||||
super(matcher);
|
||||
}
|
||||
@@ -29,4 +30,5 @@ abstract class EntityProcessingSystem extends EntitySystem {
|
||||
protected lateProcess(entities: Entity[]) {
|
||||
entities.forEach(entity => this.lateProcessEntity(entity));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
class EntitySystem {
|
||||
module es {
|
||||
export class EntitySystem {
|
||||
private _scene: Scene;
|
||||
private _entities: Entity[] = [];
|
||||
private _matcher: Matcher;
|
||||
@@ -76,4 +77,5 @@ class EntitySystem {
|
||||
protected end(){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
abstract class PassiveSystem extends EntitySystem {
|
||||
module es {
|
||||
export abstract class PassiveSystem extends EntitySystem {
|
||||
public onChanged(entity: Entity){
|
||||
|
||||
}
|
||||
@@ -8,4 +9,5 @@ abstract class PassiveSystem extends EntitySystem {
|
||||
this.begin();
|
||||
this.end();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
/** 用于协调其他系统的通用系统基类 */
|
||||
abstract class ProcessingSystem extends EntitySystem {
|
||||
module es {
|
||||
export abstract class ProcessingSystem extends EntitySystem {
|
||||
public onChanged(entity: Entity){
|
||||
|
||||
}
|
||||
@@ -12,4 +13,5 @@ abstract class ProcessingSystem extends EntitySystem {
|
||||
|
||||
/** 处理我们的系统 每帧调用 */
|
||||
public abstract processSystem();
|
||||
}
|
||||
}
|
||||
@@ -160,7 +160,7 @@ module es {
|
||||
this.updateLists();
|
||||
|
||||
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].scene = null;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Matcher{
|
||||
module es {
|
||||
export class Matcher{
|
||||
protected allSet = new BitSet();
|
||||
protected exclusionSet = new BitSet();
|
||||
protected oneSet = new BitSet();
|
||||
@@ -59,4 +60,5 @@ class Matcher{
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
module es {
|
||||
/**
|
||||
* 纹理帮助类
|
||||
*/
|
||||
class TextureUtils {
|
||||
export class TextureUtils {
|
||||
public static sharedCanvas: HTMLCanvasElement;
|
||||
public static sharedContext: CanvasRenderingContext2D;
|
||||
|
||||
@@ -151,4 +152,5 @@ class TextureUtils {
|
||||
egret.$error(1039);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
/** 提供帧定时信息 */
|
||||
class Time {
|
||||
module es {
|
||||
/** 提供帧定时信息 */
|
||||
export class Time {
|
||||
/** deltaTime的未缩放版本。不受时间尺度的影响 */
|
||||
public static unscaledDeltaTime;
|
||||
/** 前一帧到当前帧的时间增量,按时间刻度进行缩放 */
|
||||
@@ -35,4 +36,5 @@ class Time {
|
||||
// 我们减去了delta,因为timeSinceSceneLoad已经包含了这个update ticks delta
|
||||
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" +
|
||||
// "uniform vec2 blur;\n" +
|
||||
// "uniform sampler2D uSampler;\n" +
|
||||
@@ -69,4 +70,5 @@ class GaussianBlurEffect extends egret.CustomFilter {
|
||||
screenHeight: SceneManager.stage.stageHeight
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
class PolygonLightEffect extends egret.CustomFilter {
|
||||
module es {
|
||||
export class PolygonLightEffect extends egret.CustomFilter {
|
||||
private static vertSrc = "attribute vec2 aVertexPosition;\n" +
|
||||
"attribute vec2 aTextureCoord;\n" +
|
||||
|
||||
@@ -31,4 +32,5 @@ class PolygonLightEffect extends egret.CustomFilter {
|
||||
constructor(){
|
||||
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){
|
||||
this.platformInitialize(device);
|
||||
@@ -24,4 +25,5 @@ class GraphicsCapabilities extends egret.Capabilities {
|
||||
}
|
||||
capabilities["language"] = language;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
class GraphicsDevice {
|
||||
module es {
|
||||
export class GraphicsDevice {
|
||||
private viewport: Viewport;
|
||||
|
||||
public graphicsCapabilities: GraphicsCapabilities;
|
||||
@@ -7,4 +8,5 @@ class GraphicsDevice {
|
||||
this.graphicsCapabilities = new GraphicsCapabilities();
|
||||
this.graphicsCapabilities.initialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
class PostProcessor {
|
||||
module es {
|
||||
export class PostProcessor {
|
||||
public enabled: boolean;
|
||||
public effect: egret.Filter;
|
||||
public scene: Scene;
|
||||
@@ -55,4 +56,5 @@ class PostProcessor {
|
||||
this.scene.removeChild(this.shape);
|
||||
this.scene = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
class GaussianBlurPostProcessor extends PostProcessor {
|
||||
module es {
|
||||
export class GaussianBlurPostProcessor extends PostProcessor {
|
||||
public onAddedToScene(scene: Scene){
|
||||
super.onAddedToScene(scene);
|
||||
this.effect = new GaussianBlurEffect();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
///<reference path="./Renderer.ts" />
|
||||
class DefaultRenderer extends Renderer {
|
||||
module es {
|
||||
export class DefaultRenderer extends Renderer {
|
||||
public render(scene: Scene) {
|
||||
let cam = this.camera ? this.camera : scene.camera;
|
||||
this.beginRender(cam);
|
||||
@@ -10,4 +11,5 @@ class DefaultRenderer extends Renderer {
|
||||
this.renderAfterStateCheck(renderable, cam);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
class PolyLight extends RenderableComponent {
|
||||
module es {
|
||||
export class PolyLight extends RenderableComponent {
|
||||
public power: number;
|
||||
protected _radius: number;
|
||||
private _lightEffect;
|
||||
@@ -43,4 +44,5 @@ class PolyLight extends RenderableComponent {
|
||||
public reset(){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
module es {
|
||||
/**
|
||||
* 渲染器被添加到场景中并处理所有对RenderableComponent的实际调用
|
||||
*/
|
||||
abstract class Renderer {
|
||||
export abstract class Renderer {
|
||||
/**
|
||||
* 渲染器用于渲染的摄像机(实际上是用于剔除的变换矩阵和边界)
|
||||
* 不是必须的
|
||||
@@ -35,4 +36,5 @@ abstract class Renderer {
|
||||
protected renderAfterStateCheck(renderable: IRenderable, cam: Camera){
|
||||
renderable.render(cam);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
/**
|
||||
module es {
|
||||
/**
|
||||
* 渲染器使用自己的不移动的摄像机进行渲染。
|
||||
*/
|
||||
class ScreenSpaceRenderer extends Renderer {
|
||||
export class ScreenSpaceRenderer extends Renderer {
|
||||
public render(scene: Scene) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
///<reference path="./SceneTransition.ts"/>
|
||||
class FadeTransition extends SceneTransition {
|
||||
module es {
|
||||
export class FadeTransition extends SceneTransition {
|
||||
public fadeToColor: number = 0x000000;
|
||||
public fadeOutDuration = 0.4;
|
||||
public fadeEaseType: Function = egret.Ease.quadInOut;
|
||||
@@ -35,4 +36,5 @@ class FadeTransition extends SceneTransition {
|
||||
this._mask.graphics.drawRect(0, 0, SceneManager.stage.stageWidth, SceneManager.stage.stageHeight);
|
||||
this._mask.graphics.endFill();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
module es {
|
||||
/**
|
||||
* SceneTransition用于从一个场景过渡到另一个场景或在一个有效果的场景中过渡
|
||||
*/
|
||||
abstract class SceneTransition {
|
||||
export abstract class SceneTransition {
|
||||
private _hasPreviousSceneRender: boolean;
|
||||
/** 是否加载新场景的标志 */
|
||||
public loadsNewScene: boolean;
|
||||
@@ -72,4 +73,5 @@ abstract class SceneTransition {
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
class WindTransition extends SceneTransition {
|
||||
module es {
|
||||
export class WindTransition extends SceneTransition {
|
||||
private _mask: egret.Shape;
|
||||
private _windEffect: egret.CustomFilter;
|
||||
|
||||
@@ -62,4 +63,5 @@ class WindTransition extends SceneTransition {
|
||||
this.transitionComplete();
|
||||
SceneManager.stage.removeChild(this._mask);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
class Viewport {
|
||||
module es {
|
||||
export class Viewport {
|
||||
private _x: number;
|
||||
private _y: number;
|
||||
private _width: number;
|
||||
@@ -31,4 +32,5 @@ class Viewport {
|
||||
this._maxDepth = 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
/** 贝塞尔帮助类 */
|
||||
class Bezier {
|
||||
module es {
|
||||
/** 贝塞尔帮助类 */
|
||||
export class Bezier {
|
||||
/**
|
||||
* 二次贝塞尔曲线
|
||||
* @param p0
|
||||
@@ -118,4 +119,5 @@ class Bezier {
|
||||
this.recursiveGetOptimizedDrawingPoints(start, pt12, pt123, pt1234, points, distanceTolerance);
|
||||
this.recursiveGetOptimizedDrawingPoints(pt1234, pt234, pt34, end, points, distanceTolerance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
/**
|
||||
module es {
|
||||
/**
|
||||
* 帮助处理位掩码的实用程序类
|
||||
* 除了isFlagSet之外,所有方法都期望flag参数是一个非移位的标志
|
||||
* 允许您使用普通的(0、1、2、3等)来设置/取消您的标记
|
||||
*/
|
||||
class Flags {
|
||||
export class Flags {
|
||||
/**
|
||||
* 检查位标志是否已在数值中设置
|
||||
* 检查期望标志是否已经移位
|
||||
@@ -59,4 +60,5 @@ class Flags {
|
||||
public static invertFlags(self: number){
|
||||
return ~self;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
class MathHelper {
|
||||
module es {
|
||||
export class MathHelper {
|
||||
public static readonly Epsilon: number = 0.00001;
|
||||
public static readonly Rad2Deg = 57.29578;
|
||||
public static readonly Deg2Rad = 0.0174532924;
|
||||
@@ -75,4 +76,5 @@ class MathHelper {
|
||||
public static angleBetweenVectors(from: Vector2, to: Vector2){
|
||||
return Math.atan2(to.y - from.y, to.x - from.x);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
module es {
|
||||
/**
|
||||
* 表示右手3 * 3的浮点矩阵,可以存储平移、缩放和旋转信息。
|
||||
*/
|
||||
class Matrix2D {
|
||||
export class Matrix2D {
|
||||
public m11: number = 0;
|
||||
public m12: number = 0;
|
||||
|
||||
@@ -214,4 +215,5 @@ class Matrix2D {
|
||||
let matrix = new egret.Matrix(this.m11, this.m12, this.m21, this.m22, this.m31, this.m32);
|
||||
return matrix;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
class Rectangle extends egret.Rectangle {
|
||||
module es {
|
||||
export class Rectangle extends egret.Rectangle {
|
||||
/**
|
||||
* 获取矩形的最大点,即右下角
|
||||
*/
|
||||
@@ -180,4 +181,5 @@ class Rectangle extends egret.Rectangle {
|
||||
|
||||
return this.fromMinMax(minX, minY, maxX, maxY);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
/** 2d 向量 */
|
||||
class Vector2 {
|
||||
module es {
|
||||
/** 2d 向量 */
|
||||
export class Vector2 {
|
||||
public x: number = 0;
|
||||
public y: number = 0;
|
||||
|
||||
@@ -180,4 +181,5 @@ class Vector2 {
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
class Vector3 {
|
||||
module es {
|
||||
export class Vector3 {
|
||||
public x: number;
|
||||
public y: number;
|
||||
public z: number;
|
||||
@@ -8,4 +9,5 @@ class Vector3 {
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/** 移动器使用的帮助器类,用于管理触发器碰撞器交互并调用itriggerlistener。 */
|
||||
class ColliderTriggerHelper {
|
||||
module es {
|
||||
/**
|
||||
* 移动器使用的帮助器类,用于管理触发器碰撞器交互并调用itriggerlistener
|
||||
*/
|
||||
export class ColliderTriggerHelper {
|
||||
private _entity: Entity;
|
||||
/** 存储当前帧中发生的所有活动交集对 */
|
||||
private _activeTriggerIntersections: Pair<Collider>[] = [];
|
||||
@@ -98,4 +101,5 @@ class ColliderTriggerHelper {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
enum PointSectors {
|
||||
module es {
|
||||
export enum PointSectors {
|
||||
center = 0,
|
||||
top = 1,
|
||||
bottom = 2,
|
||||
@@ -8,9 +9,9 @@ enum PointSectors {
|
||||
right = 4,
|
||||
bottomLeft = 10,
|
||||
bottomRight = 6
|
||||
}
|
||||
}
|
||||
|
||||
class Collisions {
|
||||
export class Collisions {
|
||||
public static isLineToLine(a1: Vector2, a2: Vector2, b1: Vector2, b2: Vector2): boolean {
|
||||
let b = Vector2.subtract(a2, a1);
|
||||
let d = Vector2.subtract(b2, b1);
|
||||
@@ -165,4 +166,5 @@ class Collisions {
|
||||
|
||||
return sector;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
class Physics {
|
||||
module es {
|
||||
export class Physics {
|
||||
private static _spatialHash: SpatialHash;
|
||||
/** 调用reset并创建一个新的SpatialHash时使用的单元格大小 */
|
||||
public static spatialHashCellSize = 100;
|
||||
@@ -61,4 +62,5 @@ class Physics {
|
||||
public static debugDraw(secondsToDisplay){
|
||||
this._spatialHash.debugDraw(secondsToDisplay, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
class CollisionResult {
|
||||
module es {
|
||||
export class CollisionResult {
|
||||
public collider: Collider;
|
||||
public minimumTranslationVector: Vector2 = Vector2.zero;
|
||||
public normal: Vector2 = Vector2.zero;
|
||||
@@ -8,4 +9,5 @@ class CollisionResult {
|
||||
this.minimumTranslationVector = Vector2.negate(this.minimumTranslationVector);
|
||||
this.normal = Vector2.negate(this.normal);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
class ShapeCollisions {
|
||||
module es {
|
||||
export class ShapeCollisions {
|
||||
/**
|
||||
* 检查两个多边形之间的碰撞
|
||||
* @param first
|
||||
@@ -299,4 +300,5 @@ class ShapeCollisions {
|
||||
|
||||
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 safeArea: Rectangle;
|
||||
|
||||
@@ -47,9 +48,9 @@ class Layout {
|
||||
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum Alignment {
|
||||
export enum Alignment {
|
||||
none = 0,
|
||||
left = 1,
|
||||
right = 2,
|
||||
@@ -66,4 +67,5 @@ enum Alignment {
|
||||
centerLeft = verticalCenter | left,
|
||||
centerRight = verticalCenter | right,
|
||||
center = verticalCenter | horizontalCenter
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
module es {
|
||||
/**
|
||||
* 通过使用这个类,您可以直观地找到瓶颈和基本的CPU使用情况。
|
||||
*/
|
||||
class TimeRuler {
|
||||
export class TimeRuler {
|
||||
/** 最大条数 8 */
|
||||
public static readonly maxBars = 8;
|
||||
/** */
|
||||
@@ -290,24 +291,24 @@ class TimeRuler {
|
||||
|
||||
// TODO: draw
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 日志信息
|
||||
*/
|
||||
class FrameLog {
|
||||
export class FrameLog {
|
||||
public bars: MarkerCollection[];
|
||||
|
||||
constructor() {
|
||||
this.bars = new Array<MarkerCollection>(TimeRuler.maxBars);
|
||||
this.bars.fill(new MarkerCollection(), 0, TimeRuler.maxBars);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 标记的集合
|
||||
*/
|
||||
class MarkerCollection {
|
||||
export class MarkerCollection {
|
||||
public markers: Marker[] = new Array<Marker>(TimeRuler.maxSamples);
|
||||
public markCount: number = 0;
|
||||
public markerNests: number[] = new Array<number>(TimeRuler.maxNestCall);
|
||||
@@ -317,16 +318,16 @@ class MarkerCollection {
|
||||
this.markers.fill(new Marker(), 0, TimeRuler.maxSamples);
|
||||
this.markerNests.fill(0, 0, TimeRuler.maxNestCall);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Marker {
|
||||
export class Marker {
|
||||
public markerId: number = 0;
|
||||
public beginTime: number = 0;
|
||||
public endTime: number = 0;
|
||||
public color: number = 0x000000;
|
||||
}
|
||||
}
|
||||
|
||||
class MarkerInfo {
|
||||
export class MarkerInfo {
|
||||
public name: string;
|
||||
public logs: MarkerLog[] = new Array<MarkerLog>(TimeRuler.maxBars);
|
||||
|
||||
@@ -334,9 +335,9 @@ class MarkerInfo {
|
||||
this.name = name;
|
||||
this.logs.fill(new MarkerLog(), 0, TimeRuler.maxBars);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MarkerLog {
|
||||
export class MarkerLog {
|
||||
public snapMin: number = 0;
|
||||
public snapMax: number = 0;
|
||||
public snapAvg: number = 0;
|
||||
@@ -346,4 +347,5 @@ class MarkerLog {
|
||||
public samples: number = 0;
|
||||
public color: number = 0x000000;
|
||||
public initialized: boolean = false;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
class ContentManager {
|
||||
module es {
|
||||
export class ContentManager {
|
||||
protected loadedAssets: Map<string, any> = new Map<string, any>();
|
||||
|
||||
/** 异步加载资源 */
|
||||
@@ -38,4 +39,5 @@ class ContentManager {
|
||||
|
||||
this.loadedAssets.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
/** 各种辅助方法来辅助绘图 */
|
||||
class DrawUtils {
|
||||
module es {
|
||||
/** 各种辅助方法来辅助绘图 */
|
||||
export class DrawUtils {
|
||||
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);
|
||||
}
|
||||
@@ -56,4 +57,5 @@ class DrawUtils {
|
||||
colorMatrix[12] = color % 256 / 255;
|
||||
return new egret.ColorMatrixFilter(colorMatrix);
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
-16
@@ -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[]>;
|
||||
|
||||
constructor(){
|
||||
@@ -50,19 +65,5 @@ class Emitter<T> {
|
||||
list[i].func.call(list[i].context, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于包装事件的一个小类
|
||||
*/
|
||||
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[] = [];
|
||||
private _enabled: boolean;
|
||||
|
||||
@@ -43,4 +44,5 @@ class GlobalManager {
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
class TouchState {
|
||||
module es {
|
||||
export class TouchState {
|
||||
public x = 0;
|
||||
public y = 0;
|
||||
public touchPoint: number = -1;
|
||||
@@ -13,9 +14,9 @@ class TouchState {
|
||||
this.touchDown = false;
|
||||
this.touchPoint = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Input {
|
||||
export class Input {
|
||||
private static _init: boolean = false;
|
||||
private static _stage: egret.Stage;
|
||||
private static _previousTouchState: TouchState = new TouchState();
|
||||
@@ -144,4 +145,5 @@ class Input {
|
||||
let scaledPos = new Vector2(position.x - this._resolutionOffset.x, position.y - this._resolutionOffset.y);
|
||||
return Vector2.multiply(scaledPos, this.resolutionScale);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
module es {
|
||||
/**
|
||||
* 可以用于列表池的简单类
|
||||
*/
|
||||
class ListPool {
|
||||
export class ListPool {
|
||||
private static readonly _objectQueue = [];
|
||||
|
||||
/**
|
||||
@@ -51,4 +52,5 @@ class ListPool {
|
||||
this._objectQueue.unshift(obj);
|
||||
obj.length = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
module es {
|
||||
/**
|
||||
* 用于管理一对对象的简单DTO
|
||||
*/
|
||||
class Pair<T> {
|
||||
export class Pair<T> {
|
||||
public first: T;
|
||||
public second: T;
|
||||
|
||||
@@ -17,4 +18,5 @@ class Pair<T> {
|
||||
public equals(other: Pair<T>){
|
||||
return this.first == other.first && this.second == other.second;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
class RectangleExt {
|
||||
module es {
|
||||
export class RectangleExt {
|
||||
/**
|
||||
* 计算两个矩形的并集。结果将是一个包含其他两个的矩形。
|
||||
* @param first
|
||||
@@ -14,4 +15,5 @@ class RectangleExt {
|
||||
result.height = Math.max(first.bottom, result.bottom) - result.y;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
module es {
|
||||
/**
|
||||
* 三角剖分
|
||||
*/
|
||||
class Triangulator {
|
||||
export class Triangulator {
|
||||
/**
|
||||
* 最后一次三角调用中使用的点列表的三角形列表项的索引
|
||||
*/
|
||||
@@ -108,4 +109,5 @@ class Triangulator {
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
class Vector2Ext {
|
||||
module es {
|
||||
export class Vector2Ext {
|
||||
/**
|
||||
* 检查三角形是CCW还是CW
|
||||
* @param a
|
||||
@@ -82,4 +83,5 @@ class Vector2Ext {
|
||||
public static round(vec: Vector2){
|
||||
return new Vector2(Math.round(vec.x), Math.round(vec.y));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user