tiled 基本数据
This commit is contained in:
334
source/bin/framework.d.ts
vendored
334
source/bin/framework.d.ts
vendored
@@ -699,6 +699,32 @@ declare module es {
|
||||
stop(): void;
|
||||
}
|
||||
}
|
||||
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;
|
||||
@@ -1207,6 +1233,7 @@ declare module es {
|
||||
static isEven(value: number): boolean;
|
||||
static clamp01(value: number): number;
|
||||
static angleBetweenVectors(from: Vector2, to: Vector2): number;
|
||||
static incrementWithWrap(t: number, length: number): number;
|
||||
}
|
||||
}
|
||||
declare module es {
|
||||
@@ -1488,6 +1515,281 @@ declare module es {
|
||||
reset(): void;
|
||||
}
|
||||
}
|
||||
declare module es {
|
||||
class TmxGroup implements ITmxLayer {
|
||||
map: TmxMap;
|
||||
offsetX: number;
|
||||
offsetY: number;
|
||||
opacity: number;
|
||||
properties: Map<string, string>;
|
||||
visible: boolean;
|
||||
name: string;
|
||||
layers: TmxList<any>;
|
||||
tileLayers: TmxList<TmxLayer>;
|
||||
objectGroups: TmxList<TmxObjectGroup>;
|
||||
imageLayers: TmxList<TmxImageLayer>;
|
||||
groups: TmxList<TmxGroup>;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
class TmxLayerTile {
|
||||
static readonly FLIPPED_HORIZONTALLY_FLAG: number;
|
||||
static readonly FLIPPED_VERTICALLY_FLAG: number;
|
||||
static readonly FLIPPED_DIAGONALLY_FLAG: number;
|
||||
tileset: TmxTileset;
|
||||
gid: number;
|
||||
x: number;
|
||||
y: number;
|
||||
readonly position: Vector2;
|
||||
horizontalFlip: boolean;
|
||||
verticalFlip: boolean;
|
||||
diagonalFlip: boolean;
|
||||
_tilesetTileIndex?: number;
|
||||
readonly tilesetTile: TmxTilesetTile;
|
||||
constructor(map: TmxMap, id: number, x: number, y: number);
|
||||
}
|
||||
}
|
||||
declare module es {
|
||||
class TmxDocument {
|
||||
TmxDirectory: string;
|
||||
constructor();
|
||||
}
|
||||
interface ITmxElement {
|
||||
name: string;
|
||||
}
|
||||
class TmxList<T extends ITmxElement> extends Map<string, T> {
|
||||
_nameCount: Map<string, number>;
|
||||
add(t: T): void;
|
||||
protected getKeyForItem(item: T): string;
|
||||
}
|
||||
class TmxImage {
|
||||
texture: egret.Texture;
|
||||
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;
|
||||
layers: TmxList<any>;
|
||||
tilesets: TmxList<TmxTileset>;
|
||||
tileLayers: TmxList<TmxLayer>;
|
||||
objectGroups: TmxList<TmxObjectGroup>;
|
||||
imageLayers: TmxList<TmxImageLayer>;
|
||||
groups: TmxList<TmxGroup>;
|
||||
properties: Map<string, string>;
|
||||
maxTileWidth: number;
|
||||
maxTileHeight: number;
|
||||
readonly requiresLargeTileCulling: boolean;
|
||||
getTilesetForTileGid(gid: number): TmxTileset;
|
||||
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;
|
||||
objects: TmxList<TmxObject>;
|
||||
properties: Map<string, string>;
|
||||
}
|
||||
class TmxObject implements ITmxElement {
|
||||
id: number;
|
||||
name: string;
|
||||
objectType: TmxObjectType;
|
||||
type: string;
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
rotation: number;
|
||||
tile: TmxLayerTile;
|
||||
visible: boolean;
|
||||
text: TmxText;
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
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;
|
||||
terrains: TmxList<TmxTerrain>;
|
||||
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;
|
||||
objectGroups: TmxList<TmxObjectGroup>;
|
||||
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;
|
||||
}
|
||||
}
|
||||
declare class ArrayUtils {
|
||||
static bubbleSort(ary: number[]): void;
|
||||
static insertionSort(ary: number[]): void;
|
||||
@@ -1530,6 +1832,13 @@ declare module es {
|
||||
static getColorMatrix(color: number): egret.ColorMatrixFilter;
|
||||
}
|
||||
}
|
||||
declare module es {
|
||||
class EdgeExt {
|
||||
static oppositeEdge(self: Edge): Edge;
|
||||
static isHorizontal(self: Edge): boolean;
|
||||
static isVertical(self: Edge): boolean;
|
||||
}
|
||||
}
|
||||
declare module es {
|
||||
class FuncPack {
|
||||
func: Function;
|
||||
@@ -1544,6 +1853,19 @@ declare module es {
|
||||
emit(eventType: T, data?: any): void;
|
||||
}
|
||||
}
|
||||
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[];
|
||||
}
|
||||
}
|
||||
declare module es {
|
||||
class GlobalManager {
|
||||
_enabled: boolean;
|
||||
@@ -1713,7 +2035,19 @@ declare class RandomUtils {
|
||||
}
|
||||
declare module es {
|
||||
class RectangleExt {
|
||||
static getSide(rect: Rectangle, edge: Edge): number;
|
||||
static union(first: Rectangle, point: Vector2): Rectangle;
|
||||
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;
|
||||
}
|
||||
}
|
||||
declare module es {
|
||||
class SubpixelNumber {
|
||||
remainder: number;
|
||||
update(amount: number): number;
|
||||
reset(): void;
|
||||
}
|
||||
}
|
||||
declare module es {
|
||||
|
||||
@@ -3207,6 +3207,85 @@ var es;
|
||||
es.SpriteAnimator = SpriteAnimator;
|
||||
})(es || (es = {}));
|
||||
var es;
|
||||
(function (es) {
|
||||
var CollisionState = (function () {
|
||||
function CollisionState() {
|
||||
}
|
||||
Object.defineProperty(CollisionState.prototype, "hasCollision", {
|
||||
get: function () {
|
||||
return this.below || this.right || this.left || this.above;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
CollisionState.prototype.reset = function () {
|
||||
this.becameGroundedThisFrame = this.isGroundedOnOnewayPlatform = this.right = this.left = this.above = this.below = false;
|
||||
this.slopAngle = 0;
|
||||
};
|
||||
CollisionState.prototype.toString = function () {
|
||||
return "[CollisionState] r: " + this.right + ", l: " + this.left + ", a: " + this.above + ", b: " + this.below + ", angle: " + this.slopAngle + ", wasGroundedLastFrame: " + this.wasGroundedLastFrame + ", becameGroundedThisFrame: " + this.becameGroundedThisFrame;
|
||||
};
|
||||
return CollisionState;
|
||||
}());
|
||||
es.CollisionState = CollisionState;
|
||||
var TiledMapMover = (function (_super) {
|
||||
__extends(TiledMapMover, _super);
|
||||
function TiledMapMover() {
|
||||
var _this = _super.call(this) || this;
|
||||
_this.colliderHorizontalInset = 2;
|
||||
_this.colliderVerticalInset = 6;
|
||||
return _this;
|
||||
}
|
||||
TiledMapMover.prototype.testCollisions = function (motion, boxColliderBounds, collisionState) {
|
||||
this._boxColliderBounds = boxColliderBounds;
|
||||
collisionState.wasGroundedLastFrame = collisionState.below;
|
||||
collisionState.reset();
|
||||
var motionX = motion.x;
|
||||
var motionY = motion.y;
|
||||
if (motionX != 0) {
|
||||
var direction = motionX > 0 ? es.Edge.right : es.Edge.left;
|
||||
var sweptBounds = this.collisionRectForSide(direction, motionX);
|
||||
var collisionResponse = 0;
|
||||
if (this.testMapCollision(sweptBounds, direction, collisionState, collisionResponse)) {
|
||||
motion.x = collisionResponse - es.RectangleExt.getSide(boxColliderBounds, direction);
|
||||
collisionState.left = direction == es.Edge.left;
|
||||
collisionState.right = direction == es.Edge.right;
|
||||
collisionState._movementRemainderX.reset();
|
||||
}
|
||||
else {
|
||||
collisionState.left = false;
|
||||
collisionState.right = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
TiledMapMover.prototype.testMapCollision = function (collisionRect, direction, collisionState, collisionResponse) {
|
||||
var side = es.EdgeExt.oppositeEdge(direction);
|
||||
var perpindicularPosition = es.EdgeExt.isVertical(side) ? collisionRect.center.x : collisionRect.center.y;
|
||||
var leadingPosition = es.RectangleExt.getSide(collisionRect, direction);
|
||||
var shouldTestSlopes = es.EdgeExt.isVertical(side);
|
||||
};
|
||||
TiledMapMover.prototype.collisionRectForSide = function (side, motion) {
|
||||
var bounds;
|
||||
if (es.EdgeExt.isHorizontal(side)) {
|
||||
bounds = es.RectangleExt.getRectEdgePortion(this._boxColliderBounds, side);
|
||||
}
|
||||
else {
|
||||
bounds = es.RectangleExt.getHalfRect(this._boxColliderBounds, side);
|
||||
}
|
||||
if (es.EdgeExt.isVertical(side)) {
|
||||
es.RectangleExt.contract(bounds, this.colliderHorizontalInset, 0);
|
||||
}
|
||||
else {
|
||||
es.RectangleExt.contract(bounds, 0, this.colliderVerticalInset);
|
||||
}
|
||||
es.RectangleExt.expandSide(bounds, side, motion);
|
||||
return bounds;
|
||||
};
|
||||
return TiledMapMover;
|
||||
}(es.Component));
|
||||
es.TiledMapMover = TiledMapMover;
|
||||
})(es || (es = {}));
|
||||
var es;
|
||||
(function (es) {
|
||||
var Mover = (function (_super) {
|
||||
__extends(Mover, _super);
|
||||
@@ -5631,6 +5710,12 @@ var es;
|
||||
MathHelper.angleBetweenVectors = function (from, to) {
|
||||
return Math.atan2(to.y - from.y, to.x - from.x);
|
||||
};
|
||||
MathHelper.incrementWithWrap = function (t, length) {
|
||||
t++;
|
||||
if (t == length)
|
||||
return 0;
|
||||
return t;
|
||||
};
|
||||
MathHelper.Epsilon = 0.00001;
|
||||
MathHelper.Rad2Deg = 57.29578;
|
||||
MathHelper.Deg2Rad = 0.0174532924;
|
||||
@@ -7259,6 +7344,357 @@ var es;
|
||||
}());
|
||||
es.RaycastResultParser = RaycastResultParser;
|
||||
})(es || (es = {}));
|
||||
var es;
|
||||
(function (es) {
|
||||
var TmxGroup = (function () {
|
||||
function TmxGroup() {
|
||||
}
|
||||
return TmxGroup;
|
||||
}());
|
||||
es.TmxGroup = TmxGroup;
|
||||
})(es || (es = {}));
|
||||
var es;
|
||||
(function (es) {
|
||||
var TmxImageLayer = (function () {
|
||||
function TmxImageLayer() {
|
||||
}
|
||||
return TmxImageLayer;
|
||||
}());
|
||||
es.TmxImageLayer = TmxImageLayer;
|
||||
})(es || (es = {}));
|
||||
var es;
|
||||
(function (es) {
|
||||
var TmxLayer = (function () {
|
||||
function TmxLayer() {
|
||||
}
|
||||
Object.defineProperty(TmxLayer.prototype, "offset", {
|
||||
get: function () {
|
||||
return new es.Vector2(this.offsetX, this.offsetY);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
TmxLayer.prototype.getTileWithGid = function (gid) {
|
||||
for (var i = 0; i < this.tiles.length; i++) {
|
||||
if (this.tiles[i] && this.tiles[i].gid == gid)
|
||||
return this.tiles[i];
|
||||
}
|
||||
return null;
|
||||
};
|
||||
return TmxLayer;
|
||||
}());
|
||||
es.TmxLayer = TmxLayer;
|
||||
var TmxLayerTile = (function () {
|
||||
function TmxLayerTile(map, id, x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
var rawGid = id;
|
||||
var flip;
|
||||
flip = (rawGid & TmxLayerTile.FLIPPED_HORIZONTALLY_FLAG) != 0;
|
||||
this.horizontalFlip = flip;
|
||||
flip = (rawGid & TmxLayerTile.FLIPPED_VERTICALLY_FLAG) != 0;
|
||||
this.verticalFlip = flip;
|
||||
flip = (rawGid & TmxLayerTile.FLIPPED_DIAGONALLY_FLAG) != 0;
|
||||
this.diagonalFlip = flip;
|
||||
rawGid &= ~(TmxLayerTile.FLIPPED_HORIZONTALLY_FLAG | TmxLayerTile.FLIPPED_VERTICALLY_FLAG | TmxLayerTile.FLIPPED_DIAGONALLY_FLAG);
|
||||
this.gid = rawGid;
|
||||
this.tileset = map.getTilesetForTileGid(this.gid);
|
||||
}
|
||||
Object.defineProperty(TmxLayerTile.prototype, "position", {
|
||||
get: function () {
|
||||
return new es.Vector2(this.x, this.y);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(TmxLayerTile.prototype, "tilesetTile", {
|
||||
get: function () {
|
||||
if (this._tilesetTileIndex == undefined) {
|
||||
this._tilesetTileIndex = -1;
|
||||
if (this.tileset.firstGid <= this.gid) {
|
||||
var tilesetTile = this.tileset.tiles.get(this.gid - this.tileset.firstGid);
|
||||
if (tilesetTile) {
|
||||
this._tilesetTileIndex = this.gid - this.tileset.firstGid;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this._tilesetTileIndex < 0)
|
||||
return null;
|
||||
return this.tileset.tiles.get(this._tilesetTileIndex);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
TmxLayerTile.FLIPPED_HORIZONTALLY_FLAG = 0x80000000;
|
||||
TmxLayerTile.FLIPPED_VERTICALLY_FLAG = 0x40000000;
|
||||
TmxLayerTile.FLIPPED_DIAGONALLY_FLAG = 0x20000000;
|
||||
return TmxLayerTile;
|
||||
}());
|
||||
es.TmxLayerTile = TmxLayerTile;
|
||||
})(es || (es = {}));
|
||||
var es;
|
||||
(function (es) {
|
||||
var TmxDocument = (function () {
|
||||
function TmxDocument() {
|
||||
this.TmxDirectory = "";
|
||||
}
|
||||
return TmxDocument;
|
||||
}());
|
||||
es.TmxDocument = TmxDocument;
|
||||
var TmxList = (function (_super) {
|
||||
__extends(TmxList, _super);
|
||||
function TmxList() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this._nameCount = new Map();
|
||||
return _this;
|
||||
}
|
||||
TmxList.prototype.add = function (t) {
|
||||
var tName = t.name;
|
||||
if (this.has(tName))
|
||||
this._nameCount.set(tName, this._nameCount.get(tName) + 1);
|
||||
else
|
||||
this._nameCount.set(tName, 0);
|
||||
};
|
||||
TmxList.prototype.getKeyForItem = function (item) {
|
||||
var name = item.name;
|
||||
var count = this._nameCount.get(name);
|
||||
var dupes = 0;
|
||||
while (this.has(name)) {
|
||||
name = name + es.Enumerable.repeat("_", dupes).toString() + count.toString();
|
||||
dupes++;
|
||||
}
|
||||
return name;
|
||||
};
|
||||
return TmxList;
|
||||
}(Map));
|
||||
es.TmxList = TmxList;
|
||||
var TmxImage = (function () {
|
||||
function TmxImage() {
|
||||
}
|
||||
TmxImage.prototype.dispose = function () {
|
||||
if (this.texture) {
|
||||
this.texture.dispose();
|
||||
this.texture = null;
|
||||
}
|
||||
};
|
||||
return TmxImage;
|
||||
}());
|
||||
es.TmxImage = TmxImage;
|
||||
})(es || (es = {}));
|
||||
var es;
|
||||
(function (es) {
|
||||
var TmxMap = (function (_super) {
|
||||
__extends(TmxMap, _super);
|
||||
function TmxMap() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Object.defineProperty(TmxMap.prototype, "worldWidth", {
|
||||
get: function () {
|
||||
return this.width * this.tileWidth;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(TmxMap.prototype, "worldHeight", {
|
||||
get: function () {
|
||||
return this.height * this.tileHeight;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(TmxMap.prototype, "requiresLargeTileCulling", {
|
||||
get: function () {
|
||||
return this.maxTileHeight > this.tileHeight || this.maxTileWidth > this.tileWidth;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
TmxMap.prototype.getTilesetForTileGid = function (gid) {
|
||||
if (gid == 0)
|
||||
return null;
|
||||
for (var i = this.tilesets.size - 1; i >= 0; i--) {
|
||||
if (this.tilesets.get(i.toString()).firstGid <= gid)
|
||||
return this.tilesets.get(i.toString());
|
||||
}
|
||||
console.error("tile gid" + gid + "\u672A\u5728\u4EFB\u4F55tileset\u4E2D\u627E\u5230");
|
||||
};
|
||||
TmxMap.prototype.update = function () {
|
||||
this.tilesets.forEach(function (tileset) { tileset.update(); });
|
||||
};
|
||||
TmxMap.prototype.dispose = function (disposing) {
|
||||
if (disposing === void 0) { disposing = true; }
|
||||
if (!this._isDisposed) {
|
||||
if (disposing) {
|
||||
this.tilesets.forEach(function (tileset) { if (tileset.image)
|
||||
tileset.image.dispose(); });
|
||||
this.imageLayers.forEach(function (layer) { if (layer.image)
|
||||
layer.image.dispose(); });
|
||||
}
|
||||
this._isDisposed = true;
|
||||
}
|
||||
};
|
||||
return TmxMap;
|
||||
}(es.TmxDocument));
|
||||
es.TmxMap = TmxMap;
|
||||
var OrientationType;
|
||||
(function (OrientationType) {
|
||||
OrientationType[OrientationType["unknown"] = 0] = "unknown";
|
||||
OrientationType[OrientationType["orthogonal"] = 1] = "orthogonal";
|
||||
OrientationType[OrientationType["isometric"] = 2] = "isometric";
|
||||
OrientationType[OrientationType["staggered"] = 3] = "staggered";
|
||||
OrientationType[OrientationType["hexagonal"] = 4] = "hexagonal";
|
||||
})(OrientationType = es.OrientationType || (es.OrientationType = {}));
|
||||
var StaggerAxisType;
|
||||
(function (StaggerAxisType) {
|
||||
StaggerAxisType[StaggerAxisType["x"] = 0] = "x";
|
||||
StaggerAxisType[StaggerAxisType["y"] = 1] = "y";
|
||||
})(StaggerAxisType = es.StaggerAxisType || (es.StaggerAxisType = {}));
|
||||
var StaggerIndexType;
|
||||
(function (StaggerIndexType) {
|
||||
StaggerIndexType[StaggerIndexType["odd"] = 0] = "odd";
|
||||
StaggerIndexType[StaggerIndexType["even"] = 1] = "even";
|
||||
})(StaggerIndexType = es.StaggerIndexType || (es.StaggerIndexType = {}));
|
||||
var RenderOrderType;
|
||||
(function (RenderOrderType) {
|
||||
RenderOrderType[RenderOrderType["rightDown"] = 0] = "rightDown";
|
||||
RenderOrderType[RenderOrderType["rightUp"] = 1] = "rightUp";
|
||||
RenderOrderType[RenderOrderType["leftDown"] = 2] = "leftDown";
|
||||
RenderOrderType[RenderOrderType["leftUp"] = 3] = "leftUp";
|
||||
})(RenderOrderType = es.RenderOrderType || (es.RenderOrderType = {}));
|
||||
})(es || (es = {}));
|
||||
var es;
|
||||
(function (es) {
|
||||
var TmxObjectGroup = (function () {
|
||||
function TmxObjectGroup() {
|
||||
}
|
||||
return TmxObjectGroup;
|
||||
}());
|
||||
es.TmxObjectGroup = TmxObjectGroup;
|
||||
var TmxObject = (function () {
|
||||
function TmxObject() {
|
||||
}
|
||||
return TmxObject;
|
||||
}());
|
||||
es.TmxObject = TmxObject;
|
||||
var TmxText = (function () {
|
||||
function TmxText() {
|
||||
}
|
||||
return TmxText;
|
||||
}());
|
||||
es.TmxText = TmxText;
|
||||
var TmxAlignment = (function () {
|
||||
function TmxAlignment() {
|
||||
}
|
||||
return TmxAlignment;
|
||||
}());
|
||||
es.TmxAlignment = TmxAlignment;
|
||||
var TmxObjectType;
|
||||
(function (TmxObjectType) {
|
||||
TmxObjectType[TmxObjectType["basic"] = 0] = "basic";
|
||||
TmxObjectType[TmxObjectType["point"] = 1] = "point";
|
||||
TmxObjectType[TmxObjectType["tile"] = 2] = "tile";
|
||||
TmxObjectType[TmxObjectType["ellipse"] = 3] = "ellipse";
|
||||
TmxObjectType[TmxObjectType["polygon"] = 4] = "polygon";
|
||||
TmxObjectType[TmxObjectType["polyline"] = 5] = "polyline";
|
||||
TmxObjectType[TmxObjectType["text"] = 6] = "text";
|
||||
})(TmxObjectType = es.TmxObjectType || (es.TmxObjectType = {}));
|
||||
var DrawOrderType;
|
||||
(function (DrawOrderType) {
|
||||
DrawOrderType[DrawOrderType["unkownOrder"] = -1] = "unkownOrder";
|
||||
DrawOrderType[DrawOrderType["TopDown"] = 0] = "TopDown";
|
||||
DrawOrderType[DrawOrderType["IndexOrder"] = 1] = "IndexOrder";
|
||||
})(DrawOrderType = es.DrawOrderType || (es.DrawOrderType = {}));
|
||||
var TmxHorizontalAlignment;
|
||||
(function (TmxHorizontalAlignment) {
|
||||
TmxHorizontalAlignment[TmxHorizontalAlignment["left"] = 0] = "left";
|
||||
TmxHorizontalAlignment[TmxHorizontalAlignment["center"] = 1] = "center";
|
||||
TmxHorizontalAlignment[TmxHorizontalAlignment["right"] = 2] = "right";
|
||||
TmxHorizontalAlignment[TmxHorizontalAlignment["justify"] = 3] = "justify";
|
||||
})(TmxHorizontalAlignment = es.TmxHorizontalAlignment || (es.TmxHorizontalAlignment = {}));
|
||||
var TmxVerticalAlignment;
|
||||
(function (TmxVerticalAlignment) {
|
||||
TmxVerticalAlignment[TmxVerticalAlignment["top"] = 0] = "top";
|
||||
TmxVerticalAlignment[TmxVerticalAlignment["center"] = 1] = "center";
|
||||
TmxVerticalAlignment[TmxVerticalAlignment["bottom"] = 2] = "bottom";
|
||||
})(TmxVerticalAlignment = es.TmxVerticalAlignment || (es.TmxVerticalAlignment = {}));
|
||||
})(es || (es = {}));
|
||||
var es;
|
||||
(function (es) {
|
||||
var TmxTileset = (function (_super) {
|
||||
__extends(TmxTileset, _super);
|
||||
function TmxTileset() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
TmxTileset.prototype.update = function () {
|
||||
this.tiles.forEach(function (value) {
|
||||
value.updateAnimatedTiles();
|
||||
});
|
||||
};
|
||||
return TmxTileset;
|
||||
}(es.TmxDocument));
|
||||
es.TmxTileset = TmxTileset;
|
||||
var TmxTileOffset = (function () {
|
||||
function TmxTileOffset() {
|
||||
}
|
||||
return TmxTileOffset;
|
||||
}());
|
||||
es.TmxTileOffset = TmxTileOffset;
|
||||
var TmxTerrain = (function () {
|
||||
function TmxTerrain() {
|
||||
}
|
||||
return TmxTerrain;
|
||||
}());
|
||||
es.TmxTerrain = TmxTerrain;
|
||||
})(es || (es = {}));
|
||||
var es;
|
||||
(function (es) {
|
||||
var TmxTilesetTile = (function () {
|
||||
function TmxTilesetTile() {
|
||||
}
|
||||
Object.defineProperty(TmxTilesetTile.prototype, "currentAnimationFrameGid", {
|
||||
get: function () {
|
||||
return this.animationFrames[this._animationCurrentFrame].gid + this.tileset.firstGid;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
TmxTilesetTile.prototype.processProperties = function () {
|
||||
var value;
|
||||
value = this.properties.get("engine.isDestructable");
|
||||
if (value)
|
||||
this.isDestructable = Boolean(value);
|
||||
value = this.properties.get("engine:isSlope");
|
||||
if (value)
|
||||
this.isSlope = Boolean(value);
|
||||
value = this.properties.get("engine:isOneWayPlatform");
|
||||
if (value)
|
||||
this.isOneWayPlatform = Boolean(value);
|
||||
value = this.properties.get("engine:slopeTopLeft");
|
||||
if (value)
|
||||
this.slopeTopLeft = Number(value);
|
||||
value = this.properties.get("engine:slopeTopRight");
|
||||
if (value)
|
||||
this.slopeTopRight = Number(value);
|
||||
};
|
||||
TmxTilesetTile.prototype.updateAnimatedTiles = function () {
|
||||
if (this.animationFrames.length == 0)
|
||||
return;
|
||||
this._animationElapsedTime += es.Time.deltaTime;
|
||||
if (this._animationElapsedTime > this.animationFrames[this._animationCurrentFrame].duration) {
|
||||
this._animationCurrentFrame = es.MathHelper.incrementWithWrap(this._animationCurrentFrame, this.animationFrames.length);
|
||||
this._animationElapsedTime = 0;
|
||||
}
|
||||
};
|
||||
return TmxTilesetTile;
|
||||
}());
|
||||
es.TmxTilesetTile = TmxTilesetTile;
|
||||
var TmxAnimationFrame = (function () {
|
||||
function TmxAnimationFrame() {
|
||||
}
|
||||
return TmxAnimationFrame;
|
||||
}());
|
||||
es.TmxAnimationFrame = TmxAnimationFrame;
|
||||
})(es || (es = {}));
|
||||
var ArrayUtils = (function () {
|
||||
function ArrayUtils() {
|
||||
}
|
||||
@@ -7654,6 +8090,33 @@ var es;
|
||||
es.DrawUtils = DrawUtils;
|
||||
})(es || (es = {}));
|
||||
var es;
|
||||
(function (es) {
|
||||
var EdgeExt = (function () {
|
||||
function EdgeExt() {
|
||||
}
|
||||
EdgeExt.oppositeEdge = function (self) {
|
||||
switch (self) {
|
||||
case es.Edge.bottom:
|
||||
return es.Edge.top;
|
||||
case es.Edge.top:
|
||||
return es.Edge.bottom;
|
||||
case es.Edge.left:
|
||||
return es.Edge.right;
|
||||
case es.Edge.right:
|
||||
return es.Edge.left;
|
||||
}
|
||||
};
|
||||
EdgeExt.isHorizontal = function (self) {
|
||||
return self == es.Edge.right || self == es.Edge.left;
|
||||
};
|
||||
EdgeExt.isVertical = function (self) {
|
||||
return self == es.Edge.top || self == es.Edge.bottom;
|
||||
};
|
||||
return EdgeExt;
|
||||
}());
|
||||
es.EdgeExt = EdgeExt;
|
||||
})(es || (es = {}));
|
||||
var es;
|
||||
(function (es) {
|
||||
var FuncPack = (function () {
|
||||
function FuncPack(func, context) {
|
||||
@@ -7695,6 +8158,32 @@ var es;
|
||||
es.Emitter = Emitter;
|
||||
})(es || (es = {}));
|
||||
var es;
|
||||
(function (es) {
|
||||
var Edge;
|
||||
(function (Edge) {
|
||||
Edge[Edge["top"] = 0] = "top";
|
||||
Edge[Edge["bottom"] = 1] = "bottom";
|
||||
Edge[Edge["left"] = 2] = "left";
|
||||
Edge[Edge["right"] = 3] = "right";
|
||||
})(Edge = es.Edge || (es.Edge = {}));
|
||||
})(es || (es = {}));
|
||||
var es;
|
||||
(function (es) {
|
||||
var Enumerable = (function () {
|
||||
function Enumerable() {
|
||||
}
|
||||
Enumerable.repeat = function (element, count) {
|
||||
var result = [];
|
||||
while (count--) {
|
||||
result.push(element);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
return Enumerable;
|
||||
}());
|
||||
es.Enumerable = Enumerable;
|
||||
})(es || (es = {}));
|
||||
var es;
|
||||
(function (es) {
|
||||
var GlobalManager = (function () {
|
||||
function GlobalManager() {
|
||||
@@ -8252,6 +8741,18 @@ var es;
|
||||
var RectangleExt = (function () {
|
||||
function RectangleExt() {
|
||||
}
|
||||
RectangleExt.getSide = function (rect, edge) {
|
||||
switch (edge) {
|
||||
case es.Edge.top:
|
||||
return rect.top;
|
||||
case es.Edge.bottom:
|
||||
return rect.bottom;
|
||||
case es.Edge.left:
|
||||
return rect.left;
|
||||
case es.Edge.right:
|
||||
return rect.right;
|
||||
}
|
||||
};
|
||||
RectangleExt.union = function (first, point) {
|
||||
var rect = new es.Rectangle(point.x, point.y, 0, 0);
|
||||
var result = new es.Rectangle();
|
||||
@@ -8261,11 +8762,79 @@ var es;
|
||||
result.height = Math.max(first.bottom, result.bottom) - result.y;
|
||||
return result;
|
||||
};
|
||||
RectangleExt.getHalfRect = function (rect, edge) {
|
||||
switch (edge) {
|
||||
case es.Edge.top:
|
||||
return new es.Rectangle(rect.x, rect.y, rect.width, rect.height / 2);
|
||||
case es.Edge.bottom:
|
||||
return new es.Rectangle(rect.x, rect.y + rect.height / 2, rect.width, rect.height / 2);
|
||||
case es.Edge.left:
|
||||
return new es.Rectangle(rect.x, rect.y, rect.width / 2, rect.height);
|
||||
case es.Edge.right:
|
||||
return new es.Rectangle(rect.x + rect.width / 2, rect.y, rect.width / 2, rect.height);
|
||||
}
|
||||
};
|
||||
RectangleExt.getRectEdgePortion = function (rect, edge, size) {
|
||||
if (size === void 0) { size = 1; }
|
||||
switch (edge) {
|
||||
case es.Edge.top:
|
||||
return new es.Rectangle(rect.x, rect.y, rect.width, size);
|
||||
case es.Edge.bottom:
|
||||
return new es.Rectangle(rect.x, rect.y + rect.height - size, rect.width, size);
|
||||
case es.Edge.left:
|
||||
return new es.Rectangle(rect.x, rect.y, size, rect.height);
|
||||
case es.Edge.right:
|
||||
return new es.Rectangle(rect.x + rect.width - size, rect.y, size, rect.height);
|
||||
}
|
||||
};
|
||||
RectangleExt.expandSide = function (rect, edge, amount) {
|
||||
amount = Math.abs(amount);
|
||||
switch (edge) {
|
||||
case es.Edge.top:
|
||||
rect.y -= amount;
|
||||
rect.height += amount;
|
||||
break;
|
||||
case es.Edge.bottom:
|
||||
rect.height += amount;
|
||||
break;
|
||||
case es.Edge.left:
|
||||
rect.x -= amount;
|
||||
rect.width += amount;
|
||||
break;
|
||||
case es.Edge.right:
|
||||
rect.width += amount;
|
||||
break;
|
||||
}
|
||||
};
|
||||
RectangleExt.contract = function (rect, horizontalAmount, verticalAmount) {
|
||||
rect.x += horizontalAmount;
|
||||
rect.y += verticalAmount;
|
||||
rect.width -= horizontalAmount * 2;
|
||||
rect.height -= verticalAmount * 2;
|
||||
};
|
||||
return RectangleExt;
|
||||
}());
|
||||
es.RectangleExt = RectangleExt;
|
||||
})(es || (es = {}));
|
||||
var es;
|
||||
(function (es) {
|
||||
var SubpixelNumber = (function () {
|
||||
function SubpixelNumber() {
|
||||
}
|
||||
SubpixelNumber.prototype.update = function (amount) {
|
||||
this.remainder += amount;
|
||||
var motion = Math.trunc(this.remainder);
|
||||
this.remainder -= motion;
|
||||
return motion;
|
||||
};
|
||||
SubpixelNumber.prototype.reset = function () {
|
||||
this.remainder = 0;
|
||||
};
|
||||
return SubpixelNumber;
|
||||
}());
|
||||
es.SubpixelNumber = SubpixelNumber;
|
||||
})(es || (es = {}));
|
||||
var es;
|
||||
(function (es) {
|
||||
var Triangulator = (function () {
|
||||
function Triangulator() {
|
||||
|
||||
2
source/bin/framework.min.js
vendored
2
source/bin/framework.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user