mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
refine TiledTile (#2977)
This commit is contained in:
@@ -333,8 +333,10 @@ let TiledLayer = cc.Class({
|
||||
if (!tile && forceCreate) {
|
||||
let node = new cc.Node();
|
||||
tile = node.addComponent(cc.TiledTile);
|
||||
tile.x = x;
|
||||
tile.y = y;
|
||||
tile._x = x;
|
||||
tile._y = y;
|
||||
tile._layer = this;
|
||||
tile._updateInfo();
|
||||
node.parent = this.node;
|
||||
return tile;
|
||||
}
|
||||
|
||||
@@ -129,8 +129,11 @@ let TiledTile = cc.Class({
|
||||
this._updateInfo();
|
||||
}
|
||||
else if (this._layer) {
|
||||
if (this._layer.getTiledTileAt(this._x, this._y)) {
|
||||
cc.warn('There is already a TiledTile at [%s, %s]', x, y);
|
||||
let tile = this._layer.getTiledTileAt(this._x, this._y);
|
||||
if (tile) {
|
||||
if (tile !== this) {
|
||||
cc.warn('There is already a TiledTile at [%s, %s]', x, y);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this._layer.setTiledTileAt(this._x, this._y, this);
|
||||
|
||||
Reference in New Issue
Block a user