tiled 防止中断合批

This commit is contained in:
YHH
2020-08-15 22:29:45 +08:00
parent b3961d8ea1
commit f7ee2c8d1c
5 changed files with 104 additions and 102 deletions
+6 -6
View File
@@ -8522,13 +8522,13 @@ var es;
obj.shape.x = obj.x; obj.shape.x = obj.x;
obj.shape.y = obj.y; obj.shape.y = obj.y;
container.addChild(obj.shape); container.addChild(obj.shape);
}
obj.shape.graphics.clear(); obj.shape.graphics.clear();
obj.shape.graphics.lineStyle(1, 0xa0a0a4); obj.shape.graphics.lineStyle(1, 0xa0a0a4);
obj.shape.graphics.beginFill(0x979798, 0.5); obj.shape.graphics.beginFill(0x979798, 0.5);
obj.shape.graphics.drawRect(0, 0, obj.width * scale.x, obj.height * scale.y); obj.shape.graphics.drawRect(0, 0, obj.width * scale.x, obj.height * scale.y);
obj.shape.graphics.endFill(); obj.shape.graphics.endFill();
debugRender(obj, pos); debugRender(obj, pos);
}
break; break;
case es.TmxObjectType.point: case es.TmxObjectType.point:
var size = objGroup.map.tileWidth * 0.5; var size = objGroup.map.tileWidth * 0.5;
@@ -8538,13 +8538,13 @@ var es;
obj.shape.x = pos.x; obj.shape.x = pos.x;
obj.shape.y = pos.y; obj.shape.y = pos.y;
container.addChild(obj.shape); container.addChild(obj.shape);
}
obj.shape.graphics.clear(); obj.shape.graphics.clear();
obj.shape.graphics.lineStyle(1, 0xa0a0a4); obj.shape.graphics.lineStyle(1, 0xa0a0a4);
obj.shape.graphics.beginFill(0x979798, 0.5); obj.shape.graphics.beginFill(0x979798, 0.5);
obj.shape.graphics.drawCircle(0, 0, 1); obj.shape.graphics.drawCircle(0, 0, 1);
obj.shape.graphics.endFill(); obj.shape.graphics.endFill();
debugRender(obj, pos); debugRender(obj, pos);
}
break; break;
case es.TmxObjectType.tile: case es.TmxObjectType.tile:
var tileset = objGroup.map.getTilesetForTileGid(obj.tile.gid); var tileset = objGroup.map.getTilesetForTileGid(obj.tile.gid);
@@ -8593,8 +8593,8 @@ var es;
tileset.image.texture.anchorOffsetX = 0; tileset.image.texture.anchorOffsetX = 0;
if (tileset.image.texture.anchorOffsetY != 0) if (tileset.image.texture.anchorOffsetY != 0)
tileset.image.texture.anchorOffsetY = 0; tileset.image.texture.anchorOffsetY = 0;
}
debugRender(obj, pos); debugRender(obj, pos);
}
break; break;
case es.TmxObjectType.ellipse: case es.TmxObjectType.ellipse:
pos = new es.Vector2(obj.x + obj.width * 0.5, obj.y + obj.height * 0.5).multiply(scale); pos = new es.Vector2(obj.x + obj.width * 0.5, obj.y + obj.height * 0.5).multiply(scale);
@@ -8602,13 +8602,13 @@ var es;
obj.shape.x = pos.x; obj.shape.x = pos.x;
obj.shape.y = pos.y; obj.shape.y = pos.y;
container.addChild(obj.shape); container.addChild(obj.shape);
}
obj.shape.graphics.clear(); obj.shape.graphics.clear();
obj.shape.graphics.lineStyle(1, 0xa0a0a4); obj.shape.graphics.lineStyle(1, 0xa0a0a4);
obj.shape.graphics.beginFill(0x979798, 0.5); obj.shape.graphics.beginFill(0x979798, 0.5);
obj.shape.graphics.drawCircle(0, 0, obj.width * 0.5); obj.shape.graphics.drawCircle(0, 0, obj.width * 0.5);
obj.shape.graphics.endFill(); obj.shape.graphics.endFill();
debugRender(obj, pos); debugRender(obj, pos);
}
break; break;
case es.TmxObjectType.polygon: case es.TmxObjectType.polygon:
case es.TmxObjectType.polyline: case es.TmxObjectType.polyline:
@@ -8619,7 +8619,6 @@ var es;
obj.shape.x = pos.x; obj.shape.x = pos.x;
obj.shape.y = pos.y; obj.shape.y = pos.y;
container.addChild(obj.shape); container.addChild(obj.shape);
}
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++) {
@@ -8627,19 +8626,20 @@ var es;
} }
obj.shape.graphics.endFill(); obj.shape.graphics.endFill();
debugRender(obj, pos); debugRender(obj, pos);
}
break; break;
case es.TmxObjectType.text: case es.TmxObjectType.text:
if (!obj.textField.parent) { if (!obj.textField.parent) {
obj.textField.x = pos.x; obj.textField.x = pos.x;
obj.textField.y = pos.y; obj.textField.y = pos.y;
container.addChild(obj.textField); container.addChild(obj.textField);
}
obj.textField.text = obj.text.value; obj.textField.text = obj.text.value;
obj.textField.textColor = obj.text.color; obj.textField.textColor = obj.text.color;
obj.textField.bold = obj.text.bold != undefined ? obj.text.bold : false; obj.textField.bold = obj.text.bold != undefined ? obj.text.bold : false;
obj.textField.italic = obj.text.italic != undefined ? obj.text.italic : false; obj.textField.italic = obj.text.italic != undefined ? obj.text.italic : false;
obj.textField.size = obj.text.pixelSize; obj.textField.size = obj.text.pixelSize;
obj.textField.fontFamily = obj.text.fontFamily; obj.textField.fontFamily = obj.text.fontFamily;
}
break; break;
default: default:
break; break;
File diff suppressed because one or more lines are too long
+8 -6
View File
@@ -8501,6 +8501,8 @@ var es;
obj.textField.x = pos.x + (obj.width - obj.textField.width) / 2; obj.textField.x = pos.x + (obj.width - obj.textField.width) / 2;
obj.textField.y = pos.y - obj.textField.height - 5; obj.textField.y = pos.y - obj.textField.height - 5;
} }
obj.textField.background = true;
obj.textField.backgroundColor = 0xa0a0a4;
obj.textField.textColor = 0xffffff; obj.textField.textColor = 0xffffff;
container.addChild(obj.textField); container.addChild(obj.textField);
} }
@@ -8520,13 +8522,13 @@ var es;
obj.shape.x = obj.x; obj.shape.x = obj.x;
obj.shape.y = obj.y; obj.shape.y = obj.y;
container.addChild(obj.shape); container.addChild(obj.shape);
}
obj.shape.graphics.clear(); obj.shape.graphics.clear();
obj.shape.graphics.lineStyle(1, 0xa0a0a4); obj.shape.graphics.lineStyle(1, 0xa0a0a4);
obj.shape.graphics.beginFill(0x979798, 0.5); obj.shape.graphics.beginFill(0x979798, 0.5);
obj.shape.graphics.drawRect(0, 0, obj.width * scale.x, obj.height * scale.y); obj.shape.graphics.drawRect(0, 0, obj.width * scale.x, obj.height * scale.y);
obj.shape.graphics.endFill(); obj.shape.graphics.endFill();
debugRender(obj, pos); debugRender(obj, pos);
}
break; break;
case es.TmxObjectType.point: case es.TmxObjectType.point:
var size = objGroup.map.tileWidth * 0.5; var size = objGroup.map.tileWidth * 0.5;
@@ -8536,13 +8538,13 @@ var es;
obj.shape.x = pos.x; obj.shape.x = pos.x;
obj.shape.y = pos.y; obj.shape.y = pos.y;
container.addChild(obj.shape); container.addChild(obj.shape);
}
obj.shape.graphics.clear(); obj.shape.graphics.clear();
obj.shape.graphics.lineStyle(1, 0xa0a0a4); obj.shape.graphics.lineStyle(1, 0xa0a0a4);
obj.shape.graphics.beginFill(0x979798, 0.5); obj.shape.graphics.beginFill(0x979798, 0.5);
obj.shape.graphics.drawCircle(0, 0, 1); obj.shape.graphics.drawCircle(0, 0, 1);
obj.shape.graphics.endFill(); obj.shape.graphics.endFill();
debugRender(obj, pos); debugRender(obj, pos);
}
break; break;
case es.TmxObjectType.tile: case es.TmxObjectType.tile:
var tileset = objGroup.map.getTilesetForTileGid(obj.tile.gid); var tileset = objGroup.map.getTilesetForTileGid(obj.tile.gid);
@@ -8591,8 +8593,8 @@ var es;
tileset.image.texture.anchorOffsetX = 0; tileset.image.texture.anchorOffsetX = 0;
if (tileset.image.texture.anchorOffsetY != 0) if (tileset.image.texture.anchorOffsetY != 0)
tileset.image.texture.anchorOffsetY = 0; tileset.image.texture.anchorOffsetY = 0;
}
debugRender(obj, pos); debugRender(obj, pos);
}
break; break;
case es.TmxObjectType.ellipse: case es.TmxObjectType.ellipse:
pos = new es.Vector2(obj.x + obj.width * 0.5, obj.y + obj.height * 0.5).multiply(scale); pos = new es.Vector2(obj.x + obj.width * 0.5, obj.y + obj.height * 0.5).multiply(scale);
@@ -8600,13 +8602,13 @@ var es;
obj.shape.x = pos.x; obj.shape.x = pos.x;
obj.shape.y = pos.y; obj.shape.y = pos.y;
container.addChild(obj.shape); container.addChild(obj.shape);
}
obj.shape.graphics.clear(); obj.shape.graphics.clear();
obj.shape.graphics.lineStyle(1, 0xa0a0a4); obj.shape.graphics.lineStyle(1, 0xa0a0a4);
obj.shape.graphics.beginFill(0x979798, 0.5); obj.shape.graphics.beginFill(0x979798, 0.5);
obj.shape.graphics.drawCircle(0, 0, obj.width * 0.5); obj.shape.graphics.drawCircle(0, 0, obj.width * 0.5);
obj.shape.graphics.endFill(); obj.shape.graphics.endFill();
debugRender(obj, pos); debugRender(obj, pos);
}
break; break;
case es.TmxObjectType.polygon: case es.TmxObjectType.polygon:
case es.TmxObjectType.polyline: case es.TmxObjectType.polyline:
@@ -8617,7 +8619,6 @@ var es;
obj.shape.x = pos.x; obj.shape.x = pos.x;
obj.shape.y = pos.y; obj.shape.y = pos.y;
container.addChild(obj.shape); container.addChild(obj.shape);
}
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++) {
@@ -8625,19 +8626,20 @@ var es;
} }
obj.shape.graphics.endFill(); obj.shape.graphics.endFill();
debugRender(obj, pos); debugRender(obj, pos);
}
break; break;
case es.TmxObjectType.text: case es.TmxObjectType.text:
if (!obj.textField.parent) { if (!obj.textField.parent) {
obj.textField.x = pos.x; obj.textField.x = pos.x;
obj.textField.y = pos.y; obj.textField.y = pos.y;
container.addChild(obj.textField); container.addChild(obj.textField);
}
obj.textField.text = obj.text.value; obj.textField.text = obj.text.value;
obj.textField.textColor = obj.text.color; obj.textField.textColor = obj.text.color;
obj.textField.bold = obj.text.bold != undefined ? obj.text.bold : false; obj.textField.bold = obj.text.bold != undefined ? obj.text.bold : false;
obj.textField.italic = obj.text.italic != undefined ? obj.text.italic : false; obj.textField.italic = obj.text.italic != undefined ? obj.text.italic : false;
obj.textField.size = obj.text.pixelSize; obj.textField.size = obj.text.pixelSize;
obj.textField.fontFamily = obj.text.fontFamily; obj.textField.fontFamily = obj.text.fontFamily;
}
break; break;
default: default:
break; break;
+1 -1
View File
File diff suppressed because one or more lines are too long
+6 -6
View File
@@ -144,7 +144,6 @@ module es {
obj.shape.x = obj.x; obj.shape.x = obj.x;
obj.shape.y = obj.y; obj.shape.y = obj.y;
container.addChild(obj.shape); container.addChild(obj.shape);
}
obj.shape.graphics.clear(); obj.shape.graphics.clear();
obj.shape.graphics.lineStyle(1, 0xa0a0a4); obj.shape.graphics.lineStyle(1, 0xa0a0a4);
@@ -152,6 +151,7 @@ module es {
obj.shape.graphics.drawRect(0, 0, obj.width * scale.x, obj.height * scale.y); obj.shape.graphics.drawRect(0, 0, obj.width * scale.x, obj.height * scale.y);
obj.shape.graphics.endFill(); obj.shape.graphics.endFill();
debugRender(obj, pos); debugRender(obj, pos);
}
break; break;
case TmxObjectType.point: case TmxObjectType.point:
let size = objGroup.map.tileWidth * 0.5; let size = objGroup.map.tileWidth * 0.5;
@@ -161,7 +161,6 @@ module es {
obj.shape.x = pos.x; obj.shape.x = pos.x;
obj.shape.y = pos.y; obj.shape.y = pos.y;
container.addChild(obj.shape); container.addChild(obj.shape);
}
obj.shape.graphics.clear(); obj.shape.graphics.clear();
obj.shape.graphics.lineStyle(1, 0xa0a0a4); obj.shape.graphics.lineStyle(1, 0xa0a0a4);
@@ -169,6 +168,7 @@ module es {
obj.shape.graphics.drawCircle(0, 0, 1); obj.shape.graphics.drawCircle(0, 0, 1);
obj.shape.graphics.endFill(); obj.shape.graphics.endFill();
debugRender(obj, pos); debugRender(obj, pos);
}
break; break;
case TmxObjectType.tile: case TmxObjectType.tile:
let tileset = objGroup.map.getTilesetForTileGid(obj.tile.gid); let tileset = objGroup.map.getTilesetForTileGid(obj.tile.gid);
@@ -214,8 +214,8 @@ module es {
} }
if (tileset.image.texture.anchorOffsetX != 0) tileset.image.texture.anchorOffsetX = 0; if (tileset.image.texture.anchorOffsetX != 0) tileset.image.texture.anchorOffsetX = 0;
if (tileset.image.texture.anchorOffsetY != 0) tileset.image.texture.anchorOffsetY = 0; if (tileset.image.texture.anchorOffsetY != 0) tileset.image.texture.anchorOffsetY = 0;
}
debugRender(obj, pos); debugRender(obj, pos);
}
break; break;
case TmxObjectType.ellipse: case TmxObjectType.ellipse:
pos = new Vector2(obj.x + obj.width * 0.5, obj.y + obj.height * 0.5).multiply(scale); pos = new Vector2(obj.x + obj.width * 0.5, obj.y + obj.height * 0.5).multiply(scale);
@@ -223,7 +223,6 @@ module es {
obj.shape.x = pos.x; obj.shape.x = pos.x;
obj.shape.y = pos.y; obj.shape.y = pos.y;
container.addChild(obj.shape); container.addChild(obj.shape);
}
obj.shape.graphics.clear(); obj.shape.graphics.clear();
obj.shape.graphics.lineStyle(1, 0xa0a0a4); obj.shape.graphics.lineStyle(1, 0xa0a0a4);
@@ -231,6 +230,7 @@ module es {
obj.shape.graphics.drawCircle(0, 0, obj.width * 0.5); obj.shape.graphics.drawCircle(0, 0, obj.width * 0.5);
obj.shape.graphics.endFill(); obj.shape.graphics.endFill();
debugRender(obj, pos); debugRender(obj, pos);
}
break; break;
case TmxObjectType.polygon: case TmxObjectType.polygon:
case TmxObjectType.polyline: case TmxObjectType.polyline:
@@ -242,7 +242,6 @@ module es {
obj.shape.x = pos.x; obj.shape.x = pos.x;
obj.shape.y = pos.y; obj.shape.y = pos.y;
container.addChild(obj.shape); container.addChild(obj.shape);
}
obj.shape.graphics.clear(); obj.shape.graphics.clear();
obj.shape.graphics.lineStyle(1, 0xa0a0a4); obj.shape.graphics.lineStyle(1, 0xa0a0a4);
@@ -251,13 +250,13 @@ module es {
} }
obj.shape.graphics.endFill(); obj.shape.graphics.endFill();
debugRender(obj, pos); debugRender(obj, pos);
}
break; break;
case TmxObjectType.text: case TmxObjectType.text:
if (!obj.textField.parent){ if (!obj.textField.parent){
obj.textField.x = pos.x; obj.textField.x = pos.x;
obj.textField.y = pos.y; obj.textField.y = pos.y;
container.addChild(obj.textField); container.addChild(obj.textField);
}
obj.textField.text = obj.text.value; obj.textField.text = obj.text.value;
obj.textField.textColor = obj.text.color; obj.textField.textColor = obj.text.color;
@@ -265,6 +264,7 @@ module es {
obj.textField.italic = obj.text.italic != undefined ? obj.text.italic : false; obj.textField.italic = obj.text.italic != undefined ? obj.text.italic : false;
obj.textField.size = obj.text.pixelSize; obj.textField.size = obj.text.pixelSize;
obj.textField.fontFamily = obj.text.fontFamily; obj.textField.fontFamily = obj.text.fontFamily;
}
break; break;
default: default:
break; break;