mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
Merge pull request #766 from natural-law/issue3268
Solve the error effect of TiledMap in Windows Creator.
This commit is contained in:
@@ -695,6 +695,14 @@ var TiledMap = cc.Class({
|
||||
if (file) {
|
||||
var resPath = cc.url._rawAssets + file.tmxFolderPath;
|
||||
resPath = cc.path._setEndWithSep(resPath, false);
|
||||
|
||||
if (CC_EDITOR && cc.sys.os === cc.sys.OS_WINDOWS) {
|
||||
// In windows editor, the key of loaded textures are using '/'.
|
||||
// But the value of cc.url._rawAssets is using '\'
|
||||
// So, here should change the separater.
|
||||
resPath = resPath.replace(/\\/g, '/');
|
||||
}
|
||||
|
||||
var ret = sgNode.initWithXML(file.tmxXmlStr, resPath);
|
||||
if (ret) {
|
||||
self._onMapLoaded();
|
||||
|
||||
@@ -94,7 +94,7 @@ class TiledMapMeta extends CustomAssetMeta {
|
||||
asset.name = Path.basenameNoExt(fspath);
|
||||
asset.tmxXmlStr = this._tmxData;
|
||||
asset.tmxFolderPath = Path.relative(AssetRootUrl, Url.dirname(db.fspathToUrl(fspath)));
|
||||
asset.tmxFolderPath = asset.tmxFolderPath.replace('\\', '/');
|
||||
asset.tmxFolderPath = asset.tmxFolderPath.replace(/\\/g, '/');
|
||||
asset.textures = this._textures.map(p => db.fspathToUrl(p));
|
||||
asset.tsxFiles = this._tsxFiles.map(p => db.fspathToUrl(p));
|
||||
db.saveAssetToLibrary(this.uuid, asset);
|
||||
|
||||
Reference in New Issue
Block a user