全部移动至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
+598 -320
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
+598 -320
View File
File diff suppressed because it is too large Load Diff
+2067 -1286
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>;
}
/**
*
*/
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 HashSetweightedNodes
*/
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;
}
}
}
+3 -1
View File
@@ -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 {
}
}
}
}
}
+3 -1
View File
@@ -1,4 +1,6 @@
class DebugDefaults {
module es {
export class DebugDefaults {
public static verletParticle = 0xDC345E;
public static verletConstraintEdge = 0x433E36;
}
}
+6 -3
View File
@@ -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;
}
}
}
+3 -1
View File
@@ -1,4 +1,6 @@
enum CoreEvents{
module es {
export enum CoreEvents{
/** 当场景发生变化时触发 */
SceneChanged,
}
}
+1 -1
View File
@@ -36,7 +36,7 @@ module es {
*/
public static createWithDefaultRenderer(){
let scene = new Scene();
scene.addRenderer(new DefaultRenderer())
scene.addRenderer(new DefaultRenderer());
return scene;
}
+4 -2
View File
@@ -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));
}
}
}
+3 -1
View File
@@ -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(){
}
}
}
+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){
}
@@ -8,4 +9,5 @@ abstract class PassiveSystem extends EntitySystem {
this.begin();
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){
}
@@ -12,4 +13,5 @@ abstract class ProcessingSystem extends EntitySystem {
/** 处理我们的系统 每帧调用 */
public abstract processSystem();
}
}
+1 -1
View File
@@ -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;
}
+3 -1
View File
@@ -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;
}
}
}
+4 -2
View File
@@ -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);
}
}
}
}
+4 -2
View File
@@ -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);
}
}
}
+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){
this.platformInitialize(device);
@@ -24,4 +25,5 @@ class GraphicsCapabilities extends egret.Capabilities {
}
capabilities["language"] = language;
}
}
}
+3 -1
View File
@@ -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(){
}
}
}
+4 -2
View File
@@ -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);
}
}
}
+3 -1
View File
@@ -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;
}
}
}
+4 -2
View File
@@ -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);
}
}
}
+4 -2
View File
@@ -1,9 +1,10 @@
/**
module es {
/**
*
* isFlagSet之外flag参数是一个非移位的标志
* 使(0123)/
*/
class Flags {
export class Flags {
/**
*
*
@@ -59,4 +60,5 @@ class Flags {
public static invertFlags(self: number){
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 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);
}
}
}
+4 -2
View File
@@ -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;
}
}
}
+3 -1
View File
@@ -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);
}
}
}
+4 -2
View File
@@ -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;
}
}
}
+3 -1
View File
@@ -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;
}
}
}
+6 -2
View File
@@ -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 {
}
}
}
}
}
+5 -3
View File
@@ -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;
}
}
}
+3 -1
View File
@@ -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);
}
}
}
+3 -1
View File
@@ -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)
}
}
}
+6 -4
View File
@@ -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
}
}
+16 -14
View File
@@ -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;
}
}
+3 -1
View File
@@ -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();
}
}
}
+4 -2
View File
@@ -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
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[]>;
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;
}
}
+3 -1
View File
@@ -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;
}
}
}
+5 -3
View File
@@ -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);
}
}
}
+4 -2
View File
@@ -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;
}
}
}
+4 -2
View File
@@ -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;
}
}
}
+3 -1
View File
@@ -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;
}
}
}
+4 -2
View File
@@ -1,7 +1,8 @@
/**
module es {
/**
*
*/
class Triangulator {
export class Triangulator {
/**
* 使
*/
@@ -108,4 +109,5 @@ class Triangulator {
return true;
}
}
}
+3 -1
View File
@@ -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));
}
}
}