@@ -9,18 +9,33 @@ import { createCharacterAnims } from "../entities/anim";
99import { createSwitchesAnims } from "../entities/anim" ;
1010import { createBossAnims } from "../entities/anim" ;
1111import MobLoader from "./mobLoader"
12-
12+ import BossLoader from "./bossLoader"
13+ import NpcLoader from "./npcLoader"
14+ import TilesetLoader from "./tilesetLoader"
15+ import SwitchLoader from "./switchLoader"
16+ import QuestLoader from "./questLoader"
1317
1418export default class Load {
1519
1620 jigs : any ;
1721 npcs : any ;
1822 sprite : any ;
19- mobloader : any ;
23+ mobLoader : any ;
24+ bossLoader : any ;
25+ npcLoader : any ;
26+ tilesetLoader : any ;
27+ switchLoader : any ;
28+ questLoader : any ;
2029
2130 constructor ( ) {
2231 this . jigs = useJigsStore ( ) ;
23- this . mobloader = new MobLoader ( ) ;
32+ this . mobLoader = new MobLoader ( ) ;
33+ this . bossLoader = new BossLoader ( ) ;
34+ this . npcLoader = new NpcLoader ( ) ;
35+ this . tilesetLoader = new TilesetLoader ( ) ;
36+ this . switchLoader = new SwitchLoader ( ) ;
37+ this . questLoader = new QuestLoader ( ) ;
38+
2439 }
2540
2641 padding ( n , p , c ) {
@@ -37,66 +52,12 @@ export default class Load {
3752 scene . load . image ( 'pink' , '/assets/images/pink.png' ) ;
3853 scene . load . tilemapTiledJSON ( this . jigs . city + "_" + this . jigs . tiled , '/assets/cities/json/' + this . jigs . city + this . padding ( this . jigs . tiled , 3 , '0' ) + '.json?' + Math . random ( ) ) ;
3954
40- this . jigs . tilesetArray_1 . forEach ( function loader ( image ) {
41- if ( ! textureManager . exists ( image ) ) {
42- scene . load . image ( image , '/assets/images/System/' + image + '.png' ) ;
43- }
44- } , this ) ;
45-
46- this . jigs . tilesetArray_2 . forEach ( function loader ( image ) {
47- if ( ! textureManager . exists ( image ) ) {
48- scene . load . image ( image , '/assets/images/System/' + image + '.png' ) ;
49- }
50- } , this ) ;
51-
52- this . jigs . tilesetArray_3 . forEach ( function loader ( image ) {
53- if ( ! textureManager . exists ( image ) ) {
54- scene . load . image ( image , '/assets/images/System/' + image + '.png' ) ;
55- }
56- } , this ) ;
57-
58- if ( this . jigs . tilesetArray_4 !== undefined ) {
59- this . jigs . tilesetArray_4 . forEach ( function loader ( image ) {
60- if ( ! textureManager . exists ( image ) ) {
61- scene . load . image ( image , '/assets/images/System/' + image + '.png' ) ;
62- }
63- } , this ) ;
64- }
65-
66- if ( this . jigs . npcArray ) {
67- this . jigs . npcArray . forEach ( function loader ( Npc ) {
68- scene . load . spritesheet ( 'npc' + Npc [ 3 ] , '/assets/images/sprites/' + Npc [ 3 ] + '.png' , { frameWidth : 64 , frameHeight : 64 } ) ;
69- } , this ) ;
70- }
71-
72- /* if (this.jigs.mobArray) {
73- this.jigs.mobArray.forEach(function loader(Mob) {
74- scene.load.spritesheet('mob' + Mob[4], '/assets/images/sprites/' + Mob[4] + '.png', { frameWidth: 64, frameHeight: 64 });
75- }, this);
76- } */
77- this . mobloader . add ( scene ) ;
78-
79-
80- if ( this . jigs . bossesArray ) {
81- this . jigs . bossesArray . forEach ( function loader ( boss ) {
82- scene . load . spritesheet ( 'boss_' + boss . boss , '/assets/images/Level Bosses/' + boss . boss + '.png' ,
83- { frameWidth : parseInt ( boss . field_frame_width ) , frameHeight : parseInt ( boss . field_frame_height ) } ) ;
84- } ) ;
85- }
86-
87- if ( this . jigs . switchesArray ) {
88- this . jigs . switchesArray . forEach ( function loader ( switchItem ) {
89- scene . load . spritesheet ( 'switch_' + switchItem . entity_id , '/assets/images/switches/' + switchItem . field_file_value ,
90- { frameWidth : parseInt ( switchItem . field_frame_width_value ) , frameHeight : parseInt ( switchItem . field_frame_height_value ) } ) ;
91- } ) ;
92- }
93-
94- if ( this . jigs . questsArray ) {
95- this . jigs . questsArray . forEach ( function loader ( questsItem ) {
96- scene . load . spritesheet ( 'quest_' + questsItem . id , '/assets/images/quest/' + questsItem . file + '.png' ,
97- { frameWidth : questsItem . frameWidth , frameHeight : questsItem . frameHeight } ) ;
98- } ) ;
99- }
55+ this . tilesetLoader . add ( scene ) ;
56+ this . npcLoader . add ( scene ) ;
57+ this . mobLoader . add ( scene ) ;
58+ this . bossLoader . add ( scene ) ;
59+ this . switchLoader . add ( scene ) ;
60+ this . questLoader . add ( scene ) ;
10061
10162 scene . load . once ( Phaser . Loader . Events . COMPLETE , ( ) => {
10263 const Layer = new Layers ;
@@ -105,19 +66,13 @@ export default class Load {
10566 createCharacterAnims(scene.anims, 'PsibotF_slash', 'slash_oversize'); */
10667
10768 createCharacterAnims ( scene . anims , 'player' , null ) ;
108-
10969 createCharacterAnims ( scene . anims , 'otherPlayer' , null ) ;
11070
11171 if ( this . jigs . npcArray ) {
11272 this . jigs . npcArray . forEach ( function loader ( Npc ) {
11373 createCharacterAnims ( scene . anims , 'npc' , Npc [ 3 ] ) ;
11474 } ) ;
11575 }
116- /* if (this.jigs.mobArray) {
117- this.jigs.mobArray.forEach(function loader(mob) {
118- createCharacterAnims(scene.anims, 'mob' + mob[4], 'default');
119- });
120- } */
12176
12277 if ( this . jigs . mobArray ) {
12378 this . jigs . mobArray . forEach ( function loader ( mob ) {
@@ -131,9 +86,6 @@ export default class Load {
13186 } ) ;
13287 }
13388
134-
135-
136-
13789 if ( this . jigs . switchesArray ) {
13890 this . jigs . switchesArray . forEach ( function loader ( switches ) {
13991 createSwitchesAnims ( scene . anims ,
0 commit comments