2020-06-08 11:49:45 +08:00
|
|
|
declare interface Array<T> {
|
2020-08-03 14:45:57 +08:00
|
|
|
findIndex(predicate: (c: T) => boolean): number;
|
|
|
|
|
any(predicate: (c: T) => boolean): boolean;
|
|
|
|
|
firstOrDefault(predicate: (c: T) => boolean): T;
|
|
|
|
|
find(predicate: (c: T) => boolean): T;
|
|
|
|
|
where(predicate: (c: T) => boolean): Array<T>;
|
|
|
|
|
count(predicate: (c: T) => boolean): number;
|
|
|
|
|
findAll(predicate: (c: T) => boolean): Array<T>;
|
|
|
|
|
contains(value: T): boolean;
|
|
|
|
|
removeAll(predicate: (c: T) => boolean): void;
|
2020-07-15 10:53:30 +08:00
|
|
|
remove(element: T): boolean;
|
2020-08-03 14:45:57 +08:00
|
|
|
removeAt(index: number): void;
|
|
|
|
|
removeRange(index: number, count: number): void;
|
2020-06-08 11:49:45 +08:00
|
|
|
select(selector: Function): Array<T>;
|
|
|
|
|
orderBy(keySelector: Function, comparer: Function): Array<T>;
|
|
|
|
|
orderByDescending(keySelector: Function, comparer: Function): Array<T>;
|
|
|
|
|
groupBy(keySelector: Function): Array<T>;
|
2020-08-03 14:45:57 +08:00
|
|
|
sum(selector: Function): number;
|
2020-06-08 11:49:45 +08:00
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
declare module es {
|
|
|
|
|
class PriorityQueueNode {
|
|
|
|
|
priority: number;
|
|
|
|
|
insertionIndex: number;
|
|
|
|
|
queueIndex: number;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class AStarPathfinder {
|
|
|
|
|
static search<T>(graph: IAstarGraph<T>, start: T, goal: T): T[];
|
2020-07-28 16:25:20 +08:00
|
|
|
static recontructPath<T>(cameFrom: Map<T, T>, start: T, goal: T): T[];
|
2020-07-23 11:00:46 +08:00
|
|
|
private static hasKey;
|
|
|
|
|
private static getKey;
|
|
|
|
|
}
|
|
|
|
|
class AStarNode<T> extends PriorityQueueNode {
|
|
|
|
|
data: T;
|
|
|
|
|
constructor(data: T);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class AstarGridGraph implements IAstarGraph<Vector2> {
|
|
|
|
|
dirs: Vector2[];
|
|
|
|
|
walls: Vector2[];
|
|
|
|
|
weightedNodes: Vector2[];
|
|
|
|
|
defaultWeight: number;
|
|
|
|
|
weightedNodeWeight: number;
|
|
|
|
|
private _width;
|
|
|
|
|
private _height;
|
|
|
|
|
private _neighbors;
|
|
|
|
|
constructor(width: number, height: number);
|
|
|
|
|
isNodeInBounds(node: Vector2): boolean;
|
|
|
|
|
isNodePassable(node: Vector2): boolean;
|
|
|
|
|
search(start: Vector2, goal: Vector2): Vector2[];
|
|
|
|
|
getNeighbors(node: Vector2): Vector2[];
|
|
|
|
|
cost(from: Vector2, to: Vector2): number;
|
|
|
|
|
heuristic(node: Vector2, goal: Vector2): number;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
interface IAstarGraph<T> {
|
|
|
|
|
getNeighbors(node: T): Array<T>;
|
|
|
|
|
cost(from: T, to: T): number;
|
|
|
|
|
heuristic(node: T, goal: T): any;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class PriorityQueue<T extends PriorityQueueNode> {
|
|
|
|
|
private _numNodes;
|
|
|
|
|
private _nodes;
|
|
|
|
|
private _numNodesEverEnqueued;
|
|
|
|
|
constructor(maxNodes: number);
|
|
|
|
|
readonly count: number;
|
|
|
|
|
readonly maxSize: number;
|
2020-07-28 16:25:20 +08:00
|
|
|
clear(): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
contains(node: T): boolean;
|
|
|
|
|
enqueue(node: T, priority: number): void;
|
|
|
|
|
dequeue(): T;
|
|
|
|
|
remove(node: T): void;
|
|
|
|
|
isValidQueue(): boolean;
|
|
|
|
|
private onNodeUpdated;
|
|
|
|
|
private cascadeDown;
|
|
|
|
|
private cascadeUp;
|
|
|
|
|
private swap;
|
|
|
|
|
private hasHigherPriority;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class BreadthFirstPathfinder {
|
|
|
|
|
static search<T>(graph: IUnweightedGraph<T>, start: T, goal: T): T[];
|
|
|
|
|
private static hasKey;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
interface IUnweightedGraph<T> {
|
|
|
|
|
getNeighbors(node: T): T[];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class UnweightedGraph<T> implements IUnweightedGraph<T> {
|
|
|
|
|
edges: Map<T, T[]>;
|
|
|
|
|
addEdgesForNode(node: T, edges: T[]): this;
|
|
|
|
|
getNeighbors(node: T): T[];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class Vector2 {
|
2020-07-28 16:25:20 +08:00
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
constructor(x?: number, y?: number);
|
2020-07-23 11:00:46 +08:00
|
|
|
static readonly zero: Vector2;
|
|
|
|
|
static readonly one: Vector2;
|
|
|
|
|
static readonly unitX: Vector2;
|
|
|
|
|
static readonly unitY: Vector2;
|
|
|
|
|
static add(value1: Vector2, value2: Vector2): Vector2;
|
|
|
|
|
static divide(value1: Vector2, value2: Vector2): Vector2;
|
|
|
|
|
static multiply(value1: Vector2, value2: Vector2): Vector2;
|
|
|
|
|
static subtract(value1: Vector2, value2: Vector2): Vector2;
|
|
|
|
|
static normalize(value: Vector2): Vector2;
|
|
|
|
|
static dot(value1: Vector2, value2: Vector2): number;
|
|
|
|
|
static distanceSquared(value1: Vector2, value2: Vector2): number;
|
|
|
|
|
static clamp(value1: Vector2, min: Vector2, max: Vector2): Vector2;
|
|
|
|
|
static lerp(value1: Vector2, value2: Vector2, amount: number): Vector2;
|
|
|
|
|
static transform(position: Vector2, matrix: Matrix2D): Vector2;
|
|
|
|
|
static distance(value1: Vector2, value2: Vector2): number;
|
2020-08-07 15:34:42 +08:00
|
|
|
static angle(from: Vector2, to: Vector2): number;
|
2020-07-23 11:00:46 +08:00
|
|
|
static negate(value: Vector2): Vector2;
|
2020-07-28 16:25:20 +08:00
|
|
|
add(value: Vector2): Vector2;
|
|
|
|
|
divide(value: Vector2): Vector2;
|
|
|
|
|
multiply(value: Vector2): Vector2;
|
|
|
|
|
subtract(value: Vector2): this;
|
2020-08-25 14:21:37 +08:00
|
|
|
normalize(): void;
|
2020-07-28 16:25:20 +08:00
|
|
|
length(): number;
|
2020-08-03 14:45:57 +08:00
|
|
|
lengthSquared(): number;
|
2020-07-28 16:25:20 +08:00
|
|
|
round(): Vector2;
|
2020-07-27 16:10:36 +08:00
|
|
|
equals(other: Vector2): boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class UnweightedGridGraph implements IUnweightedGraph<Vector2> {
|
|
|
|
|
private static readonly CARDINAL_DIRS;
|
|
|
|
|
private static readonly COMPASS_DIRS;
|
|
|
|
|
walls: Vector2[];
|
|
|
|
|
private _width;
|
|
|
|
|
private _hegiht;
|
|
|
|
|
private _dirs;
|
|
|
|
|
private _neighbors;
|
|
|
|
|
constructor(width: number, height: number, allowDiagonalSearch?: boolean);
|
|
|
|
|
isNodeInBounds(node: Vector2): boolean;
|
|
|
|
|
isNodePassable(node: Vector2): boolean;
|
|
|
|
|
getNeighbors(node: Vector2): Vector2[];
|
|
|
|
|
search(start: Vector2, goal: Vector2): Vector2[];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
interface IWeightedGraph<T> {
|
|
|
|
|
getNeighbors(node: T): T[];
|
|
|
|
|
cost(from: T, to: T): number;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class WeightedGridGraph implements IWeightedGraph<Vector2> {
|
|
|
|
|
static readonly CARDINAL_DIRS: Vector2[];
|
|
|
|
|
private static readonly COMPASS_DIRS;
|
|
|
|
|
walls: Vector2[];
|
|
|
|
|
weightedNodes: Vector2[];
|
|
|
|
|
defaultWeight: number;
|
|
|
|
|
weightedNodeWeight: number;
|
|
|
|
|
private _width;
|
|
|
|
|
private _height;
|
|
|
|
|
private _dirs;
|
|
|
|
|
private _neighbors;
|
|
|
|
|
constructor(width: number, height: number, allowDiagonalSearch?: boolean);
|
|
|
|
|
isNodeInBounds(node: Vector2): boolean;
|
|
|
|
|
isNodePassable(node: Vector2): boolean;
|
|
|
|
|
search(start: Vector2, goal: Vector2): Vector2[];
|
|
|
|
|
getNeighbors(node: Vector2): Vector2[];
|
|
|
|
|
cost(from: Vector2, to: Vector2): number;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class WeightedNode<T> extends PriorityQueueNode {
|
|
|
|
|
data: T;
|
|
|
|
|
constructor(data: T);
|
|
|
|
|
}
|
|
|
|
|
class WeightedPathfinder {
|
|
|
|
|
static search<T>(graph: IWeightedGraph<T>, start: T, goal: T): T[];
|
2020-07-28 16:25:20 +08:00
|
|
|
static recontructPath<T>(cameFrom: Map<T, T>, start: T, goal: T): T[];
|
2020-07-23 11:00:46 +08:00
|
|
|
private static hasKey;
|
|
|
|
|
private static getKey;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
2020-08-24 09:06:25 +08:00
|
|
|
class Core extends egret.DisplayObjectContainer {
|
|
|
|
|
static emitter: Emitter<CoreEvents>;
|
|
|
|
|
static debugRenderEndabled: boolean;
|
|
|
|
|
static graphicsDevice: GraphicsDevice;
|
|
|
|
|
static content: ContentManager;
|
|
|
|
|
static _instance: Core;
|
|
|
|
|
_nextScene: Scene;
|
|
|
|
|
_sceneTransition: SceneTransition;
|
|
|
|
|
_globalManagers: GlobalManager[];
|
2020-08-28 19:12:21 +08:00
|
|
|
_coroutineManager: CoroutineManager;
|
2020-08-26 19:56:48 +08:00
|
|
|
_timerManager: TimerManager;
|
2020-08-24 09:06:25 +08:00
|
|
|
constructor();
|
|
|
|
|
static readonly Instance: Core;
|
|
|
|
|
_scene: Scene;
|
|
|
|
|
static scene: Scene;
|
|
|
|
|
static startSceneTransition<T extends SceneTransition>(sceneTransition: T): T;
|
|
|
|
|
static registerGlobalManager(manager: es.GlobalManager): void;
|
|
|
|
|
static unregisterGlobalManager(manager: es.GlobalManager): void;
|
|
|
|
|
static getGlobalManager<T extends es.GlobalManager>(type: any): T;
|
2020-09-01 11:51:03 +08:00
|
|
|
static startCoroutine(enumerator: Iterator<any>): CoroutineImpl;
|
2020-08-26 19:56:48 +08:00
|
|
|
static schedule(timeInSeconds: number, repeats: boolean, context: any, onTime: (timer: ITimer) => void): Timer;
|
2020-08-24 09:06:25 +08:00
|
|
|
onOrientationChanged(): void;
|
|
|
|
|
draw(): Promise<void>;
|
|
|
|
|
startDebugUpdate(): void;
|
|
|
|
|
endDebugUpdate(): void;
|
|
|
|
|
onSceneChanged(): void;
|
|
|
|
|
protected onGraphicsDeviceReset(): void;
|
|
|
|
|
protected initialize(): void;
|
|
|
|
|
protected update(): Promise<void>;
|
|
|
|
|
private onAddToStage;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class Colors {
|
|
|
|
|
static renderableBounds: number;
|
|
|
|
|
static renderableCenter: number;
|
|
|
|
|
static colliderBounds: number;
|
2020-08-25 14:21:37 +08:00
|
|
|
static colliderEdge: number;
|
|
|
|
|
static colliderPosition: number;
|
|
|
|
|
static colliderCenter: number;
|
2020-08-24 09:06:25 +08:00
|
|
|
}
|
|
|
|
|
class Size {
|
|
|
|
|
static readonly lineSizeMultiplier: number;
|
|
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
class Debug {
|
|
|
|
|
private static _debugDrawItems;
|
|
|
|
|
static drawHollowRect(rectanle: Rectangle, color: number, duration?: number): void;
|
|
|
|
|
static render(): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class DebugDefaults {
|
|
|
|
|
static verletParticle: number;
|
|
|
|
|
static verletConstraintEdge: number;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
enum DebugDrawType {
|
|
|
|
|
line = 0,
|
|
|
|
|
hollowRectangle = 1,
|
|
|
|
|
pixel = 2,
|
|
|
|
|
text = 3
|
|
|
|
|
}
|
|
|
|
|
class DebugDrawItem {
|
|
|
|
|
rectangle: Rectangle;
|
|
|
|
|
color: number;
|
|
|
|
|
duration: number;
|
|
|
|
|
drawType: DebugDrawType;
|
|
|
|
|
text: string;
|
|
|
|
|
start: Vector2;
|
|
|
|
|
end: Vector2;
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
size: number;
|
|
|
|
|
constructor(rectangle: Rectangle, color: number, duration: number);
|
|
|
|
|
draw(shape: egret.Shape): boolean;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
2020-08-03 14:45:57 +08:00
|
|
|
abstract class Component extends egret.HashObject {
|
2020-07-23 11:00:46 +08:00
|
|
|
entity: Entity;
|
|
|
|
|
updateInterval: number;
|
2020-08-24 09:06:25 +08:00
|
|
|
debugDisplayObject: egret.DisplayObjectContainer;
|
2020-07-28 16:25:20 +08:00
|
|
|
readonly transform: Transform;
|
2020-07-23 11:00:46 +08:00
|
|
|
private _enabled;
|
2020-07-28 16:25:20 +08:00
|
|
|
enabled: boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
private _updateOrder;
|
2020-07-28 16:25:20 +08:00
|
|
|
updateOrder: number;
|
2020-07-23 11:00:46 +08:00
|
|
|
initialize(): void;
|
|
|
|
|
onAddedToEntity(): void;
|
|
|
|
|
onRemovedFromEntity(): void;
|
|
|
|
|
onEntityTransformChanged(comp: transform.Component): void;
|
2020-08-28 18:04:50 +08:00
|
|
|
debugRender(camera: Camera): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
onEnabled(): void;
|
|
|
|
|
onDisabled(): void;
|
|
|
|
|
update(): void;
|
|
|
|
|
setEnabled(isEnabled: boolean): this;
|
|
|
|
|
setUpdateOrder(updateOrder: number): this;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
enum CoreEvents {
|
2020-07-23 15:39:18 +08:00
|
|
|
GraphicsDeviceReset = 0,
|
|
|
|
|
SceneChanged = 1,
|
|
|
|
|
OrientationChanged = 2
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class Entity {
|
|
|
|
|
static _idGenerator: number;
|
|
|
|
|
scene: Scene;
|
|
|
|
|
name: string;
|
|
|
|
|
readonly id: number;
|
|
|
|
|
readonly transform: Transform;
|
|
|
|
|
readonly components: ComponentList;
|
|
|
|
|
updateInterval: number;
|
2020-07-28 16:25:20 +08:00
|
|
|
componentBits: BitSet;
|
|
|
|
|
constructor(name: string);
|
2020-07-23 11:00:46 +08:00
|
|
|
_isDestroyed: boolean;
|
|
|
|
|
readonly isDestroyed: boolean;
|
|
|
|
|
private _tag;
|
2020-07-28 16:25:20 +08:00
|
|
|
tag: number;
|
2020-07-23 11:00:46 +08:00
|
|
|
private _enabled;
|
2020-07-28 16:25:20 +08:00
|
|
|
enabled: boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
private _updateOrder;
|
2020-07-28 16:25:20 +08:00
|
|
|
updateOrder: number;
|
2020-07-23 11:00:46 +08:00
|
|
|
parent: Transform;
|
|
|
|
|
readonly childCount: number;
|
|
|
|
|
position: Vector2;
|
2020-07-24 15:29:07 +08:00
|
|
|
localPosition: Vector2;
|
2020-07-23 11:00:46 +08:00
|
|
|
rotation: number;
|
2020-07-24 15:29:07 +08:00
|
|
|
rotationDegrees: number;
|
|
|
|
|
localRotation: number;
|
|
|
|
|
localRotationDegrees: number;
|
2020-07-23 11:00:46 +08:00
|
|
|
scale: Vector2;
|
2020-07-24 15:29:07 +08:00
|
|
|
localScale: Vector2;
|
|
|
|
|
readonly worldInverseTransform: Matrix2D;
|
|
|
|
|
readonly localToWorldTransform: Matrix2D;
|
|
|
|
|
readonly worldToLocalTransform: Matrix2D;
|
2020-07-23 11:00:46 +08:00
|
|
|
onTransformChanged(comp: transform.Component): void;
|
|
|
|
|
setTag(tag: number): Entity;
|
|
|
|
|
setEnabled(isEnabled: boolean): this;
|
|
|
|
|
setUpdateOrder(updateOrder: number): this;
|
|
|
|
|
destroy(): void;
|
|
|
|
|
detachFromScene(): void;
|
|
|
|
|
attachToScene(newScene: Scene): void;
|
|
|
|
|
onAddedToScene(): void;
|
|
|
|
|
onRemovedFromScene(): void;
|
|
|
|
|
update(): void;
|
2020-08-28 18:04:50 +08:00
|
|
|
debugRender(camera: Camera): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
addComponent<T extends Component>(component: T): T;
|
|
|
|
|
getComponent<T extends Component>(type: any): T;
|
|
|
|
|
hasComponent<T extends Component>(type: any): boolean;
|
|
|
|
|
getOrCreateComponent<T extends Component>(type: T): T;
|
|
|
|
|
getComponents(typeName: string | any, componentList?: any): any;
|
|
|
|
|
removeComponent(component: Component): void;
|
|
|
|
|
removeComponentForType<T extends Component>(type: any): boolean;
|
|
|
|
|
removeAllComponents(): void;
|
2020-07-24 15:29:07 +08:00
|
|
|
compareTo(other: Entity): number;
|
2020-07-23 11:00:46 +08:00
|
|
|
toString(): string;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class Scene extends egret.DisplayObjectContainer {
|
|
|
|
|
camera: Camera;
|
|
|
|
|
readonly content: ContentManager;
|
|
|
|
|
enablePostProcessing: boolean;
|
|
|
|
|
readonly entities: EntityList;
|
|
|
|
|
readonly renderableComponents: RenderableComponentList;
|
|
|
|
|
readonly entityProcessors: EntityProcessorList;
|
2020-08-12 19:57:06 +08:00
|
|
|
_screenshotRequestCallback: Function;
|
2020-08-11 11:07:20 +08:00
|
|
|
readonly _sceneComponents: SceneComponent[];
|
2020-07-23 11:00:46 +08:00
|
|
|
_renderers: Renderer[];
|
|
|
|
|
readonly _postProcessors: PostProcessor[];
|
|
|
|
|
_didSceneBegin: any;
|
2020-09-15 09:39:26 +08:00
|
|
|
dynamicBatch: boolean;
|
2020-09-16 14:48:15 +08:00
|
|
|
optimizeCost: boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
constructor();
|
2020-07-28 16:25:20 +08:00
|
|
|
static createWithDefaultRenderer(): Scene;
|
2020-07-23 11:00:46 +08:00
|
|
|
initialize(): void;
|
|
|
|
|
onStart(): Promise<void>;
|
|
|
|
|
unload(): void;
|
|
|
|
|
onActive(): void;
|
|
|
|
|
onDeactive(): void;
|
2020-08-25 17:28:22 +08:00
|
|
|
begin(): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
end(): void;
|
2020-08-26 19:56:48 +08:00
|
|
|
updateResolutionScaler(): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
update(): void;
|
|
|
|
|
render(): void;
|
2020-09-15 09:39:26 +08:00
|
|
|
dynamicInBatch(): void;
|
2020-09-16 14:48:15 +08:00
|
|
|
private optimizeCombine;
|
2020-07-23 11:00:46 +08:00
|
|
|
postRender(): void;
|
2020-08-12 19:57:06 +08:00
|
|
|
requestScreenshot(callback: Function): void;
|
2020-08-11 11:07:20 +08:00
|
|
|
addSceneComponent<T extends SceneComponent>(component: T): T;
|
|
|
|
|
getSceneComponent<T extends SceneComponent>(type: any): T;
|
|
|
|
|
getOrCreateSceneComponent<T extends SceneComponent>(type: any): T;
|
|
|
|
|
removeSceneComponent(component: SceneComponent): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
addRenderer<T extends Renderer>(renderer: T): T;
|
|
|
|
|
getRenderer<T extends Renderer>(type: any): T;
|
|
|
|
|
removeRenderer(renderer: Renderer): void;
|
|
|
|
|
addPostProcessor<T extends PostProcessor>(postProcessor: T): T;
|
|
|
|
|
getPostProcessor<T extends PostProcessor>(type: any): T;
|
|
|
|
|
removePostProcessor(postProcessor: PostProcessor): void;
|
|
|
|
|
createEntity(name: string): Entity;
|
2020-08-08 09:50:40 +08:00
|
|
|
createEntityAsync(name: string): Promise<Entity>;
|
2020-07-23 11:00:46 +08:00
|
|
|
addEntity(entity: Entity): Entity;
|
|
|
|
|
destroyAllEntities(): void;
|
|
|
|
|
findEntity(name: string): Entity;
|
|
|
|
|
findEntitiesWithTag(tag: number): Entity[];
|
|
|
|
|
entitiesOfType<T extends Entity>(type: any): T[];
|
|
|
|
|
findComponentOfType<T extends Component>(type: any): T;
|
|
|
|
|
findComponentsOfType<T extends Component>(type: any): T[];
|
|
|
|
|
addEntityProcessor(processor: EntitySystem): EntitySystem;
|
|
|
|
|
removeEntityProcessor(processor: EntitySystem): void;
|
|
|
|
|
getEntityProcessor<T extends EntitySystem>(): T;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module transform {
|
|
|
|
|
enum Component {
|
|
|
|
|
position = 0,
|
|
|
|
|
scale = 1,
|
|
|
|
|
rotation = 2
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
2020-07-27 16:10:36 +08:00
|
|
|
import HashObject = egret.HashObject;
|
2020-07-23 11:00:46 +08:00
|
|
|
enum DirtyType {
|
|
|
|
|
clean = 0,
|
|
|
|
|
positionDirty = 1,
|
|
|
|
|
scaleDirty = 2,
|
|
|
|
|
rotationDirty = 3
|
|
|
|
|
}
|
2020-07-27 16:10:36 +08:00
|
|
|
class Transform extends HashObject {
|
2020-07-23 11:00:46 +08:00
|
|
|
readonly entity: Entity;
|
|
|
|
|
hierarchyDirty: DirtyType;
|
2020-07-24 15:29:07 +08:00
|
|
|
_localDirty: boolean;
|
|
|
|
|
_localPositionDirty: boolean;
|
|
|
|
|
_localScaleDirty: boolean;
|
|
|
|
|
_localRotationDirty: boolean;
|
|
|
|
|
_positionDirty: boolean;
|
|
|
|
|
_worldToLocalDirty: boolean;
|
|
|
|
|
_worldInverseDirty: boolean;
|
|
|
|
|
_localTransform: Matrix2D;
|
|
|
|
|
_worldTransform: Matrix2D;
|
|
|
|
|
_rotationMatrix: Matrix2D;
|
|
|
|
|
_translationMatrix: Matrix2D;
|
|
|
|
|
_scaleMatrix: Matrix2D;
|
2020-07-28 16:25:20 +08:00
|
|
|
_children: Transform[];
|
|
|
|
|
constructor(entity: Entity);
|
|
|
|
|
readonly childCount: number;
|
|
|
|
|
rotationDegrees: number;
|
|
|
|
|
localRotationDegrees: number;
|
|
|
|
|
readonly localToWorldTransform: Matrix2D;
|
|
|
|
|
_parent: Transform;
|
|
|
|
|
parent: Transform;
|
|
|
|
|
_worldToLocalTransform: Matrix2D;
|
|
|
|
|
readonly worldToLocalTransform: Matrix2D;
|
|
|
|
|
_worldInverseTransform: Matrix2D;
|
|
|
|
|
readonly worldInverseTransform: Matrix2D;
|
2020-07-24 15:29:07 +08:00
|
|
|
_position: Vector2;
|
2020-07-28 16:25:20 +08:00
|
|
|
position: Vector2;
|
2020-07-24 15:29:07 +08:00
|
|
|
_scale: Vector2;
|
2020-07-28 16:25:20 +08:00
|
|
|
scale: Vector2;
|
2020-07-24 15:29:07 +08:00
|
|
|
_rotation: number;
|
2020-07-28 16:25:20 +08:00
|
|
|
rotation: number;
|
2020-07-24 15:29:07 +08:00
|
|
|
_localPosition: Vector2;
|
2020-07-28 16:25:20 +08:00
|
|
|
localPosition: Vector2;
|
2020-07-24 15:29:07 +08:00
|
|
|
_localScale: Vector2;
|
2020-07-28 16:25:20 +08:00
|
|
|
localScale: Vector2;
|
2020-07-24 15:29:07 +08:00
|
|
|
_localRotation: number;
|
2020-07-28 16:25:20 +08:00
|
|
|
localRotation: number;
|
2020-07-23 11:00:46 +08:00
|
|
|
getChild(index: number): Transform;
|
|
|
|
|
setParent(parent: Transform): Transform;
|
|
|
|
|
setPosition(x: number, y: number): Transform;
|
2020-07-24 15:29:07 +08:00
|
|
|
setLocalPosition(localPosition: Vector2): Transform;
|
|
|
|
|
setRotation(radians: number): Transform;
|
|
|
|
|
setRotationDegrees(degrees: number): Transform;
|
2020-07-23 11:00:46 +08:00
|
|
|
lookAt(pos: Vector2): void;
|
2020-07-24 15:29:07 +08:00
|
|
|
setLocalRotation(radians: number): this;
|
|
|
|
|
setLocalRotationDegrees(degrees: number): Transform;
|
|
|
|
|
setScale(scale: Vector2): Transform;
|
|
|
|
|
setLocalScale(scale: Vector2): Transform;
|
2020-07-23 11:00:46 +08:00
|
|
|
roundPosition(): void;
|
2020-07-24 15:29:07 +08:00
|
|
|
updateTransform(): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
setDirty(dirtyFlagType: DirtyType): void;
|
|
|
|
|
copyFrom(transform: Transform): void;
|
2020-07-24 15:29:07 +08:00
|
|
|
toString(): string;
|
2020-07-27 16:10:36 +08:00
|
|
|
equals(other: Transform): boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
2020-07-23 13:25:10 +08:00
|
|
|
class CameraInset {
|
|
|
|
|
left: number;
|
|
|
|
|
right: number;
|
|
|
|
|
top: number;
|
|
|
|
|
bottom: number;
|
|
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
class Camera extends Component {
|
2020-07-23 13:25:10 +08:00
|
|
|
_inset: CameraInset;
|
|
|
|
|
_areMatrixedDirty: boolean;
|
|
|
|
|
_areBoundsDirty: boolean;
|
|
|
|
|
_isProjectionMatrixDirty: boolean;
|
2020-08-26 19:56:48 +08:00
|
|
|
constructor();
|
2020-07-28 16:25:20 +08:00
|
|
|
position: Vector2;
|
|
|
|
|
rotation: number;
|
2020-08-26 19:56:48 +08:00
|
|
|
rawZoom: number;
|
|
|
|
|
_zoom: number;
|
2020-07-28 16:25:20 +08:00
|
|
|
zoom: number;
|
|
|
|
|
_minimumZoom: number;
|
|
|
|
|
minimumZoom: number;
|
|
|
|
|
_maximumZoom: number;
|
|
|
|
|
maximumZoom: number;
|
|
|
|
|
_bounds: Rectangle;
|
|
|
|
|
readonly bounds: Rectangle;
|
|
|
|
|
_transformMatrix: Matrix2D;
|
|
|
|
|
readonly transformMatrix: Matrix2D;
|
|
|
|
|
_inverseTransformMatrix: Matrix2D;
|
|
|
|
|
readonly inverseTransformMatrix: Matrix2D;
|
|
|
|
|
_origin: Vector2;
|
|
|
|
|
origin: Vector2;
|
2020-07-23 13:25:10 +08:00
|
|
|
setInset(left: number, right: number, top: number, bottom: number): Camera;
|
2020-07-23 11:00:46 +08:00
|
|
|
setPosition(position: Vector2): this;
|
|
|
|
|
setRotation(rotation: number): Camera;
|
|
|
|
|
setZoom(zoom: number): Camera;
|
|
|
|
|
setMinimumZoom(minZoom: number): Camera;
|
|
|
|
|
setMaximumZoom(maxZoom: number): Camera;
|
2020-08-26 19:56:48 +08:00
|
|
|
forceMatrixUpdate(): void;
|
2020-07-23 13:25:10 +08:00
|
|
|
onEntityTransformChanged(comp: transform.Component): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
zoomIn(deltaZoom: number): void;
|
|
|
|
|
zoomOut(deltaZoom: number): void;
|
2020-07-23 13:25:10 +08:00
|
|
|
worldToScreenPoint(worldPosition: Vector2): Vector2;
|
|
|
|
|
screenToWorldPoint(screenPosition: Vector2): Vector2;
|
2020-08-26 19:56:48 +08:00
|
|
|
onSceneRenderTargetSizeChanged(newWidth: number, newHeight: number): void;
|
2020-07-23 13:25:10 +08:00
|
|
|
mouseToWorldPoint(): Vector2;
|
2020-07-28 16:25:20 +08:00
|
|
|
protected updateMatrixes(): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
2020-08-11 11:07:20 +08:00
|
|
|
declare module es {
|
|
|
|
|
class CameraShake extends Component {
|
|
|
|
|
_shakeDirection: Vector2;
|
|
|
|
|
_shakeOffset: Vector2;
|
|
|
|
|
_shakeIntensity: number;
|
|
|
|
|
_shakeDegredation: number;
|
|
|
|
|
shake(shakeIntensify?: number, shakeDegredation?: number, shakeDirection?: Vector2): void;
|
|
|
|
|
update(): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
declare module es {
|
|
|
|
|
class ComponentPool<T extends PooledComponent> {
|
|
|
|
|
private _cache;
|
|
|
|
|
private _type;
|
|
|
|
|
constructor(typeClass: any);
|
|
|
|
|
obtain(): T;
|
|
|
|
|
free(component: T): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-26 19:56:48 +08:00
|
|
|
declare module es {
|
|
|
|
|
enum CameraStyle {
|
|
|
|
|
lockOn = 0,
|
|
|
|
|
cameraWindow = 1
|
|
|
|
|
}
|
|
|
|
|
class FollowCamera extends Component {
|
|
|
|
|
camera: Camera;
|
|
|
|
|
followLerp: number;
|
|
|
|
|
deadzone: Rectangle;
|
|
|
|
|
focusOffset: Vector2;
|
|
|
|
|
mapLockEnabled: boolean;
|
|
|
|
|
mapSize: Rectangle;
|
|
|
|
|
_targetEntity: Entity;
|
|
|
|
|
_targetCollider: Collider;
|
|
|
|
|
_desiredPositionDelta: Vector2;
|
|
|
|
|
_cameraStyle: CameraStyle;
|
|
|
|
|
_worldSpaceDeadZone: Rectangle;
|
|
|
|
|
private rectShape;
|
|
|
|
|
constructor(targetEntity?: Entity, camera?: Camera, cameraStyle?: CameraStyle);
|
|
|
|
|
onAddedToEntity(): void;
|
|
|
|
|
onGraphicsDeviceReset(): void;
|
|
|
|
|
update(): void;
|
2020-08-28 18:04:50 +08:00
|
|
|
debugRender(camera: Camera): void;
|
2020-08-26 19:56:48 +08:00
|
|
|
clampToMapSize(position: Vector2): Vector2;
|
|
|
|
|
follow(targetEntity: Entity, cameraStyle?: CameraStyle): void;
|
|
|
|
|
updateFollow(): void;
|
|
|
|
|
setCenteredDeadzone(width: number, height: number): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
declare module es {
|
|
|
|
|
class IUpdatableComparer {
|
|
|
|
|
compare(a: Component, b: Component): number;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
abstract class PooledComponent extends Component {
|
|
|
|
|
abstract reset(): any;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-09-01 11:51:03 +08:00
|
|
|
declare module es {
|
|
|
|
|
class SceneComponent {
|
|
|
|
|
scene: Scene;
|
|
|
|
|
enabled: boolean;
|
|
|
|
|
updateOrder: number;
|
|
|
|
|
_enabled: boolean;
|
|
|
|
|
onEnabled(): void;
|
|
|
|
|
onDisabled(): void;
|
|
|
|
|
onRemovedFromScene(): void;
|
|
|
|
|
update(): void;
|
|
|
|
|
setEnabled(isEnabled: boolean): SceneComponent;
|
|
|
|
|
setUpdateOrder(updateOrder: number): this;
|
|
|
|
|
compareTo(other: SceneComponent): number;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class CollisionState {
|
|
|
|
|
right: boolean;
|
|
|
|
|
left: boolean;
|
|
|
|
|
above: boolean;
|
|
|
|
|
below: boolean;
|
|
|
|
|
becameGroundedThisFrame: boolean;
|
|
|
|
|
wasGroundedLastFrame: boolean;
|
|
|
|
|
isGroundedOnOnewayPlatform: boolean;
|
|
|
|
|
slopAngle: number;
|
|
|
|
|
readonly hasCollision: boolean;
|
|
|
|
|
_movementRemainderX: SubpixelNumber;
|
|
|
|
|
_movementRemainderY: SubpixelNumber;
|
|
|
|
|
reset(): void;
|
|
|
|
|
toString(): string;
|
|
|
|
|
}
|
|
|
|
|
class TiledMapMover extends Component {
|
|
|
|
|
colliderHorizontalInset: number;
|
|
|
|
|
colliderVerticalInset: number;
|
|
|
|
|
_boxColliderBounds: Rectangle;
|
|
|
|
|
constructor();
|
|
|
|
|
testCollisions(motion: Vector2, boxColliderBounds: Rectangle, collisionState: CollisionState): void;
|
|
|
|
|
testMapCollision(collisionRect: Rectangle, direction: Edge, collisionState: CollisionState, collisionResponse: number): void;
|
|
|
|
|
collisionRectForSide(side: Edge, motion: number): Rectangle;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
interface ITriggerListener {
|
|
|
|
|
onTriggerEnter(other: Collider, local: Collider): any;
|
|
|
|
|
onTriggerExit(other: Collider, local: Collider): any;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class Mover extends Component {
|
|
|
|
|
private _triggerHelper;
|
|
|
|
|
onAddedToEntity(): void;
|
|
|
|
|
calculateMovement(motion: Vector2, collisionResult: CollisionResult): boolean;
|
|
|
|
|
applyMovement(motion: Vector2): void;
|
|
|
|
|
move(motion: Vector2, collisionResult: CollisionResult): boolean;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class ProjectileMover extends Component {
|
|
|
|
|
private _tempTriggerList;
|
|
|
|
|
private _collider;
|
|
|
|
|
onAddedToEntity(): void;
|
|
|
|
|
move(motion: Vector2): boolean;
|
|
|
|
|
private notifyTriggerListeners;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
abstract class Collider extends Component {
|
|
|
|
|
shape: Shape;
|
|
|
|
|
isTrigger: boolean;
|
|
|
|
|
physicsLayer: Ref<number>;
|
|
|
|
|
collidesWithLayers: Ref<number>;
|
|
|
|
|
shouldColliderScaleAndRotateWithTransform: boolean;
|
|
|
|
|
registeredPhysicsBounds: Rectangle;
|
|
|
|
|
_localOffsetLength: number;
|
|
|
|
|
_isPositionDirty: boolean;
|
|
|
|
|
_isRotationDirty: boolean;
|
|
|
|
|
protected _colliderRequiresAutoSizing: any;
|
|
|
|
|
protected _isParentEntityAddedToScene: any;
|
|
|
|
|
protected _isColliderRegistered: any;
|
|
|
|
|
readonly absolutePosition: Vector2;
|
|
|
|
|
readonly rotation: number;
|
|
|
|
|
readonly bounds: Rectangle;
|
|
|
|
|
protected _localOffset: Vector2;
|
|
|
|
|
localOffset: Vector2;
|
|
|
|
|
setLocalOffset(offset: Vector2): Collider;
|
|
|
|
|
setShouldColliderScaleAndRotateWithTransform(shouldColliderScaleAndRotationWithTransform: boolean): Collider;
|
|
|
|
|
onAddedToEntity(): void;
|
|
|
|
|
onRemovedFromEntity(): void;
|
|
|
|
|
onEntityTransformChanged(comp: transform.Component): void;
|
|
|
|
|
onEnabled(): void;
|
|
|
|
|
onDisabled(): void;
|
|
|
|
|
registerColliderWithPhysicsSystem(): void;
|
|
|
|
|
unregisterColliderWithPhysicsSystem(): void;
|
|
|
|
|
overlaps(other: Collider): boolean;
|
|
|
|
|
collidesWith(collider: Collider, motion: Vector2, result: CollisionResult): boolean;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class BoxCollider extends Collider {
|
|
|
|
|
hollowShape: egret.Shape;
|
|
|
|
|
polygonShape: egret.Shape;
|
|
|
|
|
pixelShape1: egret.Shape;
|
|
|
|
|
pixelShape2: egret.Shape;
|
|
|
|
|
constructor(x?: number, y?: number, width?: number, height?: number);
|
|
|
|
|
width: number;
|
|
|
|
|
height: number;
|
|
|
|
|
setSize(width: number, height: number): this;
|
|
|
|
|
setWidth(width: number): BoxCollider;
|
|
|
|
|
setHeight(height: number): void;
|
|
|
|
|
debugRender(camera: Camera): void;
|
|
|
|
|
toString(): string;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class CircleCollider extends Collider {
|
|
|
|
|
private rectShape;
|
|
|
|
|
private circleShape;
|
|
|
|
|
private pixelShape1;
|
|
|
|
|
private pixelShape2;
|
|
|
|
|
constructor(radius?: number);
|
|
|
|
|
radius: number;
|
|
|
|
|
setRadius(radius: number): CircleCollider;
|
|
|
|
|
debugRender(camera: Camera): void;
|
|
|
|
|
toString(): string;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class PolygonCollider extends Collider {
|
|
|
|
|
constructor(points: Vector2[]);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
declare module es {
|
|
|
|
|
abstract class RenderableComponent extends Component implements IRenderable {
|
2020-07-27 16:10:36 +08:00
|
|
|
displayObject: egret.DisplayObject;
|
2020-08-24 09:06:25 +08:00
|
|
|
hollowShape: egret.Shape;
|
|
|
|
|
pixelShape: egret.Shape;
|
2020-07-28 16:25:20 +08:00
|
|
|
color: number;
|
|
|
|
|
protected _areBoundsDirty: boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
readonly width: number;
|
|
|
|
|
readonly height: number;
|
2020-08-24 09:06:25 +08:00
|
|
|
debugRenderEnabled: boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
protected _localOffset: Vector2;
|
2020-07-28 16:25:20 +08:00
|
|
|
localOffset: Vector2;
|
2020-07-23 11:00:46 +08:00
|
|
|
protected _renderLayer: number;
|
2020-07-28 16:25:20 +08:00
|
|
|
renderLayer: number;
|
2020-07-23 11:00:46 +08:00
|
|
|
protected _bounds: Rectangle;
|
2020-07-28 16:25:20 +08:00
|
|
|
readonly bounds: Rectangle;
|
2020-07-23 11:00:46 +08:00
|
|
|
private _isVisible;
|
2020-07-28 16:25:20 +08:00
|
|
|
isVisible: boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
onEntityTransformChanged(comp: transform.Component): void;
|
|
|
|
|
abstract render(camera: Camera): any;
|
2020-08-28 18:04:50 +08:00
|
|
|
debugRender(camera: Camera): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
isVisibleFromCamera(camera: Camera): boolean;
|
|
|
|
|
setRenderLayer(renderLayer: number): RenderableComponent;
|
|
|
|
|
setColor(color: number): RenderableComponent;
|
|
|
|
|
setLocalOffset(offset: Vector2): RenderableComponent;
|
2020-07-27 16:10:36 +08:00
|
|
|
sync(camera: Camera): void;
|
2020-08-28 18:04:50 +08:00
|
|
|
compareTo(other: RenderableComponent): number;
|
2020-07-23 11:00:46 +08:00
|
|
|
toString(): string;
|
2020-07-28 16:25:20 +08:00
|
|
|
protected onBecameVisible(): void;
|
|
|
|
|
protected onBecameInvisible(): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
2020-09-01 11:51:03 +08:00
|
|
|
class Mesh extends RenderableComponent {
|
|
|
|
|
displayObject: egret.Mesh;
|
|
|
|
|
readonly bounds: Rectangle;
|
|
|
|
|
_primitiveCount: number;
|
|
|
|
|
_topLeftVertPosition: Vector2;
|
|
|
|
|
_width: number;
|
|
|
|
|
_height: number;
|
|
|
|
|
_triangles: number[];
|
|
|
|
|
_verts: VertexPositionColorTexture[];
|
|
|
|
|
recalculateBounds(recalculateUVs: boolean): this;
|
|
|
|
|
setTexture(texture: egret.Texture): Mesh;
|
|
|
|
|
setVertPositions(positions: Vector2[]): this;
|
|
|
|
|
setTriangles(triangles: number[]): this;
|
|
|
|
|
render(camera: es.Camera): void;
|
|
|
|
|
}
|
|
|
|
|
class VertexPositionColorTexture {
|
|
|
|
|
position: Vector2;
|
|
|
|
|
textureCoordinate: Vector2;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class SpriteRenderer extends RenderableComponent {
|
2020-07-28 16:25:20 +08:00
|
|
|
constructor(sprite?: Sprite | egret.Texture);
|
2020-07-23 11:00:46 +08:00
|
|
|
readonly bounds: Rectangle;
|
|
|
|
|
originNormalized: Vector2;
|
|
|
|
|
protected _origin: Vector2;
|
2020-07-28 16:25:20 +08:00
|
|
|
origin: Vector2;
|
2020-07-23 11:00:46 +08:00
|
|
|
protected _sprite: Sprite;
|
2020-07-28 16:25:20 +08:00
|
|
|
sprite: Sprite;
|
2020-07-23 11:00:46 +08:00
|
|
|
setSprite(sprite: Sprite): SpriteRenderer;
|
|
|
|
|
setOrigin(origin: Vector2): SpriteRenderer;
|
|
|
|
|
setOriginNormalized(value: Vector2): SpriteRenderer;
|
|
|
|
|
render(camera: Camera): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class TiledSpriteRenderer extends SpriteRenderer {
|
2020-08-07 08:50:26 +08:00
|
|
|
readonly bounds: Rectangle;
|
2020-07-23 11:00:46 +08:00
|
|
|
scrollX: number;
|
|
|
|
|
scrollY: number;
|
2020-08-07 08:50:26 +08:00
|
|
|
textureScale: Vector2;
|
|
|
|
|
width: number;
|
|
|
|
|
height: number;
|
2020-08-07 15:34:42 +08:00
|
|
|
gapXY: Vector2;
|
2020-08-07 08:50:26 +08:00
|
|
|
protected _sourceRect: Rectangle;
|
|
|
|
|
protected _textureScale: Vector2;
|
|
|
|
|
protected _inverseTexScale: Vector2;
|
2020-08-07 15:34:42 +08:00
|
|
|
private _gapX;
|
|
|
|
|
private _gapY;
|
2020-08-07 08:50:26 +08:00
|
|
|
constructor(sprite: Sprite);
|
2020-08-08 09:06:32 +08:00
|
|
|
setGapXY(value: Vector2): TiledSpriteRenderer;
|
2020-07-23 11:00:46 +08:00
|
|
|
render(camera: es.Camera): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class ScrollingSpriteRenderer extends TiledSpriteRenderer {
|
|
|
|
|
scrollSpeedX: number;
|
|
|
|
|
scroolSpeedY: number;
|
2020-08-07 08:50:26 +08:00
|
|
|
textureScale: Vector2;
|
2020-08-07 11:02:04 +08:00
|
|
|
scrollWidth: number;
|
|
|
|
|
scrollHeight: number;
|
2020-07-23 11:00:46 +08:00
|
|
|
private _scrollX;
|
|
|
|
|
private _scrollY;
|
2020-08-07 11:02:04 +08:00
|
|
|
private _scrollWidth;
|
|
|
|
|
private _scrollHeight;
|
2020-08-07 08:50:26 +08:00
|
|
|
constructor(sprite: Sprite);
|
2020-07-23 11:00:46 +08:00
|
|
|
update(): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class Sprite {
|
|
|
|
|
texture2D: egret.Texture;
|
|
|
|
|
readonly sourceRect: Rectangle;
|
|
|
|
|
readonly center: Vector2;
|
|
|
|
|
origin: Vector2;
|
|
|
|
|
readonly uvs: Rectangle;
|
|
|
|
|
constructor(texture: egret.Texture, sourceRect?: Rectangle, origin?: Vector2);
|
2020-08-23 22:09:22 +08:00
|
|
|
static spritesFromAtlas(texture: egret.Texture, cellWidth: number, cellHeight: number, cellOffset?: number, maxCellsToInclude?: number): Sprite[];
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class SpriteAnimation {
|
|
|
|
|
readonly sprites: Sprite[];
|
|
|
|
|
readonly frameRate: number;
|
2020-08-27 18:48:20 +08:00
|
|
|
constructor(sprites: Sprite[], frameRate?: number);
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
enum LoopMode {
|
|
|
|
|
loop = 0,
|
|
|
|
|
once = 1,
|
|
|
|
|
clampForever = 2,
|
|
|
|
|
pingPong = 3,
|
|
|
|
|
pingPongOnce = 4
|
|
|
|
|
}
|
|
|
|
|
enum State {
|
|
|
|
|
none = 0,
|
|
|
|
|
running = 1,
|
|
|
|
|
paused = 2,
|
|
|
|
|
completed = 3
|
|
|
|
|
}
|
|
|
|
|
class SpriteAnimator extends SpriteRenderer {
|
|
|
|
|
onAnimationCompletedEvent: (string: any) => {};
|
|
|
|
|
speed: number;
|
|
|
|
|
animationState: State;
|
|
|
|
|
currentAnimation: SpriteAnimation;
|
|
|
|
|
currentAnimationName: string;
|
|
|
|
|
currentFrame: number;
|
|
|
|
|
_elapsedTime: number;
|
|
|
|
|
_loopMode: LoopMode;
|
|
|
|
|
constructor(sprite?: Sprite);
|
2020-07-28 16:25:20 +08:00
|
|
|
readonly isRunning: boolean;
|
|
|
|
|
private _animations;
|
|
|
|
|
readonly animations: Map<string, SpriteAnimation>;
|
2020-07-23 11:00:46 +08:00
|
|
|
update(): void;
|
|
|
|
|
addAnimation(name: string, animation: SpriteAnimation): SpriteAnimator;
|
|
|
|
|
play(name: string, loopMode?: LoopMode): void;
|
|
|
|
|
isAnimationActive(name: string): boolean;
|
|
|
|
|
pause(): void;
|
|
|
|
|
unPause(): void;
|
|
|
|
|
stop(): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-09-14 13:32:20 +08:00
|
|
|
declare module es {
|
|
|
|
|
import Bitmap = egret.Bitmap;
|
|
|
|
|
class StaticSpriteContainerRenderer extends RenderableComponent {
|
|
|
|
|
displayObject: egret.DisplayObjectContainer;
|
|
|
|
|
private displayObjectCache;
|
|
|
|
|
constructor(sprite?: Sprite[] | egret.Texture[]);
|
|
|
|
|
readonly bounds: Rectangle;
|
|
|
|
|
originNormalized: Vector2;
|
|
|
|
|
protected _origin: Vector2;
|
|
|
|
|
origin: Vector2;
|
|
|
|
|
pushSprite(sprite: Sprite): StaticSpriteContainerRenderer;
|
|
|
|
|
getSprite(sprite: Sprite): Bitmap;
|
|
|
|
|
setOrigin(origin: Vector2): StaticSpriteContainerRenderer;
|
|
|
|
|
setOriginNormalized(value: Vector2): StaticSpriteContainerRenderer;
|
|
|
|
|
render(camera: Camera): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-12 18:08:12 +08:00
|
|
|
declare module es {
|
|
|
|
|
class TiledMapRenderer extends RenderableComponent {
|
|
|
|
|
tiledMap: TmxMap;
|
2020-08-27 18:48:20 +08:00
|
|
|
physicsLayer: Ref<number>;
|
2020-08-12 18:08:12 +08:00
|
|
|
layerIndicesToRender: number[];
|
2020-08-15 12:16:23 +08:00
|
|
|
private toContainer;
|
2020-08-12 18:08:12 +08:00
|
|
|
readonly width: number;
|
|
|
|
|
readonly height: number;
|
|
|
|
|
collisionLayer: TmxLayer;
|
|
|
|
|
_shouldCreateColliders: boolean;
|
|
|
|
|
_colliders: Collider[];
|
|
|
|
|
constructor(tiledMap: TmxMap, collisionLayerName?: string, shouldCreateColliders?: boolean);
|
|
|
|
|
setLayerToRender(layerName: string): void;
|
|
|
|
|
setLayersToRender(...layerNames: string[]): void;
|
|
|
|
|
private getLayerIndex;
|
|
|
|
|
getRowAtWorldPosition(yPos: number): number;
|
|
|
|
|
getColumnAtWorldPosition(xPos: number): number;
|
|
|
|
|
onEntityTransformChanged(comp: transform.Component): void;
|
|
|
|
|
onAddedToEntity(): void;
|
|
|
|
|
onRemovedFromEntity(): void;
|
|
|
|
|
update(): void;
|
|
|
|
|
render(camera: es.Camera): void;
|
|
|
|
|
addColliders(): void;
|
|
|
|
|
removeColliders(): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
declare module es {
|
|
|
|
|
class EntitySystem {
|
|
|
|
|
private _entities;
|
2020-07-28 16:25:20 +08:00
|
|
|
constructor(matcher?: Matcher);
|
|
|
|
|
private _scene;
|
|
|
|
|
scene: Scene;
|
2020-07-23 11:00:46 +08:00
|
|
|
private _matcher;
|
|
|
|
|
readonly matcher: Matcher;
|
|
|
|
|
initialize(): void;
|
|
|
|
|
onChanged(entity: Entity): void;
|
|
|
|
|
add(entity: Entity): void;
|
|
|
|
|
onAdded(entity: Entity): void;
|
|
|
|
|
remove(entity: Entity): void;
|
|
|
|
|
onRemoved(entity: Entity): void;
|
|
|
|
|
update(): void;
|
|
|
|
|
lateUpdate(): void;
|
|
|
|
|
protected begin(): void;
|
|
|
|
|
protected process(entities: Entity[]): void;
|
|
|
|
|
protected lateProcess(entities: Entity[]): void;
|
|
|
|
|
protected end(): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
abstract class EntityProcessingSystem extends EntitySystem {
|
|
|
|
|
constructor(matcher: Matcher);
|
|
|
|
|
abstract processEntity(entity: Entity): any;
|
|
|
|
|
lateProcessEntity(entity: Entity): void;
|
|
|
|
|
protected process(entities: Entity[]): void;
|
|
|
|
|
protected lateProcess(entities: Entity[]): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
abstract class PassiveSystem extends EntitySystem {
|
|
|
|
|
onChanged(entity: Entity): void;
|
|
|
|
|
protected process(entities: Entity[]): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
abstract class ProcessingSystem extends EntitySystem {
|
|
|
|
|
onChanged(entity: Entity): void;
|
|
|
|
|
abstract processSystem(): any;
|
2020-07-28 16:25:20 +08:00
|
|
|
protected process(entities: Entity[]): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class BitSet {
|
|
|
|
|
private static LONG_MASK;
|
|
|
|
|
private _bits;
|
|
|
|
|
constructor(nbits?: number);
|
|
|
|
|
and(bs: BitSet): void;
|
|
|
|
|
andNot(bs: BitSet): void;
|
|
|
|
|
cardinality(): number;
|
|
|
|
|
clear(pos?: number): void;
|
|
|
|
|
get(pos: number): boolean;
|
|
|
|
|
intersects(set: BitSet): boolean;
|
|
|
|
|
isEmpty(): boolean;
|
|
|
|
|
nextSetBit(from: number): number;
|
|
|
|
|
set(pos: number, value?: boolean): void;
|
2020-07-28 16:25:20 +08:00
|
|
|
private ensure;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class ComponentList {
|
|
|
|
|
static compareUpdatableOrder: IUpdatableComparer;
|
|
|
|
|
_entity: Entity;
|
|
|
|
|
_components: Component[];
|
|
|
|
|
_componentsToAdd: Component[];
|
|
|
|
|
_componentsToRemove: Component[];
|
|
|
|
|
_tempBufferList: Component[];
|
|
|
|
|
_isComponentListUnsorted: boolean;
|
|
|
|
|
constructor(entity: Entity);
|
|
|
|
|
readonly count: number;
|
|
|
|
|
readonly buffer: Component[];
|
|
|
|
|
markEntityListUnsorted(): void;
|
|
|
|
|
add(component: Component): void;
|
|
|
|
|
remove(component: Component): void;
|
|
|
|
|
removeAllComponents(): void;
|
|
|
|
|
deregisterAllComponents(): void;
|
|
|
|
|
registerAllComponents(): void;
|
|
|
|
|
updateLists(): void;
|
|
|
|
|
handleRemove(component: Component): void;
|
|
|
|
|
getComponent<T extends Component>(type: any, onlyReturnInitializedComponents: boolean): T;
|
|
|
|
|
getComponents(typeName: string | any, components?: any): any;
|
|
|
|
|
update(): void;
|
|
|
|
|
onEntityTransformChanged(comp: transform.Component): void;
|
|
|
|
|
onEntityEnabled(): void;
|
|
|
|
|
onEntityDisabled(): void;
|
2020-08-28 18:04:50 +08:00
|
|
|
debugRender(camera: Camera): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class ComponentTypeManager {
|
|
|
|
|
private static _componentTypesMask;
|
|
|
|
|
static add(type: any): void;
|
|
|
|
|
static getIndexFor(type: any): number;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class EntityList {
|
|
|
|
|
scene: Scene;
|
2020-07-24 15:29:07 +08:00
|
|
|
_entities: Entity[];
|
|
|
|
|
_entitiesToAdded: Entity[];
|
|
|
|
|
_entitiesToRemove: Entity[];
|
|
|
|
|
_isEntityListUnsorted: boolean;
|
|
|
|
|
_entityDict: Map<number, Entity[]>;
|
|
|
|
|
_unsortedTags: number[];
|
|
|
|
|
_tempEntityList: Entity[];
|
2020-07-23 11:00:46 +08:00
|
|
|
constructor(scene: Scene);
|
|
|
|
|
readonly count: number;
|
|
|
|
|
readonly buffer: Entity[];
|
2020-07-24 15:29:07 +08:00
|
|
|
markEntityListUnsorted(): void;
|
|
|
|
|
markTagUnsorted(tag: number): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
add(entity: Entity): void;
|
|
|
|
|
remove(entity: Entity): void;
|
2020-07-24 15:29:07 +08:00
|
|
|
removeAllEntities(): void;
|
|
|
|
|
contains(entity: Entity): boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
getTagList(tag: number): Entity[];
|
|
|
|
|
addToTagList(entity: Entity): void;
|
|
|
|
|
removeFromTagList(entity: Entity): void;
|
|
|
|
|
update(): void;
|
|
|
|
|
updateLists(): void;
|
2020-07-24 15:29:07 +08:00
|
|
|
findEntity(name: string): Entity;
|
|
|
|
|
entitiesWithTag(tag: number): Entity[];
|
|
|
|
|
entitiesOfType<T extends Entity>(type: any): T[];
|
|
|
|
|
findComponentOfType<T extends Component>(type: any): T;
|
|
|
|
|
findComponentsOfType<T extends Component>(type: any): T[];
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class EntityProcessorList {
|
|
|
|
|
private _processors;
|
|
|
|
|
add(processor: EntitySystem): void;
|
|
|
|
|
remove(processor: EntitySystem): void;
|
|
|
|
|
onComponentAdded(entity: Entity): void;
|
|
|
|
|
onComponentRemoved(entity: Entity): void;
|
|
|
|
|
onEntityAdded(entity: Entity): void;
|
|
|
|
|
onEntityRemoved(entity: Entity): void;
|
|
|
|
|
begin(): void;
|
|
|
|
|
update(): void;
|
|
|
|
|
lateUpdate(): void;
|
|
|
|
|
end(): void;
|
|
|
|
|
getProcessor<T extends EntitySystem>(): T;
|
2020-07-28 16:25:20 +08:00
|
|
|
protected notifyEntityChanged(entity: Entity): void;
|
|
|
|
|
protected removeFromProcessors(entity: Entity): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class Matcher {
|
|
|
|
|
protected allSet: BitSet;
|
|
|
|
|
protected exclusionSet: BitSet;
|
|
|
|
|
protected oneSet: BitSet;
|
|
|
|
|
static empty(): Matcher;
|
|
|
|
|
getAllSet(): BitSet;
|
|
|
|
|
getExclusionSet(): BitSet;
|
|
|
|
|
getOneSet(): BitSet;
|
|
|
|
|
IsIntersted(e: Entity): boolean;
|
|
|
|
|
all(...types: any[]): Matcher;
|
|
|
|
|
exclude(...types: any[]): this;
|
|
|
|
|
one(...types: any[]): this;
|
|
|
|
|
}
|
2020-06-08 18:26:05 +08:00
|
|
|
}
|
2020-07-17 14:34:42 +08:00
|
|
|
declare class ObjectUtils {
|
|
|
|
|
static clone<T>(p: any, c?: T): T;
|
2020-08-13 22:23:02 +08:00
|
|
|
static elements(p: {}): any[];
|
2020-07-17 14:34:42 +08:00
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
declare module es {
|
|
|
|
|
interface IRenderable {
|
|
|
|
|
bounds: Rectangle;
|
|
|
|
|
enabled: boolean;
|
|
|
|
|
renderLayer: number;
|
|
|
|
|
isVisible: boolean;
|
|
|
|
|
isVisibleFromCamera(camera: Camera): any;
|
|
|
|
|
render(camera: Camera): any;
|
2020-08-28 18:04:50 +08:00
|
|
|
debugRender(camera: Camera): any;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
class RenderableComparer {
|
|
|
|
|
compare(self: IRenderable, other: IRenderable): number;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class RenderableComponentList {
|
|
|
|
|
static compareUpdatableOrder: RenderableComparer;
|
|
|
|
|
_components: IRenderable[];
|
|
|
|
|
_componentsByRenderLayer: Map<number, IRenderable[]>;
|
|
|
|
|
_unsortedRenderLayers: number[];
|
|
|
|
|
_componentsNeedSort: boolean;
|
|
|
|
|
readonly count: number;
|
|
|
|
|
readonly buffer: IRenderable[];
|
|
|
|
|
add(component: IRenderable): void;
|
|
|
|
|
remove(component: IRenderable): void;
|
|
|
|
|
updateRenderableRenderLayer(component: IRenderable, oldRenderLayer: number, newRenderLayer: number): void;
|
|
|
|
|
setRenderLayerNeedsComponentSort(renderLayer: number): void;
|
|
|
|
|
setNeedsComponentSort(): void;
|
|
|
|
|
addToRenderLayerList(component: IRenderable, renderLayer: number): void;
|
|
|
|
|
componentsWithRenderLayer(renderLayer: number): IRenderable[];
|
|
|
|
|
updateList(): void;
|
2020-08-08 09:43:03 +08:00
|
|
|
private updateEgretList;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
2020-06-18 16:35:51 +08:00
|
|
|
}
|
2020-07-17 14:34:42 +08:00
|
|
|
declare class StringUtils {
|
2020-07-28 16:25:20 +08:00
|
|
|
private static specialSigns;
|
2020-07-17 14:34:42 +08:00
|
|
|
static matchChineseWord(str: string): string[];
|
|
|
|
|
static lTrim(target: string): string;
|
|
|
|
|
static rTrim(target: string): string;
|
|
|
|
|
static trim(target: string): string;
|
|
|
|
|
static isWhiteSpace(str: string): boolean;
|
|
|
|
|
static replaceMatch(mainStr: string, targetStr: string, replaceStr: string, caseMark?: boolean): string;
|
|
|
|
|
static htmlSpecialChars(str: string, reversion?: boolean): string;
|
|
|
|
|
static zfill(str: string, width?: number): string;
|
|
|
|
|
static reverse(str: string): string;
|
|
|
|
|
static cutOff(str: string, start: number, len: number, order?: boolean): string;
|
|
|
|
|
static strReplace(str: string, rStr: string[]): string;
|
|
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
declare module es {
|
|
|
|
|
class TextureUtils {
|
|
|
|
|
static sharedCanvas: HTMLCanvasElement;
|
|
|
|
|
static sharedContext: CanvasRenderingContext2D;
|
|
|
|
|
static convertImageToCanvas(texture: egret.Texture, rect?: egret.Rectangle): HTMLCanvasElement;
|
|
|
|
|
static toDataURL(type: string, texture: egret.Texture, rect?: egret.Rectangle, encoderOptions?: any): string;
|
|
|
|
|
static eliFoTevas(type: string, texture: egret.Texture, filePath: string, rect?: egret.Rectangle, encoderOptions?: any): void;
|
|
|
|
|
static getPixel32(texture: egret.Texture, x: number, y: number): number[];
|
|
|
|
|
static getPixels(texture: egret.Texture, x: number, y: number, width?: number, height?: number): number[];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class Time {
|
|
|
|
|
static unscaledDeltaTime: any;
|
|
|
|
|
static deltaTime: number;
|
|
|
|
|
static timeScale: number;
|
|
|
|
|
static frameCount: number;
|
|
|
|
|
static _timeSinceSceneLoad: any;
|
2020-07-28 16:25:20 +08:00
|
|
|
private static _lastTime;
|
2020-07-23 11:00:46 +08:00
|
|
|
static update(currentTime: number): void;
|
|
|
|
|
static sceneChanged(): void;
|
|
|
|
|
static checkEvery(interval: number): boolean;
|
|
|
|
|
}
|
2020-06-08 21:53:09 +08:00
|
|
|
}
|
2020-07-17 14:34:42 +08:00
|
|
|
declare class TimeUtils {
|
|
|
|
|
static monthId(d?: Date): number;
|
|
|
|
|
static dateId(t?: Date): number;
|
|
|
|
|
static weekId(d?: Date, first?: boolean): number;
|
|
|
|
|
static diffDay(a: Date, b: Date, fixOne?: boolean): number;
|
|
|
|
|
static getFirstDayOfWeek(d?: Date): Date;
|
|
|
|
|
static getFirstOfDay(d?: Date): Date;
|
|
|
|
|
static getNextFirstOfDay(d?: Date): Date;
|
|
|
|
|
static formatDate(date: Date): string;
|
|
|
|
|
static formatDateTime(date: Date): string;
|
|
|
|
|
static parseDate(s: string): Date;
|
|
|
|
|
static secondToTime(time?: number, partition?: string, showHour?: boolean): string;
|
|
|
|
|
static timeToMillisecond(time: string, partition?: string): string;
|
|
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
declare module es {
|
|
|
|
|
class GraphicsCapabilities extends egret.Capabilities {
|
|
|
|
|
initialize(device: GraphicsDevice): void;
|
|
|
|
|
private platformInitialize;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class GraphicsDevice {
|
|
|
|
|
graphicsCapabilities: GraphicsCapabilities;
|
|
|
|
|
constructor();
|
2020-07-28 16:25:20 +08:00
|
|
|
private _viewport;
|
|
|
|
|
readonly viewport: Viewport;
|
2020-07-23 15:39:18 +08:00
|
|
|
private setup;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class Viewport {
|
|
|
|
|
private _x;
|
|
|
|
|
private _y;
|
|
|
|
|
private _minDepth;
|
|
|
|
|
private _maxDepth;
|
2020-07-28 16:25:20 +08:00
|
|
|
constructor(x: number, y: number, width: number, height: number);
|
|
|
|
|
private _width;
|
2020-07-23 15:39:18 +08:00
|
|
|
width: number;
|
2020-07-28 16:25:20 +08:00
|
|
|
private _height;
|
|
|
|
|
height: number;
|
2020-07-23 11:00:46 +08:00
|
|
|
readonly aspectRatio: number;
|
2020-07-07 18:54:19 +08:00
|
|
|
bounds: Rectangle;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class GaussianBlurEffect extends egret.CustomFilter {
|
|
|
|
|
private static blur_frag;
|
|
|
|
|
constructor();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class PolygonLightEffect extends egret.CustomFilter {
|
|
|
|
|
private static vertSrc;
|
|
|
|
|
private static fragmentSrc;
|
|
|
|
|
constructor();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class PostProcessor {
|
2020-07-28 16:25:20 +08:00
|
|
|
static default_vert: string;
|
2020-07-23 11:00:46 +08:00
|
|
|
enabled: boolean;
|
|
|
|
|
effect: egret.Filter;
|
|
|
|
|
scene: Scene;
|
|
|
|
|
shape: egret.Shape;
|
|
|
|
|
constructor(effect?: egret.Filter);
|
|
|
|
|
onAddedToScene(scene: Scene): void;
|
|
|
|
|
process(): void;
|
|
|
|
|
onSceneBackBufferSizeChanged(newWidth: number, newHeight: number): void;
|
|
|
|
|
unload(): void;
|
2020-07-28 16:25:20 +08:00
|
|
|
protected drawFullscreenQuad(): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class GaussianBlurPostProcessor extends PostProcessor {
|
|
|
|
|
onAddedToScene(scene: Scene): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
abstract class Renderer {
|
|
|
|
|
camera: Camera;
|
2020-07-27 16:10:36 +08:00
|
|
|
readonly renderOrder: number;
|
2020-08-21 19:21:40 +08:00
|
|
|
renderTexture: egret.RenderTexture;
|
|
|
|
|
shouldDebugRender: boolean;
|
|
|
|
|
readonly wantsToRenderToSceneRenderTarget: boolean;
|
2020-07-27 16:10:36 +08:00
|
|
|
protected constructor(renderOrder: number, camera?: Camera);
|
2020-07-23 11:00:46 +08:00
|
|
|
onAddedToScene(scene: Scene): void;
|
2020-07-27 16:10:36 +08:00
|
|
|
unload(): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
abstract render(scene: Scene): any;
|
2020-07-27 16:10:36 +08:00
|
|
|
onSceneBackBufferSizeChanged(newWidth: number, newHeight: number): void;
|
|
|
|
|
compareTo(other: Renderer): number;
|
2020-07-28 16:25:20 +08:00
|
|
|
protected beginRender(cam: Camera): void;
|
|
|
|
|
protected renderAfterStateCheck(renderable: IRenderable, cam: Camera): void;
|
2020-08-21 19:21:40 +08:00
|
|
|
protected debugRender(scene: Scene, cam: Camera): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class DefaultRenderer extends Renderer {
|
2020-07-27 16:10:36 +08:00
|
|
|
constructor();
|
2020-07-23 11:00:46 +08:00
|
|
|
render(scene: Scene): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-21 19:21:40 +08:00
|
|
|
declare module es {
|
|
|
|
|
class RenderLayerExcludeRenderer extends Renderer {
|
|
|
|
|
excludedRenderLayers: number[];
|
|
|
|
|
constructor(renderOrder: number, ...excludedRenderLayers: number[]);
|
|
|
|
|
render(scene: es.Scene): void;
|
|
|
|
|
protected debugRender(scene: es.Scene, cam: es.Camera): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
declare module es {
|
|
|
|
|
class ScreenSpaceRenderer extends Renderer {
|
2020-08-21 19:21:40 +08:00
|
|
|
renderLayers: number[];
|
|
|
|
|
constructor(renderOrder: number, ...renderLayers: number[]);
|
2020-07-23 11:00:46 +08:00
|
|
|
render(scene: Scene): void;
|
2020-08-21 19:21:40 +08:00
|
|
|
protected debugRender(scene: es.Scene, cam: es.Camera): void;
|
|
|
|
|
onSceneBackBufferSizeChanged(newWidth: number, newHeight: number): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class PolyLight extends RenderableComponent {
|
|
|
|
|
power: number;
|
|
|
|
|
private _lightEffect;
|
|
|
|
|
private _indices;
|
|
|
|
|
constructor(radius: number, color: number, power: number);
|
2020-07-28 16:25:20 +08:00
|
|
|
protected _radius: number;
|
|
|
|
|
radius: number;
|
2020-07-23 11:00:46 +08:00
|
|
|
setRadius(radius: number): void;
|
|
|
|
|
render(camera: Camera): void;
|
|
|
|
|
reset(): void;
|
2020-07-28 16:25:20 +08:00
|
|
|
private computeTriangleIndices;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
abstract class SceneTransition {
|
|
|
|
|
loadsNewScene: boolean;
|
|
|
|
|
isNewSceneLoaded: boolean;
|
|
|
|
|
onScreenObscured: Function;
|
|
|
|
|
onTransitionCompleted: Function;
|
2020-07-28 16:25:20 +08:00
|
|
|
protected sceneLoadAction: Function;
|
2020-07-23 11:00:46 +08:00
|
|
|
constructor(sceneLoadAction: Function);
|
2020-07-28 16:25:20 +08:00
|
|
|
private _hasPreviousSceneRender;
|
|
|
|
|
readonly hasPreviousSceneRender: boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
preRender(): void;
|
|
|
|
|
render(): void;
|
|
|
|
|
onBeginTransition(): Promise<void>;
|
2020-07-28 16:25:20 +08:00
|
|
|
tickEffectProgressProperty(filter: egret.CustomFilter, duration: number, easeType: Function, reverseDirection?: boolean): Promise<boolean>;
|
2020-07-23 11:00:46 +08:00
|
|
|
protected transitionComplete(): void;
|
|
|
|
|
protected loadNextScene(): Promise<void>;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class FadeTransition extends SceneTransition {
|
|
|
|
|
fadeToColor: number;
|
|
|
|
|
fadeOutDuration: number;
|
|
|
|
|
fadeEaseType: Function;
|
|
|
|
|
delayBeforeFadeInDuration: number;
|
|
|
|
|
private _mask;
|
|
|
|
|
private _alpha;
|
|
|
|
|
constructor(sceneLoadAction: Function);
|
|
|
|
|
onBeginTransition(): Promise<void>;
|
2020-08-25 17:28:22 +08:00
|
|
|
protected transitionComplete(): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
render(): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class WindTransition extends SceneTransition {
|
2020-07-28 16:25:20 +08:00
|
|
|
duration: number;
|
|
|
|
|
easeType: (t: number) => number;
|
2020-07-23 11:00:46 +08:00
|
|
|
private _mask;
|
|
|
|
|
private _windEffect;
|
2020-07-28 16:25:20 +08:00
|
|
|
constructor(sceneLoadAction: Function);
|
2020-07-23 11:00:46 +08:00
|
|
|
windSegments: number;
|
|
|
|
|
size: number;
|
|
|
|
|
onBeginTransition(): Promise<void>;
|
2020-08-25 17:28:22 +08:00
|
|
|
protected transitionComplete(): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class Bezier {
|
|
|
|
|
static getPoint(p0: Vector2, p1: Vector2, p2: Vector2, t: number): Vector2;
|
|
|
|
|
static getFirstDerivative(p0: Vector2, p1: Vector2, p2: Vector2, t: number): Vector2;
|
|
|
|
|
static getFirstDerivativeThree(start: Vector2, firstControlPoint: Vector2, secondControlPoint: Vector2, end: Vector2, t: number): Vector2;
|
|
|
|
|
static getPointThree(start: Vector2, firstControlPoint: Vector2, secondControlPoint: Vector2, end: Vector2, t: number): Vector2;
|
|
|
|
|
static getOptimizedDrawingPoints(start: Vector2, firstCtrlPoint: Vector2, secondCtrlPoint: Vector2, end: Vector2, distanceTolerance?: number): Vector2[];
|
|
|
|
|
private static recursiveGetOptimizedDrawingPoints;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class Flags {
|
|
|
|
|
static isFlagSet(self: number, flag: number): boolean;
|
|
|
|
|
static isUnshiftedFlagSet(self: number, flag: number): boolean;
|
2020-08-27 18:48:20 +08:00
|
|
|
static setFlagExclusive(self: Ref<number>, flag: number): void;
|
|
|
|
|
static setFlag(self: Ref<number>, flag: number): void;
|
|
|
|
|
static unsetFlag(self: Ref<number>, flag: number): void;
|
|
|
|
|
static invertFlags(self: Ref<number>): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class MathHelper {
|
|
|
|
|
static readonly Epsilon: number;
|
|
|
|
|
static readonly Rad2Deg: number;
|
|
|
|
|
static readonly Deg2Rad: number;
|
2020-08-12 18:08:12 +08:00
|
|
|
static readonly PiOver2: number;
|
2020-07-23 11:00:46 +08:00
|
|
|
static toDegrees(radians: number): number;
|
|
|
|
|
static toRadians(degrees: number): number;
|
|
|
|
|
static map(value: number, leftMin: number, leftMax: number, rightMin: number, rightMax: number): number;
|
|
|
|
|
static lerp(value1: number, value2: number, amount: number): number;
|
|
|
|
|
static clamp(value: number, min: number, max: number): number;
|
|
|
|
|
static pointOnCirlce(circleCenter: Vector2, radius: number, angleInDegrees: number): Vector2;
|
|
|
|
|
static isEven(value: number): boolean;
|
|
|
|
|
static clamp01(value: number): number;
|
|
|
|
|
static angleBetweenVectors(from: Vector2, to: Vector2): number;
|
2020-08-12 12:16:35 +08:00
|
|
|
static incrementWithWrap(t: number, length: number): number;
|
2020-08-22 12:21:40 +08:00
|
|
|
static approach(start: number, end: number, shift: number): number;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
2020-07-24 16:57:26 +08:00
|
|
|
var matrixPool: any[];
|
2020-07-23 13:25:10 +08:00
|
|
|
class Matrix2D extends egret.Matrix {
|
2020-07-23 11:00:46 +08:00
|
|
|
m11: number;
|
|
|
|
|
m12: number;
|
|
|
|
|
m21: number;
|
|
|
|
|
m22: number;
|
|
|
|
|
m31: number;
|
|
|
|
|
m32: number;
|
2020-07-23 13:25:10 +08:00
|
|
|
static create(): Matrix2D;
|
|
|
|
|
identity(): Matrix2D;
|
|
|
|
|
translate(dx: number, dy: number): Matrix2D;
|
|
|
|
|
scale(sx: number, sy: number): Matrix2D;
|
|
|
|
|
rotate(angle: number): Matrix2D;
|
|
|
|
|
invert(): Matrix2D;
|
|
|
|
|
add(matrix: Matrix2D): Matrix2D;
|
|
|
|
|
substract(matrix: Matrix2D): Matrix2D;
|
|
|
|
|
divide(matrix: Matrix2D): Matrix2D;
|
|
|
|
|
multiply(matrix: Matrix2D): Matrix2D;
|
2020-07-23 11:00:46 +08:00
|
|
|
determinant(): number;
|
2020-07-24 16:57:26 +08:00
|
|
|
release(matrix: Matrix2D): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class Rectangle extends egret.Rectangle {
|
2020-07-28 16:11:58 +08:00
|
|
|
_tempMat: Matrix2D;
|
|
|
|
|
_transformMat: Matrix2D;
|
2020-07-23 11:00:46 +08:00
|
|
|
readonly max: Vector2;
|
|
|
|
|
readonly center: Vector2;
|
|
|
|
|
location: Vector2;
|
|
|
|
|
size: Vector2;
|
2020-07-28 16:25:20 +08:00
|
|
|
static fromMinMax(minX: number, minY: number, maxX: number, maxY: number): Rectangle;
|
|
|
|
|
static rectEncompassingPoints(points: Vector2[]): Rectangle;
|
2020-07-23 11:00:46 +08:00
|
|
|
intersects(value: egret.Rectangle): boolean;
|
2020-08-25 14:21:37 +08:00
|
|
|
rayIntersects(ray: Ray2D, distance: Ref<number>): boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
containsRect(value: Rectangle): boolean;
|
2020-07-31 17:17:44 +08:00
|
|
|
contains(x: number, y: number): boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
getHalfSize(): Vector2;
|
2020-07-27 16:10:36 +08:00
|
|
|
getClosestPointOnRectangleBorderToPoint(point: Vector2, edgeNormal: Vector2): Vector2;
|
2020-07-23 11:00:46 +08:00
|
|
|
getClosestPointOnBoundsToOrigin(): Vector2;
|
|
|
|
|
calculateBounds(parentPosition: Vector2, position: Vector2, origin: Vector2, scale: Vector2, rotation: number, width: number, height: number): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-23 22:09:22 +08:00
|
|
|
declare module es {
|
|
|
|
|
class SubpixelFloat {
|
|
|
|
|
remainder: number;
|
|
|
|
|
update(amount: number): number;
|
|
|
|
|
reset(): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class SubpixelVector2 {
|
|
|
|
|
_x: SubpixelFloat;
|
|
|
|
|
_y: SubpixelFloat;
|
|
|
|
|
update(amount: Vector2): void;
|
|
|
|
|
reset(): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
declare module es {
|
|
|
|
|
class Vector3 {
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
z: number;
|
|
|
|
|
constructor(x: number, y: number, z: number);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class ColliderTriggerHelper {
|
|
|
|
|
private _entity;
|
|
|
|
|
private _activeTriggerIntersections;
|
|
|
|
|
private _previousTriggerIntersections;
|
|
|
|
|
private _tempTriggerList;
|
|
|
|
|
constructor(entity: Entity);
|
|
|
|
|
update(): void;
|
|
|
|
|
private checkForExitedColliders;
|
|
|
|
|
private notifyTriggerListeners;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
enum PointSectors {
|
|
|
|
|
center = 0,
|
|
|
|
|
top = 1,
|
|
|
|
|
bottom = 2,
|
|
|
|
|
topLeft = 9,
|
|
|
|
|
topRight = 5,
|
|
|
|
|
left = 8,
|
|
|
|
|
right = 4,
|
|
|
|
|
bottomLeft = 10,
|
|
|
|
|
bottomRight = 6
|
|
|
|
|
}
|
|
|
|
|
class Collisions {
|
|
|
|
|
static isLineToLine(a1: Vector2, a2: Vector2, b1: Vector2, b2: Vector2): boolean;
|
|
|
|
|
static lineToLineIntersection(a1: Vector2, a2: Vector2, b1: Vector2, b2: Vector2): Vector2;
|
|
|
|
|
static closestPointOnLine(lineA: Vector2, lineB: Vector2, closestTo: Vector2): Vector2;
|
2020-08-27 18:48:20 +08:00
|
|
|
static circleToCircle(circleCenter1: Vector2, circleRadius1: number, circleCenter2: Vector2, circleRadius2: number): boolean;
|
|
|
|
|
static circleToLine(circleCenter: Vector2, radius: number, lineFrom: Vector2, lineTo: Vector2): boolean;
|
|
|
|
|
static circleToPoint(circleCenter: Vector2, radius: number, point: Vector2): boolean;
|
|
|
|
|
static rectToCircle(rect: egret.Rectangle, cPosition: Vector2, cRadius: number): boolean;
|
|
|
|
|
static rectToLine(rect: Rectangle, lineFrom: Vector2, lineTo: Vector2): boolean;
|
|
|
|
|
static rectToPoint(rX: number, rY: number, rW: number, rH: number, point: Vector2): boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
static getSector(rX: number, rY: number, rW: number, rH: number, point: Vector2): PointSectors;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-22 12:21:40 +08:00
|
|
|
declare module es {
|
|
|
|
|
class RaycastHit {
|
|
|
|
|
collider: Collider;
|
|
|
|
|
fraction: number;
|
|
|
|
|
distance: number;
|
|
|
|
|
point: Vector2;
|
|
|
|
|
normal: Vector2;
|
|
|
|
|
centroid: Vector2;
|
|
|
|
|
constructor(collider?: Collider, fraction?: number, distance?: number, point?: Vector2, normal?: Vector2);
|
|
|
|
|
setValues(collider: Collider, fraction: number, distance: number, point: Vector2): void;
|
|
|
|
|
setValuesNonCollider(fraction: number, distance: number, point: Vector2, normal: Vector2): void;
|
|
|
|
|
reset(): void;
|
|
|
|
|
toString(): string;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
declare module es {
|
|
|
|
|
class Physics {
|
|
|
|
|
static spatialHashCellSize: number;
|
|
|
|
|
static readonly allLayers: number;
|
2020-07-28 16:25:20 +08:00
|
|
|
private static _spatialHash;
|
2020-08-03 14:45:57 +08:00
|
|
|
static raycastsHitTriggers: boolean;
|
|
|
|
|
static raycastsStartInColliders: boolean;
|
2020-08-22 12:21:40 +08:00
|
|
|
static _hitArray: RaycastHit[];
|
2020-07-23 11:00:46 +08:00
|
|
|
static reset(): void;
|
|
|
|
|
static clear(): void;
|
|
|
|
|
static overlapCircleAll(center: Vector2, randius: number, results: any[], layerMask?: number): number;
|
2020-07-27 16:10:36 +08:00
|
|
|
static boxcastBroadphase(rect: Rectangle, layerMask?: number): Collider[];
|
|
|
|
|
static boxcastBroadphaseExcludingSelf(collider: Collider, rect: Rectangle, layerMask?: number): Collider[];
|
2020-07-23 11:00:46 +08:00
|
|
|
static addCollider(collider: Collider): void;
|
|
|
|
|
static removeCollider(collider: Collider): void;
|
|
|
|
|
static updateCollider(collider: Collider): void;
|
2020-08-22 12:21:40 +08:00
|
|
|
static linecast(start: Vector2, end: Vector2, layerMask?: number): RaycastHit;
|
|
|
|
|
static linecastAll(start: Vector2, end: Vector2, hits: RaycastHit[], layerMask?: number): number;
|
2020-07-23 11:00:46 +08:00
|
|
|
static debugDraw(secondsToDisplay: any): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-03 14:45:57 +08:00
|
|
|
declare module es {
|
|
|
|
|
class Ray2D {
|
|
|
|
|
start: Vector2;
|
|
|
|
|
end: Vector2;
|
|
|
|
|
direction: Vector2;
|
|
|
|
|
constructor(position: Vector2, end: Vector2);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-09-01 11:51:03 +08:00
|
|
|
declare module es {
|
|
|
|
|
class SpatialHash {
|
|
|
|
|
gridBounds: Rectangle;
|
|
|
|
|
_raycastParser: RaycastResultParser;
|
|
|
|
|
_cellSize: number;
|
|
|
|
|
_inverseCellSize: number;
|
|
|
|
|
_overlapTestCircle: Circle;
|
|
|
|
|
_cellDict: NumberDictionary;
|
|
|
|
|
_tempHashSet: Collider[];
|
|
|
|
|
constructor(cellSize?: number);
|
|
|
|
|
register(collider: Collider): void;
|
|
|
|
|
remove(collider: Collider): void;
|
|
|
|
|
removeWithBruteForce(obj: Collider): void;
|
|
|
|
|
clear(): void;
|
|
|
|
|
debugDraw(secondsToDisplay: number, textScale?: number): void;
|
|
|
|
|
aabbBroadphase(bounds: Rectangle, excludeCollider: Collider, layerMask: number): Collider[];
|
|
|
|
|
linecast(start: Vector2, end: Vector2, hits: RaycastHit[], layerMask: number): number;
|
|
|
|
|
overlapCircle(circleCenter: Vector2, radius: number, results: Collider[], layerMask: any): number;
|
|
|
|
|
private cellCoords;
|
|
|
|
|
private cellAtPosition;
|
|
|
|
|
private debugDrawCellDetails;
|
|
|
|
|
}
|
|
|
|
|
class NumberDictionary {
|
|
|
|
|
_store: Map<string, Collider[]>;
|
|
|
|
|
add(x: number, y: number, list: Collider[]): void;
|
|
|
|
|
remove(obj: Collider): void;
|
|
|
|
|
tryGetValue(x: number, y: number): Collider[];
|
|
|
|
|
getKey(x: number, y: number): string;
|
|
|
|
|
clear(): void;
|
|
|
|
|
}
|
|
|
|
|
class RaycastResultParser {
|
|
|
|
|
hitCounter: number;
|
|
|
|
|
static compareRaycastHits: (a: RaycastHit, b: RaycastHit) => number;
|
|
|
|
|
_hits: RaycastHit[];
|
|
|
|
|
_tempHit: RaycastHit;
|
|
|
|
|
_checkedColliders: Collider[];
|
|
|
|
|
_cellHits: RaycastHit[];
|
|
|
|
|
_ray: Ray2D;
|
|
|
|
|
_layerMask: number;
|
|
|
|
|
start(ray: Ray2D, hits: RaycastHit[], layerMask: number): void;
|
|
|
|
|
checkRayIntersection(cellX: number, cellY: number, cell: Collider[]): boolean;
|
|
|
|
|
reset(): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
declare module es {
|
|
|
|
|
abstract class Shape {
|
|
|
|
|
position: Vector2;
|
|
|
|
|
center: Vector2;
|
2020-07-07 18:54:19 +08:00
|
|
|
bounds: Rectangle;
|
2020-07-23 11:00:46 +08:00
|
|
|
abstract recalculateBounds(collider: Collider): any;
|
2020-07-27 16:10:36 +08:00
|
|
|
abstract overlaps(other: Shape): boolean;
|
|
|
|
|
abstract collidesWithShape(other: Shape, collisionResult: CollisionResult): boolean;
|
2020-08-03 14:45:57 +08:00
|
|
|
abstract collidesWithLine(start: Vector2, end: Vector2, hit: RaycastHit): boolean;
|
|
|
|
|
abstract containsPoint(point: Vector2): any;
|
2020-07-27 16:10:36 +08:00
|
|
|
abstract pointCollidesWithShape(point: Vector2, result: CollisionResult): boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class Polygon extends Shape {
|
|
|
|
|
points: Vector2[];
|
|
|
|
|
_areEdgeNormalsDirty: boolean;
|
|
|
|
|
_originalPoints: Vector2[];
|
|
|
|
|
_polygonCenter: Vector2;
|
|
|
|
|
isBox: boolean;
|
|
|
|
|
isUnrotated: boolean;
|
|
|
|
|
constructor(points: Vector2[], isBox?: boolean);
|
2020-07-28 16:25:20 +08:00
|
|
|
_edgeNormals: Vector2[];
|
|
|
|
|
readonly edgeNormals: Vector2[];
|
2020-07-31 17:17:44 +08:00
|
|
|
setPoints(points: Vector2[]): void;
|
|
|
|
|
recalculateCenterAndEdgeNormals(): void;
|
|
|
|
|
buildEdgeNormals(): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
static buildSymmetricalPolygon(vertCount: number, radius: number): any[];
|
|
|
|
|
static recenterPolygonVerts(points: Vector2[]): void;
|
|
|
|
|
static findPolygonCenter(points: Vector2[]): Vector2;
|
2020-07-31 17:17:44 +08:00
|
|
|
static getFarthestPointInDirection(points: Vector2[], direction: Vector2): Vector2;
|
2020-08-25 14:21:37 +08:00
|
|
|
static getClosestPointOnPolygonToPoint(points: Vector2[], point: Vector2, distanceSquared: Ref<number>, edgeNormal: Vector2): Vector2;
|
2020-08-27 18:48:20 +08:00
|
|
|
static rotatePolygonVerts(radians: number, originalPoints: Vector2[], rotatedPoints: Vector2[]): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
recalculateBounds(collider: Collider): void;
|
|
|
|
|
overlaps(other: Shape): any;
|
2020-07-27 16:10:36 +08:00
|
|
|
collidesWithShape(other: Shape, result: CollisionResult): boolean;
|
2020-08-03 14:45:57 +08:00
|
|
|
collidesWithLine(start: es.Vector2, end: es.Vector2, hit: es.RaycastHit): boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
containsPoint(point: Vector2): boolean;
|
2020-07-27 16:10:36 +08:00
|
|
|
pointCollidesWithShape(point: Vector2, result: CollisionResult): boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class Box extends Polygon {
|
|
|
|
|
width: number;
|
|
|
|
|
height: number;
|
|
|
|
|
constructor(width: number, height: number);
|
|
|
|
|
private static buildBox;
|
|
|
|
|
updateBox(width: number, height: number): void;
|
|
|
|
|
overlaps(other: Shape): any;
|
2020-07-27 16:10:36 +08:00
|
|
|
collidesWithShape(other: Shape, result: CollisionResult): boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
containsPoint(point: Vector2): boolean;
|
2020-07-31 17:17:44 +08:00
|
|
|
pointCollidesWithShape(point: es.Vector2, result: es.CollisionResult): boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class Circle extends Shape {
|
|
|
|
|
radius: number;
|
|
|
|
|
_originalRadius: number;
|
|
|
|
|
constructor(radius: number);
|
|
|
|
|
recalculateBounds(collider: es.Collider): void;
|
|
|
|
|
overlaps(other: Shape): any;
|
2020-07-27 16:10:36 +08:00
|
|
|
collidesWithShape(other: Shape, result: CollisionResult): boolean;
|
2020-08-03 14:45:57 +08:00
|
|
|
collidesWithLine(start: es.Vector2, end: es.Vector2, hit: es.RaycastHit): boolean;
|
|
|
|
|
containsPoint(point: es.Vector2): boolean;
|
2020-07-27 16:10:36 +08:00
|
|
|
pointCollidesWithShape(point: Vector2, result: CollisionResult): boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class CollisionResult {
|
|
|
|
|
collider: Collider;
|
|
|
|
|
normal: Vector2;
|
2020-07-31 17:17:44 +08:00
|
|
|
minimumTranslationVector: Vector2;
|
2020-07-23 11:00:46 +08:00
|
|
|
point: Vector2;
|
2020-07-31 17:17:44 +08:00
|
|
|
removeHorizontal(deltaMovement: Vector2): void;
|
|
|
|
|
invertResult(): this;
|
|
|
|
|
toString(): string;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
2020-08-03 14:45:57 +08:00
|
|
|
declare module es {
|
|
|
|
|
class RealtimeCollisions {
|
2020-08-25 14:21:37 +08:00
|
|
|
static intersectMovingCircleBox(s: Circle, b: Box, movement: Vector2, time: Ref<number>): boolean;
|
2020-08-03 14:45:57 +08:00
|
|
|
}
|
|
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
declare module es {
|
|
|
|
|
class ShapeCollisions {
|
2020-07-27 16:10:36 +08:00
|
|
|
static polygonToPolygon(first: Polygon, second: Polygon, result: CollisionResult): boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
static intervalDistance(minA: number, maxA: number, minB: number, maxB: any): number;
|
|
|
|
|
static getInterval(axis: Vector2, polygon: Polygon, min: number, max: number): {
|
|
|
|
|
min: number;
|
|
|
|
|
max: number;
|
|
|
|
|
};
|
2020-07-27 16:10:36 +08:00
|
|
|
static circleToPolygon(circle: Circle, polygon: Polygon, result: CollisionResult): boolean;
|
|
|
|
|
static circleToBox(circle: Circle, box: Box, result: CollisionResult): boolean;
|
|
|
|
|
static pointToCircle(point: Vector2, circle: Circle, result: CollisionResult): boolean;
|
2020-07-31 17:17:44 +08:00
|
|
|
static pointToBox(point: Vector2, box: Box, result: CollisionResult): boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
static closestPointOnLine(lineA: Vector2, lineB: Vector2, closestTo: Vector2): Vector2;
|
2020-07-27 16:10:36 +08:00
|
|
|
static pointToPoly(point: Vector2, poly: Polygon, result: CollisionResult): boolean;
|
|
|
|
|
static circleToCircle(first: Circle, second: Circle, result: CollisionResult): boolean;
|
|
|
|
|
static boxToBox(first: Box, second: Box, result: CollisionResult): boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
private static minkowskiDifference;
|
2020-08-03 14:45:57 +08:00
|
|
|
static lineToPoly(start: Vector2, end: Vector2, polygon: Polygon, hit: RaycastHit): boolean;
|
|
|
|
|
static lineToLine(a1: Vector2, a2: Vector2, b1: Vector2, b2: Vector2, intersection: Vector2): boolean;
|
|
|
|
|
static lineToCircle(start: Vector2, end: Vector2, s: Circle, hit: RaycastHit): boolean;
|
|
|
|
|
static boxToBoxCast(first: Box, second: Box, movement: Vector2, hit: RaycastHit): boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
2020-09-01 11:51:03 +08:00
|
|
|
class Particle {
|
|
|
|
|
position: Vector2;
|
|
|
|
|
lastPosition: Vector2;
|
|
|
|
|
mass: number;
|
|
|
|
|
radius: number;
|
|
|
|
|
collidesWithColliders: boolean;
|
|
|
|
|
isPinned: boolean;
|
|
|
|
|
acceleration: Vector2;
|
|
|
|
|
pinnedPosition: Vector2;
|
|
|
|
|
applyForce(force: Vector2): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class VerletWorld {
|
|
|
|
|
gravity: Vector2;
|
|
|
|
|
constraintIterations: number;
|
|
|
|
|
maximumStepIterations: number;
|
|
|
|
|
simulationBounds?: Rectangle;
|
|
|
|
|
allowDragging: boolean;
|
|
|
|
|
_composites: Composite[];
|
|
|
|
|
static _colliders: Collider[];
|
|
|
|
|
_tempCircle: Circle;
|
|
|
|
|
_leftOverTime: number;
|
|
|
|
|
_fixedDeltaTime: number;
|
|
|
|
|
_iterationSteps: number;
|
|
|
|
|
_fixedDeltaTimeSq: number;
|
|
|
|
|
constructor(simulationBounds?: Rectangle);
|
|
|
|
|
update(): void;
|
|
|
|
|
handleCollisions(p: Particle, collidesWithLayers: number): void;
|
|
|
|
|
constrainParticleToBounds(p: Particle): void;
|
|
|
|
|
updateTiming(): void;
|
|
|
|
|
addComposite<T extends Composite>(composite: T): T;
|
|
|
|
|
removeComposite(composite: Composite): void;
|
|
|
|
|
handleDragging(): void;
|
|
|
|
|
debugRender(camera: Camera): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
2020-09-01 11:51:03 +08:00
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class Composite {
|
|
|
|
|
friction: Vector2;
|
|
|
|
|
collidesWithLayers: number;
|
|
|
|
|
particles: Particle[];
|
|
|
|
|
_constraints: Constraint[];
|
|
|
|
|
solveConstraints(): void;
|
|
|
|
|
updateParticles(deltaTimeSquared: number, gravity: Vector2): void;
|
|
|
|
|
handleConstraintCollisions(): void;
|
|
|
|
|
debugRender(camera: Camera): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
2020-09-01 11:51:03 +08:00
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
abstract class Constraint {
|
|
|
|
|
collidesWithColliders: boolean;
|
|
|
|
|
abstract solve(): any;
|
|
|
|
|
handleCollisions(collidesWithLayers: number): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
2020-06-11 00:03:26 +08:00
|
|
|
}
|
2020-08-12 12:16:35 +08:00
|
|
|
declare module es {
|
|
|
|
|
class TmxGroup implements ITmxLayer {
|
|
|
|
|
map: TmxMap;
|
|
|
|
|
offsetX: number;
|
|
|
|
|
offsetY: number;
|
|
|
|
|
opacity: number;
|
|
|
|
|
properties: Map<string, string>;
|
|
|
|
|
visible: boolean;
|
|
|
|
|
name: string;
|
2020-08-13 17:39:24 +08:00
|
|
|
layers: ITmxLayer[];
|
|
|
|
|
tileLayers: TmxLayer[];
|
|
|
|
|
objectGroups: TmxObjectGroup[];
|
|
|
|
|
imageLayers: TmxImageLayer[];
|
|
|
|
|
groups: TmxGroup[];
|
2020-08-12 12:16:35 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
interface ITmxLayer {
|
|
|
|
|
offsetX: number;
|
|
|
|
|
offsetY: number;
|
|
|
|
|
opacity: number;
|
|
|
|
|
visible: boolean;
|
|
|
|
|
properties: Map<string, string>;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class TmxImageLayer implements ITmxLayer {
|
|
|
|
|
map: TmxMap;
|
|
|
|
|
name: string;
|
|
|
|
|
offsetX: number;
|
|
|
|
|
offsetY: number;
|
|
|
|
|
opacity: number;
|
|
|
|
|
properties: Map<string, string>;
|
|
|
|
|
visible: boolean;
|
|
|
|
|
width?: number;
|
|
|
|
|
height?: number;
|
|
|
|
|
image: TmxImage;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class TmxLayer implements ITmxLayer {
|
|
|
|
|
map: TmxMap;
|
|
|
|
|
name: string;
|
|
|
|
|
opacity: number;
|
|
|
|
|
offsetX: number;
|
|
|
|
|
offsetY: number;
|
|
|
|
|
properties: Map<string, string>;
|
|
|
|
|
visible: boolean;
|
|
|
|
|
readonly offset: Vector2;
|
|
|
|
|
width: number;
|
|
|
|
|
height: number;
|
|
|
|
|
tiles: TmxLayerTile[];
|
|
|
|
|
getTileWithGid(gid: number): TmxLayerTile;
|
2020-08-12 18:08:12 +08:00
|
|
|
getTile(x: number, y: number): TmxLayerTile;
|
|
|
|
|
getCollisionRectangles(): Rectangle[];
|
|
|
|
|
findBoundsRect(startX: number, endX: number, startY: number, checkedIndexes?: boolean[]): Rectangle;
|
2020-08-12 12:16:35 +08:00
|
|
|
}
|
|
|
|
|
class TmxLayerTile {
|
|
|
|
|
static readonly FLIPPED_HORIZONTALLY_FLAG: number;
|
|
|
|
|
static readonly FLIPPED_VERTICALLY_FLAG: number;
|
|
|
|
|
tileset: TmxTileset;
|
|
|
|
|
gid: number;
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
readonly position: Vector2;
|
|
|
|
|
horizontalFlip: boolean;
|
|
|
|
|
verticalFlip: boolean;
|
|
|
|
|
_tilesetTileIndex?: number;
|
|
|
|
|
readonly tilesetTile: TmxTilesetTile;
|
|
|
|
|
constructor(map: TmxMap, id: number, x: number, y: number);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class TmxDocument {
|
2020-08-13 17:39:24 +08:00
|
|
|
tmxDirectory: string;
|
2020-08-12 12:16:35 +08:00
|
|
|
constructor();
|
|
|
|
|
}
|
|
|
|
|
interface ITmxElement {
|
|
|
|
|
name: string;
|
|
|
|
|
}
|
|
|
|
|
class TmxImage {
|
2020-08-14 11:44:20 +08:00
|
|
|
texture: egret.Bitmap;
|
|
|
|
|
bitmap: egret.SpriteSheet;
|
2020-08-12 12:16:35 +08:00
|
|
|
source: string;
|
|
|
|
|
format: string;
|
|
|
|
|
data: any;
|
|
|
|
|
trans: number;
|
|
|
|
|
width: number;
|
|
|
|
|
height: number;
|
|
|
|
|
dispose(): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class TmxMap extends TmxDocument {
|
|
|
|
|
version: string;
|
|
|
|
|
tiledVersion: string;
|
|
|
|
|
width: number;
|
|
|
|
|
height: number;
|
|
|
|
|
readonly worldWidth: number;
|
|
|
|
|
readonly worldHeight: number;
|
|
|
|
|
tileWidth: number;
|
|
|
|
|
tileHeight: number;
|
|
|
|
|
hexSideLength?: number;
|
|
|
|
|
orientation: OrientationType;
|
|
|
|
|
staggerAxis: StaggerAxisType;
|
|
|
|
|
staggerIndex: StaggerIndexType;
|
|
|
|
|
renderOrder: RenderOrderType;
|
|
|
|
|
backgroundColor: number;
|
|
|
|
|
nextObjectID?: number;
|
2020-08-13 17:39:24 +08:00
|
|
|
layers: ITmxLayer[];
|
|
|
|
|
tilesets: TmxTileset[];
|
|
|
|
|
tileLayers: TmxLayer[];
|
2020-08-13 20:32:36 +08:00
|
|
|
objectGroups: TmxObjectGroup[];
|
2020-08-13 17:39:24 +08:00
|
|
|
imageLayers: TmxImageLayer[];
|
|
|
|
|
groups: TmxGroup[];
|
2020-08-12 12:16:35 +08:00
|
|
|
properties: Map<string, string>;
|
|
|
|
|
maxTileWidth: number;
|
|
|
|
|
maxTileHeight: number;
|
|
|
|
|
readonly requiresLargeTileCulling: boolean;
|
|
|
|
|
getTilesetForTileGid(gid: number): TmxTileset;
|
2020-08-12 18:08:12 +08:00
|
|
|
worldToTilePositionX(x: number, clampToTilemapBounds?: boolean): number;
|
|
|
|
|
worldToTilePositionY(y: number, clampToTilemapBounds?: boolean): number;
|
|
|
|
|
getLayer(name: string): ITmxLayer;
|
2020-08-12 12:16:35 +08:00
|
|
|
update(): void;
|
|
|
|
|
_isDisposed: any;
|
|
|
|
|
dispose(disposing?: boolean): void;
|
|
|
|
|
}
|
|
|
|
|
enum OrientationType {
|
|
|
|
|
unknown = 0,
|
|
|
|
|
orthogonal = 1,
|
|
|
|
|
isometric = 2,
|
|
|
|
|
staggered = 3,
|
|
|
|
|
hexagonal = 4
|
|
|
|
|
}
|
|
|
|
|
enum StaggerAxisType {
|
|
|
|
|
x = 0,
|
|
|
|
|
y = 1
|
|
|
|
|
}
|
|
|
|
|
enum StaggerIndexType {
|
|
|
|
|
odd = 0,
|
|
|
|
|
even = 1
|
|
|
|
|
}
|
|
|
|
|
enum RenderOrderType {
|
|
|
|
|
rightDown = 0,
|
|
|
|
|
rightUp = 1,
|
|
|
|
|
leftDown = 2,
|
|
|
|
|
leftUp = 3
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class TmxObjectGroup implements ITmxLayer {
|
|
|
|
|
map: TmxMap;
|
|
|
|
|
name: string;
|
|
|
|
|
opacity: number;
|
|
|
|
|
visible: boolean;
|
|
|
|
|
offsetX: number;
|
|
|
|
|
offsetY: number;
|
|
|
|
|
color: number;
|
|
|
|
|
drawOrder: DrawOrderType;
|
2020-08-13 17:39:24 +08:00
|
|
|
objects: TmxObject[];
|
2020-08-12 12:16:35 +08:00
|
|
|
properties: Map<string, string>;
|
|
|
|
|
}
|
|
|
|
|
class TmxObject implements ITmxElement {
|
|
|
|
|
id: number;
|
|
|
|
|
name: string;
|
2020-08-13 17:39:24 +08:00
|
|
|
shape: egret.Shape;
|
|
|
|
|
textField: egret.TextField;
|
2020-08-12 12:16:35 +08:00
|
|
|
objectType: TmxObjectType;
|
|
|
|
|
type: string;
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
width: number;
|
|
|
|
|
height: number;
|
|
|
|
|
rotation: number;
|
|
|
|
|
tile: TmxLayerTile;
|
|
|
|
|
visible: boolean;
|
|
|
|
|
text: TmxText;
|
2020-08-12 18:08:12 +08:00
|
|
|
points: Vector2[];
|
|
|
|
|
properties: Map<string, string>;
|
2020-08-13 17:39:24 +08:00
|
|
|
constructor();
|
2020-08-12 12:16:35 +08:00
|
|
|
}
|
|
|
|
|
class TmxText {
|
|
|
|
|
fontFamily: string;
|
|
|
|
|
pixelSize: number;
|
|
|
|
|
wrap: boolean;
|
|
|
|
|
color: number;
|
|
|
|
|
bold: boolean;
|
|
|
|
|
italic: boolean;
|
|
|
|
|
underline: boolean;
|
|
|
|
|
strikeout: boolean;
|
|
|
|
|
kerning: boolean;
|
|
|
|
|
alignment: TmxAlignment;
|
|
|
|
|
value: string;
|
|
|
|
|
}
|
|
|
|
|
class TmxAlignment {
|
|
|
|
|
horizontal: TmxHorizontalAlignment;
|
|
|
|
|
vertical: TmxVerticalAlignment;
|
|
|
|
|
}
|
|
|
|
|
enum TmxObjectType {
|
|
|
|
|
basic = 0,
|
|
|
|
|
point = 1,
|
|
|
|
|
tile = 2,
|
|
|
|
|
ellipse = 3,
|
|
|
|
|
polygon = 4,
|
|
|
|
|
polyline = 5,
|
|
|
|
|
text = 6
|
|
|
|
|
}
|
|
|
|
|
enum DrawOrderType {
|
|
|
|
|
unkownOrder = -1,
|
|
|
|
|
TopDown = 0,
|
|
|
|
|
IndexOrder = 1
|
|
|
|
|
}
|
|
|
|
|
enum TmxHorizontalAlignment {
|
|
|
|
|
left = 0,
|
|
|
|
|
center = 1,
|
|
|
|
|
right = 2,
|
|
|
|
|
justify = 3
|
|
|
|
|
}
|
|
|
|
|
enum TmxVerticalAlignment {
|
|
|
|
|
top = 0,
|
|
|
|
|
center = 1,
|
|
|
|
|
bottom = 2
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-13 17:39:24 +08:00
|
|
|
declare module es {
|
|
|
|
|
class TiledMapLoader {
|
|
|
|
|
static loadTmxMap(map: TmxMap, filePath: string): Promise<TmxMap>;
|
2020-08-25 16:19:56 +08:00
|
|
|
static loadTmxMapData(map: TmxMap, xMap: any, info: any): Promise<TmxMap>;
|
2020-08-17 19:40:44 +08:00
|
|
|
static parseLayers(container: any, xEle: any, map: TmxMap, width: number, height: number, tmxDirectory: string): Promise<void>;
|
|
|
|
|
static loadTmxGroup(group: TmxGroup, map: TmxMap, xGroup: any, width: number, height: number, tmxDirectory: string): Promise<TmxGroup>;
|
|
|
|
|
static loadTmxImageLayer(layer: TmxImageLayer, map: TmxMap, xImageLayer: any, tmxDirectory: string): Promise<TmxImageLayer>;
|
2020-08-13 20:32:36 +08:00
|
|
|
static loadTmxLayer(layer: TmxLayer, map: TmxMap, xLayer: any, width: number, height: number): TmxLayer;
|
2020-08-13 17:39:24 +08:00
|
|
|
private static updateMaxTileSizes;
|
|
|
|
|
static parseOrientationType(type: string): OrientationType;
|
|
|
|
|
static parseStaggerAxisType(type: string): StaggerAxisType;
|
|
|
|
|
static parseStaggerIndexType(type: string): StaggerIndexType;
|
|
|
|
|
static parseRenderOrderType(type: string): RenderOrderType;
|
|
|
|
|
static parsePropertyDict(prop: any): Map<string, string>;
|
|
|
|
|
static parseTmxTileset(map: TmxMap, xTileset: any): Promise<TmxTileset>;
|
|
|
|
|
static loadTmxTileset(tileset: TmxTileset, map: TmxMap, xTileset: any, firstGid: number): Promise<TmxTileset>;
|
2020-08-17 19:40:44 +08:00
|
|
|
static loadTmxTilesetTile(tile: TmxTilesetTile, tileset: TmxTileset, xTile: any, terrains: TmxTerrain[], tmxDirectory: string): Promise<TmxTilesetTile>;
|
2020-08-13 17:39:24 +08:00
|
|
|
static loadTmxAnimationFrame(frame: TmxAnimationFrame, xFrame: any): TmxAnimationFrame;
|
|
|
|
|
static loadTmxObjectGroup(group: TmxObjectGroup, map: TmxMap, xObjectGroup: any): TmxObjectGroup;
|
|
|
|
|
static loadTmxObject(obj: TmxObject, map: TmxMap, xObject: any): TmxObject;
|
|
|
|
|
static loadTmxText(text: TmxText, xText: any): TmxText;
|
|
|
|
|
static loadTmxAlignment(alignment: TmxAlignment, xText: any): TmxAlignment;
|
|
|
|
|
static parsePoints(xPoints: any): any[];
|
2020-08-15 18:16:59 +08:00
|
|
|
static parsePoint(pt: {
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
}): Vector2;
|
2020-08-13 17:39:24 +08:00
|
|
|
static parseTmxTerrain(xTerrain: any): TmxTerrain;
|
|
|
|
|
static parseTmxTileOffset(xTileOffset: any): TmxTileOffset;
|
2020-08-17 19:40:44 +08:00
|
|
|
static loadTmxImage(image: TmxImage, xImage: any, tmxDirectory: string): Promise<TmxImage>;
|
2020-08-13 17:39:24 +08:00
|
|
|
}
|
|
|
|
|
}
|
2020-08-12 18:08:12 +08:00
|
|
|
declare module es {
|
|
|
|
|
class TiledRendering {
|
2020-08-13 17:39:24 +08:00
|
|
|
static renderMap(map: TmxMap, container: egret.DisplayObjectContainer, position: Vector2, scale: Vector2, layerDepth: number): void;
|
|
|
|
|
static renderLayer(layer: TmxLayer, container: egret.DisplayObjectContainer, position: Vector2, scale: Vector2, layerDepth: number): void;
|
2020-08-14 11:44:20 +08:00
|
|
|
static renderLayerRenderCamera(layer: ITmxLayer, container: egret.DisplayObjectContainer, position: Vector2, scale: Vector2, layerDepth: number, camerClipBounds: Rectangle): void;
|
|
|
|
|
static renderLayerCamera(layer: TmxLayer, container: egret.DisplayObjectContainer, position: Vector2, scale: Vector2, layerDepth: number, camerClipBounds: Rectangle): void;
|
2020-08-13 17:39:24 +08:00
|
|
|
static renderImageLayer(layer: TmxImageLayer, container: egret.DisplayObjectContainer, position: Vector2, scale: Vector2, layerDepth: number): void;
|
|
|
|
|
static renderObjectGroup(objGroup: TmxObjectGroup, container: egret.DisplayObjectContainer, position: Vector2, scale: Vector2, layerDepth: number): void;
|
2020-08-18 17:39:11 +08:00
|
|
|
private static renderTilesetTile;
|
2020-08-13 17:39:24 +08:00
|
|
|
static renderGroup(group: TmxGroup, container: egret.DisplayObjectContainer, position: Vector2, scale: Vector2, layerDepth: number): void;
|
|
|
|
|
static renderTile(tile: TmxLayerTile, container: egret.DisplayObjectContainer, position: Vector2, scale: Vector2, tileWidth: number, tileHeight: number, color: egret.ColorMatrixFilter, layerDepth: number): void;
|
2020-08-12 18:08:12 +08:00
|
|
|
}
|
|
|
|
|
}
|
2020-08-12 12:16:35 +08:00
|
|
|
declare module es {
|
|
|
|
|
class TmxTileset extends TmxDocument implements ITmxElement {
|
|
|
|
|
map: TmxMap;
|
|
|
|
|
firstGid: number;
|
|
|
|
|
name: any;
|
|
|
|
|
tileWidth: number;
|
|
|
|
|
tileHeight: number;
|
|
|
|
|
spacing: number;
|
|
|
|
|
margin: number;
|
|
|
|
|
columns?: number;
|
|
|
|
|
tileCount?: number;
|
|
|
|
|
tiles: Map<number, TmxTilesetTile>;
|
|
|
|
|
tileOffset: TmxTileOffset;
|
|
|
|
|
properties: Map<string, string>;
|
|
|
|
|
image: TmxImage;
|
2020-08-13 17:39:24 +08:00
|
|
|
terrains: TmxTerrain[];
|
2020-08-12 12:16:35 +08:00
|
|
|
tileRegions: Map<number, Rectangle>;
|
|
|
|
|
update(): void;
|
|
|
|
|
}
|
|
|
|
|
class TmxTileOffset {
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
}
|
|
|
|
|
class TmxTerrain implements ITmxElement {
|
|
|
|
|
name: any;
|
|
|
|
|
tile: number;
|
|
|
|
|
properties: Map<string, string>;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class TmxTilesetTile {
|
|
|
|
|
tileset: TmxTileset;
|
|
|
|
|
id: number;
|
|
|
|
|
terrainEdges: TmxTerrain[];
|
|
|
|
|
probability: number;
|
|
|
|
|
type: string;
|
|
|
|
|
properties: Map<string, string>;
|
|
|
|
|
image: TmxImage;
|
2020-08-13 17:39:24 +08:00
|
|
|
objectGroups: TmxObjectGroup[];
|
2020-08-12 12:16:35 +08:00
|
|
|
animationFrames: TmxAnimationFrame[];
|
|
|
|
|
readonly currentAnimationFrameGid: number;
|
|
|
|
|
_animationElapsedTime: number;
|
|
|
|
|
_animationCurrentFrame: number;
|
|
|
|
|
isDestructable: boolean;
|
|
|
|
|
isSlope: boolean;
|
|
|
|
|
isOneWayPlatform: boolean;
|
|
|
|
|
slopeTopLeft: number;
|
|
|
|
|
slopeTopRight: number;
|
|
|
|
|
processProperties(): void;
|
|
|
|
|
updateAnimatedTiles(): void;
|
|
|
|
|
}
|
|
|
|
|
class TmxAnimationFrame {
|
|
|
|
|
gid: number;
|
|
|
|
|
duration: number;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-13 17:39:24 +08:00
|
|
|
declare module es {
|
|
|
|
|
class TmxUtils {
|
|
|
|
|
static decode(data: any, encoding: any, compression: string): Array<number>;
|
|
|
|
|
static color16ToUnit($color: string): number;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-17 14:34:42 +08:00
|
|
|
declare class ArrayUtils {
|
|
|
|
|
static bubbleSort(ary: number[]): void;
|
|
|
|
|
static insertionSort(ary: number[]): void;
|
|
|
|
|
static binarySearch(ary: number[], value: number): number;
|
|
|
|
|
static findElementIndex(ary: any[], num: any): any;
|
|
|
|
|
static getMaxElementIndex(ary: number[]): number;
|
|
|
|
|
static getMinElementIndex(ary: number[]): number;
|
|
|
|
|
static getUniqueAry(ary: number[]): number[];
|
|
|
|
|
static getDifferAry(aryA: number[], aryB: number[]): number[];
|
|
|
|
|
static swap(array: any[], index1: number, index2: number): void;
|
|
|
|
|
static clearList(ary: any[]): void;
|
|
|
|
|
static cloneList(ary: any[]): any[];
|
|
|
|
|
static equals(ary1: number[], ary2: number[]): Boolean;
|
|
|
|
|
static insert(ary: any[], index: number, value: any): any;
|
2020-06-30 14:32:29 +08:00
|
|
|
}
|
2020-08-13 17:39:24 +08:00
|
|
|
declare module es {
|
|
|
|
|
class Base64Utils {
|
|
|
|
|
private static _keyStr;
|
|
|
|
|
static readonly nativeBase64: boolean;
|
|
|
|
|
static decode(input: string): string;
|
|
|
|
|
static encode(input: string): string;
|
|
|
|
|
static decodeBase64AsArray(input: string, bytes: number): Uint32Array;
|
|
|
|
|
static decompress(data: string, decoded: any, compression: string): any;
|
|
|
|
|
static decodeCSV(input: string): Array<number>;
|
|
|
|
|
}
|
2020-07-17 15:40:28 +08:00
|
|
|
}
|
2020-08-12 18:08:12 +08:00
|
|
|
declare module es {
|
|
|
|
|
class Color {
|
|
|
|
|
private _packedValue;
|
|
|
|
|
constructor(r: number, g: number, b: number, alpha: number);
|
|
|
|
|
b: number;
|
|
|
|
|
g: number;
|
|
|
|
|
r: number;
|
|
|
|
|
a: number;
|
|
|
|
|
packedValue: number;
|
|
|
|
|
equals(other: Color): boolean;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
declare module es {
|
|
|
|
|
class ContentManager {
|
|
|
|
|
protected loadedAssets: Map<string, any>;
|
|
|
|
|
loadRes(name: string, local?: boolean): Promise<any>;
|
|
|
|
|
dispose(): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class DrawUtils {
|
|
|
|
|
static getColorMatrix(color: number): egret.ColorMatrixFilter;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-12 12:16:35 +08:00
|
|
|
declare module es {
|
|
|
|
|
class EdgeExt {
|
|
|
|
|
static oppositeEdge(self: Edge): Edge;
|
|
|
|
|
static isHorizontal(self: Edge): boolean;
|
|
|
|
|
static isVertical(self: Edge): boolean;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
declare module es {
|
|
|
|
|
class FuncPack {
|
|
|
|
|
func: Function;
|
|
|
|
|
context: any;
|
|
|
|
|
constructor(func: Function, context: any);
|
|
|
|
|
}
|
|
|
|
|
class Emitter<T> {
|
|
|
|
|
private _messageTable;
|
|
|
|
|
constructor();
|
|
|
|
|
addObserver(eventType: T, handler: Function, context: any): void;
|
|
|
|
|
removeObserver(eventType: T, handler: Function): void;
|
|
|
|
|
emit(eventType: T, data?: any): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-12 12:16:35 +08:00
|
|
|
declare module es {
|
|
|
|
|
enum Edge {
|
|
|
|
|
top = 0,
|
|
|
|
|
bottom = 1,
|
|
|
|
|
left = 2,
|
|
|
|
|
right = 3
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class Enumerable {
|
|
|
|
|
static repeat<T>(element: T, count: number): any[];
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
declare module es {
|
|
|
|
|
class GlobalManager {
|
2020-07-28 16:25:20 +08:00
|
|
|
_enabled: boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
enabled: boolean;
|
|
|
|
|
setEnabled(isEnabled: boolean): void;
|
|
|
|
|
onEnabled(): void;
|
|
|
|
|
onDisabled(): void;
|
|
|
|
|
update(): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class ListPool {
|
|
|
|
|
private static readonly _objectQueue;
|
|
|
|
|
static warmCache(cacheCount: number): void;
|
|
|
|
|
static trimCache(cacheCount: any): void;
|
|
|
|
|
static clearCache(): void;
|
|
|
|
|
static obtain<T>(): T[];
|
|
|
|
|
static free<T>(obj: Array<T>): void;
|
|
|
|
|
}
|
2020-06-16 09:10:09 +08:00
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
declare module es {
|
|
|
|
|
class Pair<T> {
|
|
|
|
|
first: T;
|
|
|
|
|
second: T;
|
|
|
|
|
constructor(first: T, second: T);
|
|
|
|
|
clear(): void;
|
|
|
|
|
equals(other: Pair<T>): boolean;
|
|
|
|
|
}
|
2020-06-16 09:10:09 +08:00
|
|
|
}
|
2020-08-28 19:12:21 +08:00
|
|
|
declare module es {
|
|
|
|
|
class Pool<T> {
|
|
|
|
|
private static _objectQueue;
|
|
|
|
|
static warmCache(type: any, cacheCount: number): void;
|
|
|
|
|
static trimCache(cacheCount: number): void;
|
|
|
|
|
static clearCache(): void;
|
|
|
|
|
static obtain<T>(type: any): T;
|
|
|
|
|
static free<T>(obj: T): void;
|
|
|
|
|
}
|
|
|
|
|
interface IPoolable {
|
|
|
|
|
reset(): any;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-17 14:34:42 +08:00
|
|
|
declare class RandomUtils {
|
|
|
|
|
static randrange(start: number, stop: number, step?: number): number;
|
|
|
|
|
static randint(a: number, b: number): number;
|
|
|
|
|
static randnum(a: number, b: number): number;
|
|
|
|
|
static shuffle(array: any[]): any[];
|
|
|
|
|
static choice(sequence: any): any;
|
|
|
|
|
static sample(sequence: any[], num: number): any[];
|
|
|
|
|
static random(): number;
|
|
|
|
|
static boolean(chance?: number): boolean;
|
2020-07-28 16:25:20 +08:00
|
|
|
private static _randomCompare;
|
2020-07-17 14:34:42 +08:00
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
declare module es {
|
|
|
|
|
class RectangleExt {
|
2020-08-12 12:16:35 +08:00
|
|
|
static getSide(rect: Rectangle, edge: Edge): number;
|
2020-07-23 11:00:46 +08:00
|
|
|
static union(first: Rectangle, point: Vector2): Rectangle;
|
2020-08-12 12:16:35 +08:00
|
|
|
static getHalfRect(rect: Rectangle, edge: Edge): Rectangle;
|
|
|
|
|
static getRectEdgePortion(rect: Rectangle, edge: Edge, size?: number): Rectangle;
|
|
|
|
|
static expandSide(rect: Rectangle, edge: Edge, amount: number): void;
|
|
|
|
|
static contract(rect: Rectangle, horizontalAmount: any, verticalAmount: any): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-25 14:21:37 +08:00
|
|
|
declare module es {
|
|
|
|
|
class Ref<T> {
|
|
|
|
|
value: T;
|
|
|
|
|
constructor(value: T);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-12 12:16:35 +08:00
|
|
|
declare module es {
|
|
|
|
|
class SubpixelNumber {
|
|
|
|
|
remainder: number;
|
|
|
|
|
update(amount: number): number;
|
|
|
|
|
reset(): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class Triangulator {
|
|
|
|
|
triangleIndices: number[];
|
|
|
|
|
private _triPrev;
|
|
|
|
|
private _triNext;
|
2020-07-28 16:25:20 +08:00
|
|
|
static testPointTriangle(point: Vector2, a: Vector2, b: Vector2, c: Vector2): boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
triangulate(points: Vector2[], arePointsCCW?: boolean): void;
|
|
|
|
|
private initialize;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class Vector2Ext {
|
|
|
|
|
static isTriangleCCW(a: Vector2, center: Vector2, c: Vector2): boolean;
|
|
|
|
|
static cross(u: Vector2, v: Vector2): number;
|
|
|
|
|
static perpendicular(first: Vector2, second: Vector2): Vector2;
|
2020-08-24 09:06:25 +08:00
|
|
|
static normalize(vec: Vector2): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
static transformA(sourceArray: Vector2[], sourceIndex: number, matrix: Matrix2D, destinationArray: Vector2[], destinationIndex: number, length: number): void;
|
2020-08-28 18:04:50 +08:00
|
|
|
static transformR(position: Vector2, matrix: Matrix2D, result: Vector2): void;
|
2020-07-23 11:00:46 +08:00
|
|
|
static transform(sourceArray: Vector2[], matrix: Matrix2D, destinationArray: Vector2[]): void;
|
|
|
|
|
static round(vec: Vector2): Vector2;
|
|
|
|
|
}
|
2020-06-10 13:38:04 +08:00
|
|
|
}
|
2020-07-20 13:44:26 +08:00
|
|
|
declare class WebGLUtils {
|
|
|
|
|
static getContext(): CanvasRenderingContext2D;
|
|
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
declare module es {
|
|
|
|
|
class Layout {
|
|
|
|
|
clientArea: Rectangle;
|
|
|
|
|
safeArea: Rectangle;
|
|
|
|
|
constructor();
|
|
|
|
|
place(size: Vector2, horizontalMargin: number, verticalMargine: number, alignment: Alignment): Rectangle;
|
|
|
|
|
}
|
|
|
|
|
enum Alignment {
|
|
|
|
|
none = 0,
|
|
|
|
|
left = 1,
|
|
|
|
|
right = 2,
|
|
|
|
|
horizontalCenter = 4,
|
|
|
|
|
top = 8,
|
|
|
|
|
bottom = 16,
|
|
|
|
|
verticalCenter = 32,
|
|
|
|
|
topLeft = 9,
|
|
|
|
|
topRight = 10,
|
|
|
|
|
topCenter = 12,
|
|
|
|
|
bottomLeft = 17,
|
|
|
|
|
bottomRight = 18,
|
|
|
|
|
bottomCenter = 20,
|
|
|
|
|
centerLeft = 33,
|
|
|
|
|
centerRight = 34,
|
|
|
|
|
center = 36
|
|
|
|
|
}
|
2020-07-12 14:51:20 +08:00
|
|
|
}
|
|
|
|
|
declare namespace stopwatch {
|
|
|
|
|
class Stopwatch {
|
|
|
|
|
private readonly getSystemTime;
|
|
|
|
|
private _startSystemTime;
|
|
|
|
|
private _stopSystemTime;
|
|
|
|
|
private _stopDuration;
|
|
|
|
|
private _pendingSliceStartStopwatchTime;
|
|
|
|
|
private _completeSlices;
|
|
|
|
|
constructor(getSystemTime?: GetTimeFunc);
|
|
|
|
|
getState(): State;
|
|
|
|
|
isIdle(): boolean;
|
|
|
|
|
isRunning(): boolean;
|
|
|
|
|
isStopped(): boolean;
|
|
|
|
|
slice(): Slice;
|
|
|
|
|
getCompletedSlices(): Slice[];
|
|
|
|
|
getCompletedAndPendingSlices(): Slice[];
|
|
|
|
|
getPendingSlice(): Slice;
|
|
|
|
|
getTime(): number;
|
|
|
|
|
reset(): void;
|
|
|
|
|
start(forceReset?: boolean): void;
|
|
|
|
|
stop(recordPendingSlice?: boolean): number;
|
2020-07-28 16:25:20 +08:00
|
|
|
private calculatePendingSlice;
|
|
|
|
|
private caculateStopwatchTime;
|
|
|
|
|
private getSystemTimeOfCurrentStopwatchTime;
|
2020-07-12 14:51:20 +08:00
|
|
|
private recordPendingSlice;
|
|
|
|
|
}
|
|
|
|
|
type GetTimeFunc = () => number;
|
|
|
|
|
enum State {
|
|
|
|
|
IDLE = "IDLE",
|
|
|
|
|
RUNNING = "RUNNING",
|
|
|
|
|
STOPPED = "STOPPED"
|
|
|
|
|
}
|
|
|
|
|
function setDefaultSystemTimeGetter(systemTimeGetter?: GetTimeFunc): void;
|
|
|
|
|
interface Slice {
|
|
|
|
|
readonly startTime: number;
|
|
|
|
|
readonly endTime: number;
|
|
|
|
|
readonly duration: number;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
declare module es {
|
|
|
|
|
class TimeRuler {
|
|
|
|
|
static readonly maxBars: number;
|
|
|
|
|
static readonly maxSamples: number;
|
|
|
|
|
static readonly maxNestCall: number;
|
|
|
|
|
static readonly barHeight: number;
|
|
|
|
|
static readonly maxSampleFrames: number;
|
|
|
|
|
static readonly logSnapDuration: number;
|
|
|
|
|
static readonly barPadding: number;
|
|
|
|
|
static readonly autoAdjustDelay: number;
|
2020-07-23 19:28:01 +08:00
|
|
|
private static _instance;
|
2020-07-28 16:25:20 +08:00
|
|
|
targetSampleFrames: number;
|
|
|
|
|
width: number;
|
|
|
|
|
enabled: true;
|
|
|
|
|
showLog: boolean;
|
2020-07-23 11:00:46 +08:00
|
|
|
private _logs;
|
|
|
|
|
private sampleFrames;
|
|
|
|
|
private _position;
|
|
|
|
|
private _prevLog;
|
|
|
|
|
private _curLog;
|
|
|
|
|
private frameCount;
|
|
|
|
|
private markers;
|
|
|
|
|
private stopwacth;
|
|
|
|
|
private _markerNameToIdMap;
|
|
|
|
|
private _updateCount;
|
|
|
|
|
private _frameAdjust;
|
2020-08-26 19:56:48 +08:00
|
|
|
private _rectShape1;
|
|
|
|
|
private _rectShape2;
|
|
|
|
|
private _rectShape3;
|
|
|
|
|
private _rectShape4;
|
|
|
|
|
private _rectShape5;
|
|
|
|
|
private _rectShape6;
|
2020-07-23 11:00:46 +08:00
|
|
|
constructor();
|
2020-07-28 16:25:20 +08:00
|
|
|
static readonly Instance: TimeRuler;
|
2020-07-23 11:00:46 +08:00
|
|
|
startFrame(): void;
|
|
|
|
|
beginMark(markerName: string, color: number, barIndex?: number): void;
|
|
|
|
|
endMark(markerName: string, barIndex?: number): void;
|
|
|
|
|
getAverageTime(barIndex: number, markerName: string): number;
|
|
|
|
|
resetLog(): void;
|
|
|
|
|
render(position?: Vector2, width?: number): void;
|
2020-07-28 16:25:20 +08:00
|
|
|
private onGraphicsDeviceReset;
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|
|
|
|
|
class FrameLog {
|
|
|
|
|
bars: MarkerCollection[];
|
|
|
|
|
constructor();
|
|
|
|
|
}
|
|
|
|
|
class MarkerCollection {
|
|
|
|
|
markers: Marker[];
|
|
|
|
|
markCount: number;
|
|
|
|
|
markerNests: number[];
|
|
|
|
|
nestCount: number;
|
|
|
|
|
constructor();
|
|
|
|
|
}
|
|
|
|
|
class Marker {
|
|
|
|
|
markerId: number;
|
|
|
|
|
beginTime: number;
|
|
|
|
|
endTime: number;
|
|
|
|
|
color: number;
|
|
|
|
|
}
|
|
|
|
|
class MarkerInfo {
|
|
|
|
|
name: string;
|
|
|
|
|
logs: MarkerLog[];
|
|
|
|
|
constructor(name: any);
|
|
|
|
|
}
|
|
|
|
|
class MarkerLog {
|
|
|
|
|
snapMin: number;
|
|
|
|
|
snapMax: number;
|
|
|
|
|
snapAvg: number;
|
|
|
|
|
min: number;
|
|
|
|
|
max: number;
|
|
|
|
|
avg: number;
|
|
|
|
|
samples: number;
|
|
|
|
|
color: number;
|
|
|
|
|
initialized: boolean;
|
|
|
|
|
}
|
2020-07-12 14:51:20 +08:00
|
|
|
}
|
2020-08-28 19:12:21 +08:00
|
|
|
declare module es {
|
|
|
|
|
interface ICoroutine {
|
|
|
|
|
stop(): any;
|
|
|
|
|
setUseUnscaledDeltaTime(useUnscaledDeltaTime: any): ICoroutine;
|
|
|
|
|
}
|
|
|
|
|
class Coroutine {
|
|
|
|
|
static waitForSeconds(seconds: number): WaitForSeconds;
|
|
|
|
|
}
|
|
|
|
|
class WaitForSeconds {
|
|
|
|
|
static waiter: WaitForSeconds;
|
|
|
|
|
waitTime: number;
|
|
|
|
|
wait(seconds: number): WaitForSeconds;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class CoroutineImpl implements ICoroutine, IPoolable {
|
2020-09-01 11:51:03 +08:00
|
|
|
enumerator: Iterator<any>;
|
2020-08-28 19:12:21 +08:00
|
|
|
waitTimer: number;
|
|
|
|
|
isDone: boolean;
|
|
|
|
|
waitForCoroutine: CoroutineImpl;
|
|
|
|
|
useUnscaledDeltaTime: boolean;
|
|
|
|
|
stop(): void;
|
|
|
|
|
setUseUnscaledDeltaTime(useUnscaledDeltaTime: any): es.ICoroutine;
|
|
|
|
|
prepareForuse(): void;
|
|
|
|
|
reset(): void;
|
|
|
|
|
}
|
|
|
|
|
class CoroutineManager extends GlobalManager {
|
|
|
|
|
_isInUpdate: boolean;
|
|
|
|
|
_unblockedCoroutines: CoroutineImpl[];
|
|
|
|
|
_shouldRunNextFrame: CoroutineImpl[];
|
2020-09-01 11:51:03 +08:00
|
|
|
startCoroutine(enumerator: Iterator<any>): CoroutineImpl;
|
2020-08-28 19:12:21 +08:00
|
|
|
update(): void;
|
|
|
|
|
tickCoroutine(coroutine: CoroutineImpl): boolean;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-27 18:48:20 +08:00
|
|
|
declare module es {
|
|
|
|
|
class TouchState {
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
touchPoint: number;
|
|
|
|
|
touchDown: boolean;
|
|
|
|
|
readonly position: Vector2;
|
|
|
|
|
reset(): void;
|
|
|
|
|
}
|
|
|
|
|
class Input {
|
|
|
|
|
private static _init;
|
|
|
|
|
private static _previousTouchState;
|
|
|
|
|
private static _resolutionOffset;
|
|
|
|
|
private static _touchIndex;
|
|
|
|
|
private static _gameTouchs;
|
|
|
|
|
static readonly gameTouchs: TouchState[];
|
|
|
|
|
private static _resolutionScale;
|
|
|
|
|
static readonly resolutionScale: Vector2;
|
|
|
|
|
private static _totalTouchCount;
|
|
|
|
|
static readonly totalTouchCount: number;
|
|
|
|
|
static readonly touchPosition: Vector2;
|
|
|
|
|
static _virtualInputs: VirtualInput[];
|
|
|
|
|
static maxSupportedTouch: number;
|
|
|
|
|
static readonly touchPositionDelta: Vector2;
|
|
|
|
|
static initialize(): void;
|
|
|
|
|
static update(): void;
|
|
|
|
|
static scaledPosition(position: Vector2): Vector2;
|
|
|
|
|
static isKeyPressed(key: Keys): boolean;
|
|
|
|
|
static isKeyPressedBoth(keyA: Keys, keyB: Keys): boolean;
|
|
|
|
|
static isKeyDown(key: Keys): boolean;
|
|
|
|
|
static isKeyDownBoth(keyA: Keys, keyB: Keys): boolean;
|
|
|
|
|
static isKeyReleased(key: Keys): boolean;
|
|
|
|
|
static isKeyReleasedBoth(keyA: Keys, keyB: Keys): boolean;
|
|
|
|
|
private static initTouchCache;
|
|
|
|
|
private static touchBegin;
|
|
|
|
|
private static touchMove;
|
|
|
|
|
private static touchEnd;
|
|
|
|
|
private static setpreviousTouchState;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
import Keys = es.Keys;
|
|
|
|
|
declare class KeyboardUtils {
|
|
|
|
|
static currentKeys: Keys[];
|
|
|
|
|
static previousKeys: Keys[];
|
|
|
|
|
private static keyStatusKeys;
|
|
|
|
|
static init(): void;
|
|
|
|
|
static update(): void;
|
|
|
|
|
static destroy(): void;
|
|
|
|
|
private static onKeyDownHandler;
|
|
|
|
|
private static onKeyUpHandler;
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
enum Keys {
|
|
|
|
|
none = 0,
|
|
|
|
|
back = 8,
|
|
|
|
|
tab = 9,
|
|
|
|
|
enter = 13,
|
|
|
|
|
capsLock = 20,
|
|
|
|
|
escape = 27,
|
|
|
|
|
space = 32,
|
|
|
|
|
pageUp = 33,
|
|
|
|
|
pageDown = 34,
|
|
|
|
|
end = 35,
|
|
|
|
|
home = 36,
|
|
|
|
|
left = 37,
|
|
|
|
|
up = 38,
|
|
|
|
|
right = 39,
|
|
|
|
|
down = 40,
|
|
|
|
|
select = 41,
|
|
|
|
|
print = 42,
|
|
|
|
|
execute = 43,
|
|
|
|
|
printScreen = 44,
|
|
|
|
|
insert = 45,
|
|
|
|
|
delete = 46,
|
|
|
|
|
help = 47,
|
|
|
|
|
d0 = 48,
|
|
|
|
|
d1 = 49,
|
|
|
|
|
d2 = 50,
|
|
|
|
|
d3 = 51,
|
|
|
|
|
d4 = 52,
|
|
|
|
|
d5 = 53,
|
|
|
|
|
d6 = 54,
|
|
|
|
|
d7 = 55,
|
|
|
|
|
d8 = 56,
|
|
|
|
|
d9 = 57,
|
|
|
|
|
a = 65,
|
|
|
|
|
b = 66,
|
|
|
|
|
c = 67,
|
|
|
|
|
d = 68,
|
|
|
|
|
e = 69,
|
|
|
|
|
f = 70,
|
|
|
|
|
g = 71,
|
|
|
|
|
h = 72,
|
|
|
|
|
i = 73,
|
|
|
|
|
j = 74,
|
|
|
|
|
k = 75,
|
|
|
|
|
l = 76,
|
|
|
|
|
m = 77,
|
|
|
|
|
n = 78,
|
|
|
|
|
o = 79,
|
|
|
|
|
p = 80,
|
|
|
|
|
q = 81,
|
|
|
|
|
r = 82,
|
|
|
|
|
s = 83,
|
|
|
|
|
t = 84,
|
|
|
|
|
u = 85,
|
|
|
|
|
v = 86,
|
|
|
|
|
w = 87,
|
|
|
|
|
x = 88,
|
|
|
|
|
y = 89,
|
|
|
|
|
z = 90,
|
|
|
|
|
leftWindows = 91,
|
|
|
|
|
rightWindows = 92,
|
|
|
|
|
apps = 93,
|
|
|
|
|
sleep = 95,
|
|
|
|
|
numPad0 = 96,
|
|
|
|
|
numPad1 = 97,
|
|
|
|
|
numPad2 = 98,
|
|
|
|
|
numPad3 = 99,
|
|
|
|
|
numPad4 = 100,
|
|
|
|
|
numPad5 = 101,
|
|
|
|
|
numPad6 = 102,
|
|
|
|
|
numPad7 = 103,
|
|
|
|
|
numPad8 = 104,
|
|
|
|
|
numPad9 = 105,
|
|
|
|
|
multiply = 106,
|
|
|
|
|
add = 107,
|
|
|
|
|
seperator = 108,
|
|
|
|
|
subtract = 109,
|
|
|
|
|
decimal = 110,
|
|
|
|
|
divide = 111,
|
|
|
|
|
f1 = 112,
|
|
|
|
|
f2 = 113,
|
|
|
|
|
f3 = 114,
|
|
|
|
|
f4 = 115,
|
|
|
|
|
f5 = 116,
|
|
|
|
|
f6 = 117,
|
|
|
|
|
f7 = 118,
|
|
|
|
|
f8 = 119,
|
|
|
|
|
f9 = 120,
|
|
|
|
|
f10 = 121,
|
|
|
|
|
f11 = 122,
|
|
|
|
|
f12 = 123,
|
|
|
|
|
f13 = 124,
|
|
|
|
|
f14 = 125,
|
|
|
|
|
f15 = 126,
|
|
|
|
|
f16 = 127,
|
|
|
|
|
f17 = 128,
|
|
|
|
|
f18 = 129,
|
|
|
|
|
f19 = 130,
|
|
|
|
|
f20 = 131,
|
|
|
|
|
f21 = 132,
|
|
|
|
|
f22 = 133,
|
|
|
|
|
f23 = 134,
|
|
|
|
|
f24 = 135,
|
|
|
|
|
numLock = 144,
|
|
|
|
|
scroll = 145,
|
|
|
|
|
leftShift = 160,
|
|
|
|
|
rightShift = 161,
|
|
|
|
|
leftControl = 162,
|
|
|
|
|
rightControl = 163,
|
|
|
|
|
leftAlt = 164,
|
|
|
|
|
rightAlt = 165,
|
|
|
|
|
browserBack = 166,
|
|
|
|
|
browserForward = 167
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
enum OverlapBehavior {
|
|
|
|
|
cancelOut = 0,
|
|
|
|
|
takeOlder = 1,
|
|
|
|
|
takeNewer = 2
|
|
|
|
|
}
|
|
|
|
|
abstract class VirtualInput {
|
|
|
|
|
protected constructor();
|
|
|
|
|
deregister(): void;
|
|
|
|
|
abstract update(): any;
|
|
|
|
|
}
|
|
|
|
|
abstract class VirtualInputNode {
|
|
|
|
|
update(): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class VirtualIntegerAxis extends VirtualInput {
|
|
|
|
|
nodes: VirtualAxisNode[];
|
|
|
|
|
readonly value: number;
|
|
|
|
|
constructor(...nodes: VirtualAxisNode[]);
|
|
|
|
|
update(): void;
|
|
|
|
|
addKeyboardKeys(overlapBehavior: OverlapBehavior, negative: Keys, positive: Keys): this;
|
|
|
|
|
}
|
|
|
|
|
abstract class VirtualAxisNode extends VirtualInputNode {
|
|
|
|
|
abstract value: number;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class VirtualAxis extends VirtualInput {
|
|
|
|
|
nodes: VirtualAxisNode[];
|
|
|
|
|
readonly value: number;
|
|
|
|
|
constructor(...nodes: VirtualAxisNode[]);
|
|
|
|
|
update(): void;
|
|
|
|
|
}
|
|
|
|
|
class KeyboardKeys extends VirtualAxisNode {
|
|
|
|
|
overlapBehavior: OverlapBehavior;
|
|
|
|
|
positive: Keys;
|
|
|
|
|
negative: Keys;
|
|
|
|
|
_value: number;
|
|
|
|
|
_turned: boolean;
|
|
|
|
|
constructor(overlapBehavior: OverlapBehavior, negative: Keys, positive: Keys);
|
|
|
|
|
update(): void;
|
|
|
|
|
readonly value: number;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class VirtualButton extends VirtualInput {
|
|
|
|
|
nodes: Node[];
|
|
|
|
|
bufferTime: number;
|
|
|
|
|
firstRepeatTime: number;
|
|
|
|
|
mutiRepeatTime: number;
|
|
|
|
|
isRepeating: boolean;
|
|
|
|
|
_bufferCounter: number;
|
|
|
|
|
_repeatCounter: number;
|
|
|
|
|
_willRepeat: boolean;
|
|
|
|
|
constructor(bufferTime?: number, ...nodes: Node[]);
|
|
|
|
|
setRepeat(firstRepeatTime: number, mutiRepeatTime?: number): void;
|
|
|
|
|
update(): void;
|
|
|
|
|
readonly isDown: boolean;
|
|
|
|
|
readonly isPressed: boolean;
|
|
|
|
|
readonly isReleased: boolean;
|
|
|
|
|
consumeBuffer(): void;
|
|
|
|
|
addKeyboardKey(key: Keys): VirtualButton;
|
|
|
|
|
}
|
|
|
|
|
abstract class Node extends VirtualInputNode {
|
|
|
|
|
abstract isDown: boolean;
|
|
|
|
|
abstract isPressed: boolean;
|
|
|
|
|
abstract isReleased: boolean;
|
|
|
|
|
}
|
|
|
|
|
class KeyboardKey extends Node {
|
|
|
|
|
key: Keys;
|
|
|
|
|
constructor(key: Keys);
|
|
|
|
|
readonly isDown: boolean;
|
|
|
|
|
readonly isPressed: boolean;
|
|
|
|
|
readonly isReleased: boolean;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-14 15:46:19 +08:00
|
|
|
declare module es {
|
|
|
|
|
class AssetPacker {
|
|
|
|
|
protected itemsToRaster: TextureToPack[];
|
|
|
|
|
onProcessCompleted: Function;
|
|
|
|
|
useCache: boolean;
|
|
|
|
|
cacheName: string;
|
|
|
|
|
protected _sprites: Map<string, egret.Texture>;
|
|
|
|
|
protected allow4096Textures: boolean;
|
|
|
|
|
addTextureToPack(texture: egret.Texture, customID: string): void;
|
|
|
|
|
process(allow4096Textures?: boolean): Promise<void>;
|
|
|
|
|
protected loadPack(): Promise<any>;
|
|
|
|
|
protected createPack(): void;
|
|
|
|
|
dispose(): void;
|
|
|
|
|
getTexture(id: string): egret.Texture;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class IntegerRectangle extends Rectangle {
|
|
|
|
|
id: number;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class RectanglePacker {
|
|
|
|
|
private _width;
|
|
|
|
|
private _height;
|
|
|
|
|
private _padding;
|
|
|
|
|
private _packedWidth;
|
|
|
|
|
private _packedHeight;
|
|
|
|
|
private _insertList;
|
|
|
|
|
private _insertedRectangles;
|
|
|
|
|
private _freeAreas;
|
|
|
|
|
private _newFreeAreas;
|
|
|
|
|
private _outsideRectangle;
|
|
|
|
|
private _sortableSizeStack;
|
|
|
|
|
private _rectangleStack;
|
|
|
|
|
readonly rectangleCount: number;
|
|
|
|
|
readonly packedWidth: number;
|
|
|
|
|
readonly packedHeight: number;
|
|
|
|
|
readonly padding: number;
|
|
|
|
|
constructor(width: number, height: number, padding?: number);
|
|
|
|
|
reset(width: number, height: number, padding?: number): void;
|
|
|
|
|
insertRectangle(width: number, height: number, id: number): void;
|
|
|
|
|
packRectangles(sort?: boolean): number;
|
|
|
|
|
getRectangle(index: number, rectangle: IntegerRectangle): IntegerRectangle;
|
|
|
|
|
getRectangleId(index: number): number;
|
|
|
|
|
private generateNewFreeAreas;
|
|
|
|
|
private filterSelfSubAreas;
|
|
|
|
|
private generateDividedAreas;
|
|
|
|
|
private getFreeAreaIndex;
|
|
|
|
|
private allocateSize;
|
|
|
|
|
private freeSize;
|
|
|
|
|
private allocateRectangle;
|
|
|
|
|
private freeRectangle;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class SortableSize {
|
|
|
|
|
width: number;
|
|
|
|
|
height: number;
|
|
|
|
|
id: number;
|
|
|
|
|
constructor(width: number, height: number, id: number);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class TextureAssets {
|
|
|
|
|
assets: TextureAsset[];
|
|
|
|
|
constructor(assets: TextureAsset[]);
|
|
|
|
|
}
|
|
|
|
|
class TextureAsset {
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
width: number;
|
|
|
|
|
height: number;
|
|
|
|
|
name: string;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class TextureToPack {
|
|
|
|
|
texture: egret.Texture;
|
|
|
|
|
id: string;
|
|
|
|
|
constructor(texture: egret.Texture, id: string);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-26 19:56:48 +08:00
|
|
|
declare module es {
|
|
|
|
|
interface ITimer {
|
|
|
|
|
context: any;
|
|
|
|
|
stop(): any;
|
|
|
|
|
reset(): any;
|
|
|
|
|
getContext<T>(): T;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class Timer implements ITimer {
|
|
|
|
|
context: any;
|
|
|
|
|
_timeInSeconds: number;
|
|
|
|
|
_repeats: boolean;
|
|
|
|
|
_onTime: (timer: ITimer) => void;
|
|
|
|
|
_isDone: boolean;
|
|
|
|
|
_elapsedTime: number;
|
|
|
|
|
getContext<T>(): T;
|
|
|
|
|
reset(): void;
|
|
|
|
|
stop(): void;
|
|
|
|
|
tick(): boolean;
|
|
|
|
|
initialize(timeInsSeconds: number, repeats: boolean, context: any, onTime: (timer: ITimer) => void): void;
|
|
|
|
|
unload(): void;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
declare module es {
|
|
|
|
|
class TimerManager extends GlobalManager {
|
|
|
|
|
_timers: Timer[];
|
|
|
|
|
update(): void;
|
|
|
|
|
schedule(timeInSeconds: number, repeats: boolean, context: any, onTime: (timer: ITimer) => void): Timer;
|
|
|
|
|
}
|
|
|
|
|
}
|