修复tiledmap tmxDirectory不正确问题

This commit is contained in:
yhh
2020-08-25 16:19:56 +08:00
parent 0bb09f6442
commit 794e33a0a0
13 changed files with 77 additions and 46 deletions
+1 -1
View File
@@ -1836,7 +1836,7 @@ declare module es {
declare module es { declare module es {
class TiledMapLoader { class TiledMapLoader {
static loadTmxMap(map: TmxMap, filePath: string): Promise<TmxMap>; static loadTmxMap(map: TmxMap, filePath: string): Promise<TmxMap>;
static loadTmxMapData(map: TmxMap, xMap: any): Promise<TmxMap>; static loadTmxMapData(map: TmxMap, xMap: any, info: any): Promise<TmxMap>;
static parseLayers(container: any, xEle: any, map: TmxMap, width: number, height: number, tmxDirectory: string): Promise<void>; 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 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>; static loadTmxImageLayer(layer: TmxImageLayer, map: TmxMap, xImageLayer: any, tmxDirectory: string): Promise<TmxImageLayer>;
+24 -13
View File
@@ -2769,7 +2769,7 @@ var es;
RenderableComponent.prototype.isVisibleFromCamera = function (camera) { RenderableComponent.prototype.isVisibleFromCamera = function (camera) {
if (!camera) if (!camera)
return false; return false;
this.isVisible = camera.bounds.intersects(this.displayObject.getBounds().union(this.bounds)); this.isVisible = camera.bounds.intersects(this.bounds);
return this.isVisible; return this.isVisible;
}; };
RenderableComponent.prototype.setRenderLayer = function (renderLayer) { RenderableComponent.prototype.setRenderLayer = function (renderLayer) {
@@ -2950,11 +2950,10 @@ var es;
}; };
SpriteRenderer.prototype.render = function (camera) { SpriteRenderer.prototype.render = function (camera) {
this.sync(camera); this.sync(camera);
var afterPos = new es.Vector2(this.entity.position.x + this.localOffset.x - camera.position.x + camera.origin.x, this.entity.position.y + this.localOffset.y - camera.position.y + camera.origin.y); if (this.displayObject.x != this.bounds.x)
if (this.displayObject.x != afterPos.x) this.displayObject.x = this.bounds.x;
this.displayObject.x = afterPos.x; if (this.displayObject.y != this.bounds.y)
if (this.displayObject.y != afterPos.y) this.displayObject.y = this.bounds.y;
this.displayObject.y = afterPos.y;
}; };
return SpriteRenderer; return SpriteRenderer;
}(es.RenderableComponent)); }(es.RenderableComponent));
@@ -3845,20 +3844,26 @@ var es;
if (poly.points.length >= 2) { if (poly.points.length >= 2) {
this.polygonShape.graphics.beginFill(es.Colors.colliderEdge, 0); this.polygonShape.graphics.beginFill(es.Colors.colliderEdge, 0);
this.polygonShape.graphics.lineStyle(es.Size.lineSizeMultiplier, es.Colors.colliderEdge); this.polygonShape.graphics.lineStyle(es.Size.lineSizeMultiplier, es.Colors.colliderEdge);
for (var i = 1; i < poly.points.length; i++) for (var i = 1; i < poly.points.length; i++) {
this.polygonShape.graphics.lineTo(poly.position.x + poly.points[i].x, poly.position.y + poly.points[i].y); if (i == 1) {
this.polygonShape.graphics.moveTo(poly.position.x + poly.points[i].x, poly.position.y + poly.points[i].y);
}
else {
this.polygonShape.graphics.lineTo(poly.position.x + poly.points[i].x, poly.position.y + poly.points[i].y);
}
}
this.polygonShape.graphics.lineTo(poly.position.x + poly.points[poly.points.length - 1].x, poly.position.y + poly.points[0].y); this.polygonShape.graphics.lineTo(poly.position.x + poly.points[poly.points.length - 1].x, poly.position.y + poly.points[0].y);
this.polygonShape.graphics.endFill(); this.polygonShape.graphics.endFill();
} }
this.pixelShape1.graphics.clear(); this.pixelShape1.graphics.clear();
this.pixelShape1.graphics.beginFill(es.Colors.colliderPosition, 0); this.pixelShape1.graphics.beginFill(es.Colors.colliderPosition, 0);
this.pixelShape1.graphics.lineStyle(4 * es.Size.lineSizeMultiplier, es.Colors.colliderPosition); this.pixelShape1.graphics.lineStyle(4 * es.Size.lineSizeMultiplier, es.Colors.colliderPosition);
this.pixelShape1.graphics.lineTo(this.entity.transform.position.x, this.entity.transform.position.y); this.pixelShape1.graphics.moveTo(this.entity.transform.position.x, this.entity.transform.position.y);
this.pixelShape1.graphics.endFill(); this.pixelShape1.graphics.endFill();
this.pixelShape2.graphics.clear(); this.pixelShape2.graphics.clear();
this.pixelShape2.graphics.beginFill(es.Colors.colliderCenter, 0); this.pixelShape2.graphics.beginFill(es.Colors.colliderCenter, 0);
this.pixelShape2.graphics.lineStyle(2 * es.Size.lineSizeMultiplier, es.Colors.colliderCenter); this.pixelShape2.graphics.lineStyle(2 * es.Size.lineSizeMultiplier, es.Colors.colliderCenter);
this.pixelShape2.graphics.lineTo(this.entity.transform.position.x + this.shape.center.x, this.entity.transform.position.y + this.shape.center.y); this.pixelShape2.graphics.moveTo(this.entity.transform.position.x + this.shape.center.x, this.entity.transform.position.y + this.shape.center.y);
this.pixelShape2.graphics.endFill(); this.pixelShape2.graphics.endFill();
}; };
BoxCollider.prototype.toString = function () { BoxCollider.prototype.toString = function () {
@@ -8148,9 +8153,9 @@ var es;
} }
TiledMapLoader.loadTmxMap = function (map, filePath) { TiledMapLoader.loadTmxMap = function (map, filePath) {
var xMap = RES.getRes(filePath); var xMap = RES.getRes(filePath);
return this.loadTmxMapData(map, xMap); return this.loadTmxMapData(map, xMap, RES.getResourceInfo(filePath));
}; };
TiledMapLoader.loadTmxMapData = function (map, xMap) { TiledMapLoader.loadTmxMapData = function (map, xMap, info) {
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var _i, _a, e, tileset; var _i, _a, e, tileset;
return __generator(this, function (_b) { return __generator(this, function (_b) {
@@ -8172,6 +8177,7 @@ var es;
map.properties = this.parsePropertyDict(xMap["properties"]); map.properties = this.parsePropertyDict(xMap["properties"]);
map.maxTileWidth = map.tileWidth; map.maxTileWidth = map.tileWidth;
map.maxTileHeight = map.tileHeight; map.maxTileHeight = map.tileHeight;
map.tmxDirectory = info.root + info.url.replace(".", "_").replace(info.name, "");
map.tilesets = []; map.tilesets = [];
_i = 0, _a = xMap["tilesets"]; _i = 0, _a = xMap["tilesets"];
_b.label = 1; _b.label = 1;
@@ -8918,7 +8924,12 @@ var es;
obj.shape.graphics.clear(); obj.shape.graphics.clear();
obj.shape.graphics.lineStyle(1, 0xa0a0a4); obj.shape.graphics.lineStyle(1, 0xa0a0a4);
for (var i = 0; i < points.length; i++) { for (var i = 0; i < points.length; i++) {
obj.shape.graphics.lineTo(points[i].x, points[i].y); if (i == 0) {
obj.shape.graphics.moveTo(points[i].x, points[i].y);
}
else {
obj.shape.graphics.lineTo(points[i].x, points[i].y);
}
} }
obj.shape.graphics.endFill(); obj.shape.graphics.endFill();
debugRender(obj, pos); debugRender(obj, pos);
File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

+4 -4
View File
@@ -58,19 +58,19 @@ module samples {
this._pixelShape1.graphics.clear(); this._pixelShape1.graphics.clear();
this._pixelShape1.graphics.beginFill(0xffff00); this._pixelShape1.graphics.beginFill(0xffff00);
this._pixelShape1.graphics.lineStyle(4, 0xffff00); this._pixelShape1.graphics.lineStyle(4, 0xffff00);
this._pixelShape1.graphics.lineTo(this._lastPosition.x, this._lastPosition.y); this._pixelShape1.graphics.moveTo(this._lastPosition.x, this._lastPosition.y);
this._pixelShape1.graphics.endFill(); this._pixelShape1.graphics.endFill();
this._pixelShape2.graphics.clear(); this._pixelShape2.graphics.clear();
this._pixelShape2.graphics.beginFill(0xffffff); this._pixelShape2.graphics.beginFill(0xffffff);
this._pixelShape2.graphics.lineStyle(4, 0xffffff); this._pixelShape2.graphics.lineStyle(4, 0xffffff);
this._pixelShape2.graphics.lineTo(this.transform.position.x, this.transform.position.y); this._pixelShape2.graphics.moveTo(this.transform.position.x, this.transform.position.y);
this._pixelShape2.graphics.endFill(); this._pixelShape2.graphics.endFill();
this._lineShape.graphics.clear(); this._lineShape.graphics.clear();
this._lineShape.graphics.beginFill(0xffffff); this._lineShape.graphics.beginFill(0xffffff);
this._lineShape.graphics.lineStyle(1, 0xffffff); this._lineShape.graphics.lineStyle(1, 0xffffff);
this._lineShape.graphics.lineTo(this._lastPosition.x, this._lastPosition.y); this._lineShape.graphics.moveTo(this._lastPosition.x, this._lastPosition.y);
this._lineShape.graphics.lineTo(this.transform.position.x, this.transform.position.y); this._lineShape.graphics.lineTo(this.transform.position.x, this.transform.position.y);
this._lineShape.graphics.endFill(); this._lineShape.graphics.endFill();
@@ -78,7 +78,7 @@ module samples {
if (this._collisionPosition.x > 0 && this._collisionPosition.y > 0){ if (this._collisionPosition.x > 0 && this._collisionPosition.y > 0){
this._pixelShape3.graphics.beginFill(0xff0000); this._pixelShape3.graphics.beginFill(0xff0000);
this._pixelShape3.graphics.lineStyle(10, 0xff0000); this._pixelShape3.graphics.lineStyle(10, 0xff0000);
this._pixelShape3.graphics.lineTo(this._collisionPosition.x, this._collisionPosition.y); this._pixelShape3.graphics.moveTo(this._collisionPosition.x, this._collisionPosition.y);
this._pixelShape3.graphics.endFill(); this._pixelShape3.graphics.endFill();
} }
} }
+1 -1
View File
@@ -1836,7 +1836,7 @@ declare module es {
declare module es { declare module es {
class TiledMapLoader { class TiledMapLoader {
static loadTmxMap(map: TmxMap, filePath: string): Promise<TmxMap>; static loadTmxMap(map: TmxMap, filePath: string): Promise<TmxMap>;
static loadTmxMapData(map: TmxMap, xMap: any): Promise<TmxMap>; static loadTmxMapData(map: TmxMap, xMap: any, info: any): Promise<TmxMap>;
static parseLayers(container: any, xEle: any, map: TmxMap, width: number, height: number, tmxDirectory: string): Promise<void>; 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 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>; static loadTmxImageLayer(layer: TmxImageLayer, map: TmxMap, xImageLayer: any, tmxDirectory: string): Promise<TmxImageLayer>;
+24 -13
View File
@@ -2769,7 +2769,7 @@ var es;
RenderableComponent.prototype.isVisibleFromCamera = function (camera) { RenderableComponent.prototype.isVisibleFromCamera = function (camera) {
if (!camera) if (!camera)
return false; return false;
this.isVisible = camera.bounds.intersects(this.displayObject.getBounds().union(this.bounds)); this.isVisible = camera.bounds.intersects(this.bounds);
return this.isVisible; return this.isVisible;
}; };
RenderableComponent.prototype.setRenderLayer = function (renderLayer) { RenderableComponent.prototype.setRenderLayer = function (renderLayer) {
@@ -2950,11 +2950,10 @@ var es;
}; };
SpriteRenderer.prototype.render = function (camera) { SpriteRenderer.prototype.render = function (camera) {
this.sync(camera); this.sync(camera);
var afterPos = new es.Vector2(this.entity.position.x + this.localOffset.x - camera.position.x + camera.origin.x, this.entity.position.y + this.localOffset.y - camera.position.y + camera.origin.y); if (this.displayObject.x != this.bounds.x)
if (this.displayObject.x != afterPos.x) this.displayObject.x = this.bounds.x;
this.displayObject.x = afterPos.x; if (this.displayObject.y != this.bounds.y)
if (this.displayObject.y != afterPos.y) this.displayObject.y = this.bounds.y;
this.displayObject.y = afterPos.y;
}; };
return SpriteRenderer; return SpriteRenderer;
}(es.RenderableComponent)); }(es.RenderableComponent));
@@ -3845,20 +3844,26 @@ var es;
if (poly.points.length >= 2) { if (poly.points.length >= 2) {
this.polygonShape.graphics.beginFill(es.Colors.colliderEdge, 0); this.polygonShape.graphics.beginFill(es.Colors.colliderEdge, 0);
this.polygonShape.graphics.lineStyle(es.Size.lineSizeMultiplier, es.Colors.colliderEdge); this.polygonShape.graphics.lineStyle(es.Size.lineSizeMultiplier, es.Colors.colliderEdge);
for (var i = 1; i < poly.points.length; i++) for (var i = 1; i < poly.points.length; i++) {
this.polygonShape.graphics.lineTo(poly.position.x + poly.points[i].x, poly.position.y + poly.points[i].y); if (i == 1) {
this.polygonShape.graphics.moveTo(poly.position.x + poly.points[i].x, poly.position.y + poly.points[i].y);
}
else {
this.polygonShape.graphics.lineTo(poly.position.x + poly.points[i].x, poly.position.y + poly.points[i].y);
}
}
this.polygonShape.graphics.lineTo(poly.position.x + poly.points[poly.points.length - 1].x, poly.position.y + poly.points[0].y); this.polygonShape.graphics.lineTo(poly.position.x + poly.points[poly.points.length - 1].x, poly.position.y + poly.points[0].y);
this.polygonShape.graphics.endFill(); this.polygonShape.graphics.endFill();
} }
this.pixelShape1.graphics.clear(); this.pixelShape1.graphics.clear();
this.pixelShape1.graphics.beginFill(es.Colors.colliderPosition, 0); this.pixelShape1.graphics.beginFill(es.Colors.colliderPosition, 0);
this.pixelShape1.graphics.lineStyle(4 * es.Size.lineSizeMultiplier, es.Colors.colliderPosition); this.pixelShape1.graphics.lineStyle(4 * es.Size.lineSizeMultiplier, es.Colors.colliderPosition);
this.pixelShape1.graphics.lineTo(this.entity.transform.position.x, this.entity.transform.position.y); this.pixelShape1.graphics.moveTo(this.entity.transform.position.x, this.entity.transform.position.y);
this.pixelShape1.graphics.endFill(); this.pixelShape1.graphics.endFill();
this.pixelShape2.graphics.clear(); this.pixelShape2.graphics.clear();
this.pixelShape2.graphics.beginFill(es.Colors.colliderCenter, 0); this.pixelShape2.graphics.beginFill(es.Colors.colliderCenter, 0);
this.pixelShape2.graphics.lineStyle(2 * es.Size.lineSizeMultiplier, es.Colors.colliderCenter); this.pixelShape2.graphics.lineStyle(2 * es.Size.lineSizeMultiplier, es.Colors.colliderCenter);
this.pixelShape2.graphics.lineTo(this.entity.transform.position.x + this.shape.center.x, this.entity.transform.position.y + this.shape.center.y); this.pixelShape2.graphics.moveTo(this.entity.transform.position.x + this.shape.center.x, this.entity.transform.position.y + this.shape.center.y);
this.pixelShape2.graphics.endFill(); this.pixelShape2.graphics.endFill();
}; };
BoxCollider.prototype.toString = function () { BoxCollider.prototype.toString = function () {
@@ -8148,9 +8153,9 @@ var es;
} }
TiledMapLoader.loadTmxMap = function (map, filePath) { TiledMapLoader.loadTmxMap = function (map, filePath) {
var xMap = RES.getRes(filePath); var xMap = RES.getRes(filePath);
return this.loadTmxMapData(map, xMap); return this.loadTmxMapData(map, xMap, RES.getResourceInfo(filePath));
}; };
TiledMapLoader.loadTmxMapData = function (map, xMap) { TiledMapLoader.loadTmxMapData = function (map, xMap, info) {
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var _i, _a, e, tileset; var _i, _a, e, tileset;
return __generator(this, function (_b) { return __generator(this, function (_b) {
@@ -8172,6 +8177,7 @@ var es;
map.properties = this.parsePropertyDict(xMap["properties"]); map.properties = this.parsePropertyDict(xMap["properties"]);
map.maxTileWidth = map.tileWidth; map.maxTileWidth = map.tileWidth;
map.maxTileHeight = map.tileHeight; map.maxTileHeight = map.tileHeight;
map.tmxDirectory = info.root + info.url.replace(".", "_").replace(info.name, "");
map.tilesets = []; map.tilesets = [];
_i = 0, _a = xMap["tilesets"]; _i = 0, _a = xMap["tilesets"];
_b.label = 1; _b.label = 1;
@@ -8918,7 +8924,12 @@ var es;
obj.shape.graphics.clear(); obj.shape.graphics.clear();
obj.shape.graphics.lineStyle(1, 0xa0a0a4); obj.shape.graphics.lineStyle(1, 0xa0a0a4);
for (var i = 0; i < points.length; i++) { for (var i = 0; i < points.length; i++) {
obj.shape.graphics.lineTo(points[i].x, points[i].y); if (i == 0) {
obj.shape.graphics.moveTo(points[i].x, points[i].y);
}
else {
obj.shape.graphics.lineTo(points[i].x, points[i].y);
}
} }
obj.shape.graphics.endFill(); obj.shape.graphics.endFill();
debugRender(obj, pos); debugRender(obj, pos);
+1 -1
View File
File diff suppressed because one or more lines are too long
@@ -120,8 +120,14 @@ module es {
if (poly.points.length >= 2){ if (poly.points.length >= 2){
this.polygonShape.graphics.beginFill(Colors.colliderEdge, 0); this.polygonShape.graphics.beginFill(Colors.colliderEdge, 0);
this.polygonShape.graphics.lineStyle(Size.lineSizeMultiplier, Colors.colliderEdge); this.polygonShape.graphics.lineStyle(Size.lineSizeMultiplier, Colors.colliderEdge);
for (let i = 1; i < poly.points.length; i ++) for (let i = 1; i < poly.points.length; i ++){
this.polygonShape.graphics.lineTo(poly.position.x + poly.points[i].x, poly.position.y + poly.points[i].y); if (i == 1){
this.polygonShape.graphics.moveTo(poly.position.x + poly.points[i].x, poly.position.y + poly.points[i].y);
}else{
this.polygonShape.graphics.lineTo(poly.position.x + poly.points[i].x, poly.position.y + poly.points[i].y);
}
}
this.polygonShape.graphics.lineTo(poly.position.x + poly.points[poly.points.length - 1].x, poly.position.y + poly.points[0].y); this.polygonShape.graphics.lineTo(poly.position.x + poly.points[poly.points.length - 1].x, poly.position.y + poly.points[0].y);
this.polygonShape.graphics.endFill(); this.polygonShape.graphics.endFill();
} }
@@ -129,13 +135,13 @@ module es {
this.pixelShape1.graphics.clear(); this.pixelShape1.graphics.clear();
this.pixelShape1.graphics.beginFill(Colors.colliderPosition, 0); this.pixelShape1.graphics.beginFill(Colors.colliderPosition, 0);
this.pixelShape1.graphics.lineStyle(4 * Size.lineSizeMultiplier, Colors.colliderPosition); this.pixelShape1.graphics.lineStyle(4 * Size.lineSizeMultiplier, Colors.colliderPosition);
this.pixelShape1.graphics.lineTo(this.entity.transform.position.x, this.entity.transform.position.y); this.pixelShape1.graphics.moveTo(this.entity.transform.position.x, this.entity.transform.position.y);
this.pixelShape1.graphics.endFill(); this.pixelShape1.graphics.endFill();
this.pixelShape2.graphics.clear(); this.pixelShape2.graphics.clear();
this.pixelShape2.graphics.beginFill(Colors.colliderCenter, 0); this.pixelShape2.graphics.beginFill(Colors.colliderCenter, 0);
this.pixelShape2.graphics.lineStyle(2 * Size.lineSizeMultiplier, Colors.colliderCenter); this.pixelShape2.graphics.lineStyle(2 * Size.lineSizeMultiplier, Colors.colliderCenter);
this.pixelShape2.graphics.lineTo(this.entity.transform.position.x + this.shape.center.x, this.pixelShape2.graphics.moveTo(this.entity.transform.position.x + this.shape.center.x,
this.entity.transform.position.y + this.shape.center.y); this.entity.transform.position.y + this.shape.center.y);
this.pixelShape2.graphics.endFill(); this.pixelShape2.graphics.endFill();
} }
@@ -148,7 +148,7 @@ module es {
if (!camera) if (!camera)
return false; return false;
this.isVisible = camera.bounds.intersects(this.displayObject.getBounds().union(this.bounds)); this.isVisible = camera.bounds.intersects(this.bounds);
return this.isVisible; return this.isVisible;
} }
+2 -4
View File
@@ -123,10 +123,8 @@ module es {
public render(camera: Camera) { public render(camera: Camera) {
this.sync(camera); this.sync(camera);
let afterPos = new Vector2(this.entity.position.x + this.localOffset.x - camera.position.x + camera.origin.x, if (this.displayObject.x != this.bounds.x) this.displayObject.x = this.bounds.x;
this.entity.position.y + this.localOffset.y - camera.position.y + camera.origin.y); if (this.displayObject.y != this.bounds.y) this.displayObject.y = this.bounds.y;
if (this.displayObject.x != afterPos.x) this.displayObject.x = afterPos.x;
if (this.displayObject.y != afterPos.y) this.displayObject.y = afterPos.y;
} }
} }
} }
+3 -2
View File
@@ -4,10 +4,10 @@ module es {
export class TiledMapLoader { export class TiledMapLoader {
public static loadTmxMap(map: TmxMap, filePath: string) { public static loadTmxMap(map: TmxMap, filePath: string) {
let xMap = RES.getRes(filePath); let xMap = RES.getRes(filePath);
return this.loadTmxMapData(map, xMap); return this.loadTmxMapData(map, xMap, RES.getResourceInfo(filePath));
} }
public static async loadTmxMapData(map: TmxMap, xMap: any) { public static async loadTmxMapData(map: TmxMap, xMap: any, info: any) {
map.version = xMap["version"]; map.version = xMap["version"];
map.tiledVersion = xMap["tiledversion"]; map.tiledVersion = xMap["tiledversion"];
map.width = xMap["width"]; map.width = xMap["width"];
@@ -29,6 +29,7 @@ module es {
// 我们保持记录的最大瓷砖大小的情况下,图像tileset随机大小 // 我们保持记录的最大瓷砖大小的情况下,图像tileset随机大小
map.maxTileWidth = map.tileWidth; map.maxTileWidth = map.tileWidth;
map.maxTileHeight = map.tileHeight; map.maxTileHeight = map.tileHeight;
map.tmxDirectory = info.root + info.url.replace(".", "_").replace(info.name, "");
map.tilesets = []; map.tilesets = [];
for (let e of xMap["tilesets"]) { for (let e of xMap["tilesets"]) {
+5 -1
View File
@@ -202,7 +202,11 @@ module es {
obj.shape.graphics.clear(); obj.shape.graphics.clear();
obj.shape.graphics.lineStyle(1, 0xa0a0a4); obj.shape.graphics.lineStyle(1, 0xa0a0a4);
for (let i = 0; i < points.length; i ++){ for (let i = 0; i < points.length; i ++){
obj.shape.graphics.lineTo(points[i].x, points[i].y); if (i == 0){
obj.shape.graphics.moveTo(points[i].x, points[i].y);
}else{
obj.shape.graphics.lineTo(points[i].x, points[i].y);
}
} }
obj.shape.graphics.endFill(); obj.shape.graphics.endFill();
debugRender(obj, pos); debugRender(obj, pos);