@rpgjs/tiledmap 5.0.0-alpha.10 → 5.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.js +5 -11
- package/dist/client/index2.js +1 -1
- package/dist/client/index3.js +12 -4649
- package/dist/index.d.ts +0 -1
- package/dist/server/index.js +1 -1
- package/dist/server/index2.js +1 -1
- package/dist/server.d.ts +1 -1
- package/package.json +8 -10
- package/src/client.ts +1 -1
- package/src/index.ts +18 -27
- package/src/server.ts +4 -1
- package/src/tiled.ce +2 -3
- package/dist/client/index4.js +0 -15
- package/dist/server/index3.js +0 -5232
package/dist/client/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import client from "./index2.js";
|
|
2
2
|
import { createModule } from "@rpgjs/common";
|
|
3
3
|
import { provideLoadMap } from "@rpgjs/client";
|
|
4
|
-
import { TiledParser } from "
|
|
5
|
-
import component from "./
|
|
4
|
+
import { TiledParser } from "@rpgjs/tiled";
|
|
5
|
+
import component from "./index3.js";
|
|
6
6
|
const server = null;
|
|
7
7
|
function provideTiledMap(options) {
|
|
8
8
|
var _a;
|
|
@@ -13,12 +13,12 @@ function provideTiledMap(options) {
|
|
|
13
13
|
},
|
|
14
14
|
(_a = provideLoadMap) == null ? void 0 : _a(async (map) => {
|
|
15
15
|
const response = await fetch(`${options.basePath}/${map}.tmx`);
|
|
16
|
-
const mapData = await response.text();
|
|
16
|
+
const mapData = (await response.text()).replace(/source="([^"]+)"/g, `source="${options.basePath}/$1"`);
|
|
17
17
|
const parser = new TiledParser(mapData);
|
|
18
18
|
const parsedMap = parser.parseMap();
|
|
19
19
|
const tilesets = [];
|
|
20
20
|
for (let tileset of parsedMap.tilesets) {
|
|
21
|
-
const response2 = await fetch(`${
|
|
21
|
+
const response2 = await fetch(`${tileset.source}`);
|
|
22
22
|
const tilesetData = await response2.text();
|
|
23
23
|
const parser2 = new TiledParser(tilesetData);
|
|
24
24
|
const parsedTileset = parser2.parseTileset();
|
|
@@ -35,14 +35,8 @@ function provideTiledMap(options) {
|
|
|
35
35
|
data: mapData,
|
|
36
36
|
component,
|
|
37
37
|
parsedMap,
|
|
38
|
-
id: map
|
|
39
|
-
params: {
|
|
40
|
-
basePath: options.basePath
|
|
41
|
-
}
|
|
38
|
+
id: map
|
|
42
39
|
};
|
|
43
|
-
if (options.onLoadMap) {
|
|
44
|
-
await options.onLoadMap(map);
|
|
45
|
-
}
|
|
46
40
|
return obj;
|
|
47
41
|
})
|
|
48
42
|
]);
|