From acf765847eb397a51c4c40c28ac0b3453c68c4da Mon Sep 17 00:00:00 2001 From: zhangbin Date: Tue, 17 May 2016 10:33:10 +0800 Subject: [PATCH 1/2] Solve the error in TiledMap when build for android on Windows. --- cocos2d/tilemap/CCTiledMap.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cocos2d/tilemap/CCTiledMap.js b/cocos2d/tilemap/CCTiledMap.js index 2d054546a6..22f91aabd3 100644 --- a/cocos2d/tilemap/CCTiledMap.js +++ b/cocos2d/tilemap/CCTiledMap.js @@ -696,7 +696,13 @@ var TiledMap = cc.Class({ var file = this._tmxFile; var self = this; if (file) { - var resPath = cc.url._rawAssets + file.tmxFolderPath; + var tmxFolderPath = file.tmxFolderPath; + if (cc.sys.os === cc.sys.OS_WINDOWS) { + tmxFolderPath = tmxFolderPath.replace('/', '\\'); + } else { + tmxFolderPath = tmxFolderPath.replace('\\', '/'); + } + var resPath = cc.url._rawAssets + tmxFolderPath; resPath = cc.path._setEndWithSep(resPath, false); var ret = sgNode.initWithXML(file.tmxXmlStr, resPath); if (ret) { From eb057da554987864731a1b3c4e965d3bed11d354 Mon Sep 17 00:00:00 2001 From: zhangbin Date: Thu, 19 May 2016 10:00:17 +0800 Subject: [PATCH 2/2] Change the solution of issue 3007. --- cocos2d/tilemap/CCTiledMap.js | 8 +------- cocos2d/tilemap/editor/tiled-map.js | 3 ++- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/cocos2d/tilemap/CCTiledMap.js b/cocos2d/tilemap/CCTiledMap.js index 22f91aabd3..2d054546a6 100644 --- a/cocos2d/tilemap/CCTiledMap.js +++ b/cocos2d/tilemap/CCTiledMap.js @@ -696,13 +696,7 @@ var TiledMap = cc.Class({ var file = this._tmxFile; var self = this; if (file) { - var tmxFolderPath = file.tmxFolderPath; - if (cc.sys.os === cc.sys.OS_WINDOWS) { - tmxFolderPath = tmxFolderPath.replace('/', '\\'); - } else { - tmxFolderPath = tmxFolderPath.replace('\\', '/'); - } - var resPath = cc.url._rawAssets + tmxFolderPath; + var resPath = cc.url._rawAssets + file.tmxFolderPath; resPath = cc.path._setEndWithSep(resPath, false); var ret = sgNode.initWithXML(file.tmxXmlStr, resPath); if (ret) { diff --git a/cocos2d/tilemap/editor/tiled-map.js b/cocos2d/tilemap/editor/tiled-map.js index 85a57069e3..16e0f49c3d 100644 --- a/cocos2d/tilemap/editor/tiled-map.js +++ b/cocos2d/tilemap/editor/tiled-map.js @@ -69,7 +69,7 @@ class TiledMapMeta extends CustomAssetMeta { this.tsxFiles = []; } - static version () { return '1.0.1'; } + static version () { return '1.0.2'; } static defaultType() { return 'tiled-map'; } import (fspath, cb) { @@ -83,6 +83,7 @@ class TiledMapMeta extends CustomAssetMeta { asset.name = Path.basenameNoExt(fspath); asset.tmxXmlStr = data; asset.tmxFolderPath = Path.relative(AssetRootUrl, Url.dirname(db.fspathToUrl(fspath))); + asset.tmxFolderPath = asset.tmxFolderPath.replace('\\', '/'); searchDependFiles(fspath, (err, info) => { if (err) {