-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #208 from Techbot/207-split-loader-class
split loaders
- Loading branch information
Showing
6 changed files
with
178 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* -------bossLoader --------- | ||
*/ | ||
|
||
import { useJigsStore } from '../../stores/jigs'; | ||
|
||
export default class BossLoader { | ||
|
||
jigs: any; | ||
|
||
constructor() { | ||
this.jigs = useJigsStore(); | ||
} | ||
|
||
add(scene) { | ||
console.log("---------------Boss Loader-------------") | ||
|
||
if (this.jigs.bossesArray) { | ||
this.jigs.bossesArray.forEach(function loader(boss) { | ||
scene.load.spritesheet('boss_' + boss.boss, '/assets/images/Level Bosses/' + boss.boss + '.png', | ||
{ frameWidth: parseInt(boss.field_frame_width), frameHeight: parseInt(boss.field_frame_height) }); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
|
||
/** | ||
* -------npcLoader --------- | ||
*/ | ||
|
||
import { useJigsStore } from '../../stores/jigs'; | ||
|
||
export default class NpcLoader { | ||
|
||
jigs: any; | ||
|
||
constructor() { | ||
this.jigs = useJigsStore(); | ||
} | ||
|
||
add(scene) { | ||
console.log("------------NPC Loader---------------") | ||
|
||
if (this.jigs.npcArray) { | ||
this.jigs.npcArray.forEach(function loader(Npc) { | ||
scene.load.spritesheet('npc' + Npc[3], '/assets/images/sprites/' + Npc[3] + '.png', { frameWidth: 64, frameHeight: 64 }); | ||
}, this); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
|
||
/** | ||
* -------questLoader --------- | ||
*/ | ||
|
||
import { useJigsStore } from '../../stores/jigs'; | ||
|
||
export default class QuestLoader { | ||
|
||
jigs: any; | ||
|
||
constructor() { | ||
this.jigs = useJigsStore(); | ||
} | ||
|
||
add(scene) { | ||
console.log("------------Quest Loader---------------") | ||
|
||
if (this.jigs.questsArray) { | ||
this.jigs.questsArray.forEach(function loader(questsItem) { | ||
scene.load.spritesheet('quest_' + questsItem.id, '/assets/images/quest/' + questsItem.file + '.png', | ||
{ frameWidth: questsItem.frameWidth, frameHeight: questsItem.frameHeight }); | ||
}); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
|
||
/** | ||
* -------switchLoader --------- | ||
*/ | ||
|
||
import { useJigsStore } from '../../stores/jigs'; | ||
|
||
export default class SwitchLoader { | ||
|
||
jigs: any; | ||
|
||
constructor() { | ||
this.jigs = useJigsStore(); | ||
} | ||
|
||
add(scene) { | ||
console.log("------------Switch Loader---------------") | ||
|
||
if (this.jigs.switchesArray) { | ||
this.jigs.switchesArray.forEach(function loader(switchItem) { | ||
scene.load.spritesheet('switch_' + switchItem.entity_id, '/assets/images/switches/' + switchItem.field_file_value, | ||
{ frameWidth: parseInt(switchItem.field_frame_width_value), frameHeight: parseInt(switchItem.field_frame_height_value) }); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
|
||
|
||
/** | ||
* -------mobLoader --------- | ||
*/ | ||
|
||
import { useJigsStore } from '../../stores/jigs'; | ||
|
||
export default class TilesetLoader { | ||
|
||
jigs: any; | ||
|
||
constructor() { | ||
this.jigs = useJigsStore(); | ||
} | ||
|
||
add(scene) { | ||
console.log("------------Tileset Loader---------------") | ||
|
||
this.jigs.tilesetArray_1.forEach(function loader(image) { | ||
if (!textureManager.exists(image)) { | ||
scene.load.image(image, '/assets/images/System/' + image + '.png'); | ||
} | ||
}, this); | ||
|
||
this.jigs.tilesetArray_2.forEach(function loader(image) { | ||
if (!textureManager.exists(image)) { | ||
scene.load.image(image, '/assets/images/System/' + image + '.png'); | ||
} | ||
}, this); | ||
|
||
this.jigs.tilesetArray_3.forEach(function loader(image) { | ||
if (!textureManager.exists(image)) { | ||
scene.load.image(image, '/assets/images/System/' + image + '.png'); | ||
} | ||
}, this); | ||
|
||
if (this.jigs.tilesetArray_4 !== undefined) { | ||
this.jigs.tilesetArray_4.forEach(function loader(image) { | ||
if (!textureManager.exists(image)) { | ||
scene.load.image(image, '/assets/images/System/' + image + '.png'); | ||
} | ||
}, this); | ||
|
||
|
||
} | ||
} | ||
} |