diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-17 19:39:05 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-17 19:39:05 +0800 |
commit | 431e4fc9d1657a50ebc34b8ac24f9bfaea06417f (patch) | |
tree | 5987bb14f38d2999c682970429f34b41eb3e5826 /src/features/dungeonMap2/DungeonRoomStaticData.js | |
parent | e73f2efdf0f50aa775c540317394d46428e9704f (diff) | |
download | SoopyV2-431e4fc9d1657a50ebc34b8ac24f9bfaea06417f.tar.gz SoopyV2-431e4fc9d1657a50ebc34b8ac24f9bfaea06417f.tar.bz2 SoopyV2-431e4fc9d1657a50ebc34b8ac24f9bfaea06417f.zip |
Initial move to babel + change fetch to use async/await
Diffstat (limited to 'src/features/dungeonMap2/DungeonRoomStaticData.js')
-rw-r--r-- | src/features/dungeonMap2/DungeonRoomStaticData.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/features/dungeonMap2/DungeonRoomStaticData.js b/src/features/dungeonMap2/DungeonRoomStaticData.js new file mode 100644 index 0000000..75d5b1e --- /dev/null +++ b/src/features/dungeonMap2/DungeonRoomStaticData.js @@ -0,0 +1,19 @@ +class DungeonRoomStaticData { + constructor() { + this.fullRoomData = JSON.parse(FileLib.read("SoopyV2", "data/roomdata.json")) + + this.idMap = new Map() + this.fullRoomData.forEach((d, i) => { + d.id.forEach(id => { + this.idMap.set(id, i) + }) + this.idMap.set(d.index, i) + }) + } + + getDataFromId(id) { + return this.fullRoomData[this.idMap.get(id)] + } +} + +export default new DungeonRoomStaticData()
\ No newline at end of file |