vue-phaserjs 3.5.1 → 3.6.0
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/index.d.ts +906 -906
- package/dist/index.js +966 -966
- package/package.json +5 -6
package/dist/index.js
CHANGED
|
@@ -255,31 +255,52 @@ const useInitializeGameObject = (create, configuration, emit, setterMap, immedia
|
|
|
255
255
|
});
|
|
256
256
|
};
|
|
257
257
|
//#endregion
|
|
258
|
-
//#region src/services/setterMap/
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
258
|
+
//#region src/services/setterMap/global/GameObjectSetterMap.ts
|
|
259
|
+
const GameObjectSetterMap = { active: (gameObject) => (value) => {
|
|
260
|
+
if (value === void 0) return;
|
|
261
|
+
gameObject.setActive(value);
|
|
262
|
+
} };
|
|
263
|
+
//#endregion
|
|
264
|
+
//#region src/services/setterMap/global/TweenSetterMap.ts
|
|
265
|
+
const TweenSetterMap = {
|
|
266
|
+
tween: (gameObject, emit) => (value) => {
|
|
267
|
+
if (!value) return;
|
|
268
|
+
gameObject.scene.add.tween({
|
|
269
|
+
...value,
|
|
270
|
+
targets: gameObject
|
|
271
|
+
}).on(Tweens.Events.TWEEN_COMPLETE, () => {
|
|
272
|
+
emit("update:tween", void 0);
|
|
273
|
+
});
|
|
263
274
|
},
|
|
264
|
-
|
|
265
|
-
if (value
|
|
266
|
-
gameObject.
|
|
275
|
+
tweenchain: (gameObject, emit) => (value) => {
|
|
276
|
+
if (!value) return;
|
|
277
|
+
gameObject.scene.add.tweenchain(value.map((configuration) => ({
|
|
278
|
+
...configuration,
|
|
279
|
+
targets: gameObject
|
|
280
|
+
}))).on(Tweens.Events.TWEEN_COMPLETE, () => {
|
|
281
|
+
emit("update:tweenchain", void 0);
|
|
282
|
+
});
|
|
267
283
|
}
|
|
268
284
|
};
|
|
269
285
|
//#endregion
|
|
270
|
-
//#region src/services/setterMap/
|
|
271
|
-
const
|
|
272
|
-
...
|
|
273
|
-
|
|
274
|
-
if (value === void 0) return;
|
|
275
|
-
gameObject.setSize(gameObject.width, value);
|
|
276
|
-
},
|
|
277
|
-
width: (gameObject) => (value) => {
|
|
278
|
-
if (value === void 0) return;
|
|
279
|
-
gameObject.setSize(value, gameObject.height);
|
|
280
|
-
}
|
|
286
|
+
//#region src/services/setterMap/global/GlobalSetterMap.ts
|
|
287
|
+
const GlobalSetterMap = {
|
|
288
|
+
...TweenSetterMap,
|
|
289
|
+
...GameObjectSetterMap
|
|
281
290
|
};
|
|
282
291
|
//#endregion
|
|
292
|
+
//#region src/services/setterMap/components/AlphaSingleSetterMap.ts
|
|
293
|
+
const AlphaSingleSetterMap = { alpha: (gameObject) => (value) => {
|
|
294
|
+
if (value === void 0) return;
|
|
295
|
+
gameObject.setAlpha(value);
|
|
296
|
+
} };
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region src/services/setterMap/components/BlendModeSetterMap.ts
|
|
299
|
+
const BlendModeSetterMap = { blendMode: (gameObject) => (value) => {
|
|
300
|
+
if (value === void 0) return;
|
|
301
|
+
gameObject.setBlendMode(value);
|
|
302
|
+
} };
|
|
303
|
+
//#endregion
|
|
283
304
|
//#region src/services/setterMap/components/DepthSetterMap.ts
|
|
284
305
|
const DepthSetterMap = { depth: (gameObject) => (value) => {
|
|
285
306
|
if (value === void 0) return;
|
|
@@ -294,6 +315,24 @@ const DepthSetterMap = { depth: (gameObject) => (value) => {
|
|
|
294
315
|
}
|
|
295
316
|
} };
|
|
296
317
|
//#endregion
|
|
318
|
+
//#region src/services/setterMap/components/DisplaySizeSetterMap.ts
|
|
319
|
+
const DisplaySizeSetterMap = {
|
|
320
|
+
displayHeight: (gameObject) => (value) => {
|
|
321
|
+
if (value === void 0) return;
|
|
322
|
+
gameObject.setDisplaySize(gameObject.displayWidth, value);
|
|
323
|
+
},
|
|
324
|
+
displayWidth: (gameObject) => (value) => {
|
|
325
|
+
if (value === void 0) return;
|
|
326
|
+
gameObject.setDisplaySize(value, gameObject.displayHeight);
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
//#endregion
|
|
330
|
+
//#region src/services/setterMap/components/MaskSetterMap.ts
|
|
331
|
+
const MaskSetterMap = { mask: (gameObject) => (value) => {
|
|
332
|
+
if (!value) return;
|
|
333
|
+
gameObject.setMask(value);
|
|
334
|
+
} };
|
|
335
|
+
//#endregion
|
|
297
336
|
//#region src/services/setterMap/components/OriginSetterMap.ts
|
|
298
337
|
const OriginSetterMap = {
|
|
299
338
|
displayOriginX: (gameObject) => (value) => {
|
|
@@ -318,6 +357,9 @@ const OriginSetterMap = {
|
|
|
318
357
|
}
|
|
319
358
|
};
|
|
320
359
|
//#endregion
|
|
360
|
+
//#region src/services/setterMap/components/RenderNodesSetterMap.ts
|
|
361
|
+
const RenderNodesSetterMap = {};
|
|
362
|
+
//#endregion
|
|
321
363
|
//#region src/services/setterMap/components/ScrollFactorSetterMap.ts
|
|
322
364
|
const ScrollFactorSetterMap = {
|
|
323
365
|
scrollFactor: (gameObject) => (value) => {
|
|
@@ -380,60 +422,68 @@ const VisibleSetterMap = { visible: (gameObject) => (value) => {
|
|
|
380
422
|
gameObject.setVisible(value);
|
|
381
423
|
} };
|
|
382
424
|
//#endregion
|
|
383
|
-
//#region src/services/setterMap/
|
|
384
|
-
const
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
} };
|
|
388
|
-
//#endregion
|
|
389
|
-
//#region src/services/setterMap/global/TweenSetterMap.ts
|
|
390
|
-
const TweenSetterMap = {
|
|
391
|
-
tween: (gameObject, emit) => (value) => {
|
|
392
|
-
if (!value) return;
|
|
393
|
-
gameObject.scene.add.tween({
|
|
394
|
-
...value,
|
|
395
|
-
targets: gameObject
|
|
396
|
-
}).on(Tweens.Events.TWEEN_COMPLETE, () => {
|
|
397
|
-
emit("update:tween", void 0);
|
|
398
|
-
});
|
|
399
|
-
},
|
|
400
|
-
tweenchain: (gameObject, emit) => (value) => {
|
|
401
|
-
if (!value) return;
|
|
402
|
-
gameObject.scene.add.tweenchain(value.map((configuration) => ({
|
|
403
|
-
...configuration,
|
|
404
|
-
targets: gameObject
|
|
405
|
-
}))).on(Tweens.Events.TWEEN_COMPLETE, () => {
|
|
406
|
-
emit("update:tweenchain", void 0);
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
};
|
|
410
|
-
//#endregion
|
|
411
|
-
//#region src/services/setterMap/global/GlobalSetterMap.ts
|
|
412
|
-
const GlobalSetterMap = {
|
|
413
|
-
...TweenSetterMap,
|
|
414
|
-
...GameObjectSetterMap
|
|
415
|
-
};
|
|
416
|
-
//#endregion
|
|
417
|
-
//#region src/services/setterMap/ZoneSetterMap.ts
|
|
418
|
-
const ZoneSetterMap = {
|
|
419
|
-
...ComputedSizeSetterMap,
|
|
425
|
+
//#region src/services/setterMap/shared/ShapeSetterMap.ts
|
|
426
|
+
const ShapeSetterMap = {
|
|
427
|
+
...AlphaSingleSetterMap,
|
|
428
|
+
...BlendModeSetterMap,
|
|
420
429
|
...DepthSetterMap,
|
|
430
|
+
...DisplaySizeSetterMap,
|
|
431
|
+
...GameObjectSetterMap,
|
|
432
|
+
...MaskSetterMap,
|
|
421
433
|
...OriginSetterMap,
|
|
434
|
+
...RenderNodesSetterMap,
|
|
422
435
|
...ScrollFactorSetterMap,
|
|
423
436
|
...TransformSetterMap,
|
|
424
437
|
...VisibleSetterMap,
|
|
438
|
+
fillAlpha: (gameObject) => (value) => {
|
|
439
|
+
gameObject.setFillStyle(gameObject.fillColor, value);
|
|
440
|
+
},
|
|
441
|
+
fillColor: (gameObject) => (value) => {
|
|
442
|
+
gameObject.setFillStyle(value, gameObject.fillAlpha);
|
|
443
|
+
},
|
|
444
|
+
strokeStyle: (gameObject) => (value) => {
|
|
445
|
+
if (!value) return;
|
|
446
|
+
gameObject.setStrokeStyle(...value);
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
//#endregion
|
|
450
|
+
//#region src/services/setterMap/ArcSetterMap.ts
|
|
451
|
+
const ArcSetterMap = {
|
|
452
|
+
closePath: (gameObject) => (value) => {
|
|
453
|
+
if (value === void 0) return;
|
|
454
|
+
gameObject.setClosePath(value);
|
|
455
|
+
},
|
|
456
|
+
endAngle: (gameObject) => (value) => {
|
|
457
|
+
if (value === void 0) return;
|
|
458
|
+
gameObject.setEndAngle(value);
|
|
459
|
+
},
|
|
460
|
+
radius: (gameObject) => (value) => {
|
|
461
|
+
if (value === void 0) return;
|
|
462
|
+
gameObject.setRadius(value);
|
|
463
|
+
},
|
|
464
|
+
startAngle: (gameObject) => (value) => {
|
|
465
|
+
if (value === void 0) return;
|
|
466
|
+
gameObject.setStartAngle(value);
|
|
467
|
+
},
|
|
468
|
+
...ShapeSetterMap,
|
|
425
469
|
...GlobalSetterMap
|
|
426
470
|
};
|
|
427
471
|
//#endregion
|
|
428
|
-
//#region src/components/
|
|
429
|
-
const _sfc_main
|
|
430
|
-
__name: "
|
|
431
|
-
props: {
|
|
472
|
+
//#region src/components/Arc.vue
|
|
473
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
474
|
+
__name: "Arc",
|
|
475
|
+
props: {
|
|
476
|
+
configuration: {},
|
|
477
|
+
immediate: { type: Boolean },
|
|
478
|
+
onComplete: { type: Function }
|
|
479
|
+
},
|
|
432
480
|
setup(__props, { emit: __emit }) {
|
|
433
481
|
useInitializeGameObject((scene) => {
|
|
434
|
-
const {
|
|
435
|
-
|
|
436
|
-
|
|
482
|
+
const { alpha, endAngle, fillColor, radius, startAngle, x, y } = __props.configuration;
|
|
483
|
+
const arc = scene.add.arc(x, y, radius, startAngle, endAngle, void 0, fillColor, alpha);
|
|
484
|
+
__props.onComplete?.(scene, arc);
|
|
485
|
+
return arc;
|
|
486
|
+
}, () => __props.configuration, __emit, ArcSetterMap, __props.immediate);
|
|
437
487
|
return (_ctx, _cache) => {
|
|
438
488
|
return null;
|
|
439
489
|
};
|
|
@@ -464,48 +514,6 @@ const AlphaSetterMap = {
|
|
|
464
514
|
}
|
|
465
515
|
};
|
|
466
516
|
//#endregion
|
|
467
|
-
//#region src/services/setterMap/components/BlendModeSetterMap.ts
|
|
468
|
-
const BlendModeSetterMap = { blendMode: (gameObject) => (value) => {
|
|
469
|
-
if (value === void 0) return;
|
|
470
|
-
gameObject.setBlendMode(value);
|
|
471
|
-
} };
|
|
472
|
-
//#endregion
|
|
473
|
-
//#region src/services/setterMap/components/FlipSetterMap.ts
|
|
474
|
-
const FlipSetterMap = {
|
|
475
|
-
flipX: (gameObject) => (value) => {
|
|
476
|
-
if (value === void 0) return;
|
|
477
|
-
gameObject.setFlipX(value);
|
|
478
|
-
},
|
|
479
|
-
flipY: (gameObject) => (value) => {
|
|
480
|
-
if (value === void 0) return;
|
|
481
|
-
gameObject.setFlipY(value);
|
|
482
|
-
}
|
|
483
|
-
};
|
|
484
|
-
//#endregion
|
|
485
|
-
//#region src/services/setterMap/components/MaskSetterMap.ts
|
|
486
|
-
const MaskSetterMap = { mask: (gameObject) => (value) => {
|
|
487
|
-
if (!value) return;
|
|
488
|
-
gameObject.setMask(value);
|
|
489
|
-
} };
|
|
490
|
-
//#endregion
|
|
491
|
-
//#region src/services/setterMap/components/RenderNodesSetterMap.ts
|
|
492
|
-
const RenderNodesSetterMap = {};
|
|
493
|
-
//#endregion
|
|
494
|
-
//#region src/services/setterMap/components/BaseTextureSetterMap.ts
|
|
495
|
-
const BaseTextureSetterMap = {
|
|
496
|
-
frame: (gameObject) => (value) => {
|
|
497
|
-
if (value === void 0) return;
|
|
498
|
-
gameObject.setFrame(value);
|
|
499
|
-
},
|
|
500
|
-
texture: (gameObject) => (value) => {
|
|
501
|
-
if (!value) return;
|
|
502
|
-
gameObject.setTexture(value);
|
|
503
|
-
}
|
|
504
|
-
};
|
|
505
|
-
//#endregion
|
|
506
|
-
//#region src/services/setterMap/components/TextureCropSetterMap.ts
|
|
507
|
-
const TextureCropSetterMap = { ...BaseTextureSetterMap };
|
|
508
|
-
//#endregion
|
|
509
517
|
//#region src/services/setterMap/components/TintSetterMap.ts
|
|
510
518
|
const TintSetterMap = {
|
|
511
519
|
tint: (gameObject) => (value) => {
|
|
@@ -530,140 +538,60 @@ const TintSetterMap = {
|
|
|
530
538
|
}
|
|
531
539
|
};
|
|
532
540
|
//#endregion
|
|
533
|
-
//#region src/services/setterMap/
|
|
534
|
-
const
|
|
535
|
-
|
|
541
|
+
//#region src/services/setterMap/BitmapTextSetterMap.ts
|
|
542
|
+
const BitmapTextSetterMap = {
|
|
543
|
+
align: (gameObject) => (value) => {
|
|
544
|
+
if (value === void 0) return;
|
|
545
|
+
gameObject.align = value;
|
|
546
|
+
},
|
|
547
|
+
dropShadow: (gameObject) => (value) => {
|
|
536
548
|
if (!value) return;
|
|
537
|
-
gameObject.
|
|
549
|
+
gameObject.setDropShadow(...value);
|
|
538
550
|
},
|
|
539
|
-
|
|
540
|
-
|
|
551
|
+
font: (gameObject) => (value) => {
|
|
552
|
+
if (!value) return;
|
|
553
|
+
gameObject.setFont(value);
|
|
541
554
|
},
|
|
542
|
-
|
|
543
|
-
|
|
555
|
+
fontSize: (gameObject) => (value) => {
|
|
556
|
+
if (value === void 0) return;
|
|
557
|
+
gameObject.setFontSize(value);
|
|
544
558
|
},
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
...FlipSetterMap,
|
|
549
|
-
...MaskSetterMap,
|
|
550
|
-
...OriginSetterMap,
|
|
551
|
-
...RenderNodesSetterMap,
|
|
552
|
-
...ScrollFactorSetterMap,
|
|
553
|
-
...TextureCropSetterMap,
|
|
554
|
-
...TintSetterMap,
|
|
555
|
-
...TransformSetterMap,
|
|
556
|
-
...VisibleSetterMap,
|
|
557
|
-
...GlobalSetterMap
|
|
558
|
-
};
|
|
559
|
-
//#endregion
|
|
560
|
-
//#region src/components/Video.vue
|
|
561
|
-
const _sfc_main$25 = /*@__PURE__*/ defineComponent({
|
|
562
|
-
__name: "Video",
|
|
563
|
-
props: {
|
|
564
|
-
configuration: {},
|
|
565
|
-
immediate: { type: Boolean },
|
|
566
|
-
onComplete: { type: Function }
|
|
559
|
+
letterSpacing: (gameObject) => (value) => {
|
|
560
|
+
if (value === void 0) return;
|
|
561
|
+
gameObject.setLetterSpacing(value);
|
|
567
562
|
},
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
const video = scene.add.video(x ?? 0, y ?? 0, key);
|
|
572
|
-
__props.onComplete?.(scene, video);
|
|
573
|
-
return video;
|
|
574
|
-
}, () => __props.configuration, __emit, VideoSetterMap, __props.immediate);
|
|
575
|
-
return (_ctx, _cache) => {
|
|
576
|
-
return null;
|
|
577
|
-
};
|
|
578
|
-
}
|
|
579
|
-
});
|
|
580
|
-
//#endregion
|
|
581
|
-
//#region src/services/setterMap/components/AlphaSingleSetterMap.ts
|
|
582
|
-
const AlphaSingleSetterMap = { alpha: (gameObject) => (value) => {
|
|
583
|
-
if (value === void 0) return;
|
|
584
|
-
gameObject.setAlpha(value);
|
|
585
|
-
} };
|
|
586
|
-
//#endregion
|
|
587
|
-
//#region src/services/setterMap/shared/ShapeSetterMap.ts
|
|
588
|
-
const ShapeSetterMap = {
|
|
589
|
-
...AlphaSingleSetterMap,
|
|
590
|
-
...BlendModeSetterMap,
|
|
591
|
-
...DepthSetterMap,
|
|
592
|
-
...DisplaySizeSetterMap,
|
|
593
|
-
...GameObjectSetterMap,
|
|
594
|
-
...MaskSetterMap,
|
|
595
|
-
...OriginSetterMap,
|
|
596
|
-
...RenderNodesSetterMap,
|
|
597
|
-
...ScrollFactorSetterMap,
|
|
598
|
-
...TransformSetterMap,
|
|
599
|
-
...VisibleSetterMap,
|
|
600
|
-
fillAlpha: (gameObject) => (value) => {
|
|
601
|
-
gameObject.setFillStyle(gameObject.fillColor, value);
|
|
563
|
+
lineSpacing: (gameObject) => (value) => {
|
|
564
|
+
if (value === void 0) return;
|
|
565
|
+
gameObject.setLineSpacing(value);
|
|
602
566
|
},
|
|
603
|
-
|
|
604
|
-
|
|
567
|
+
maxWidth: (gameObject) => (value) => {
|
|
568
|
+
if (value === void 0) return;
|
|
569
|
+
gameObject.setMaxWidth(value);
|
|
605
570
|
},
|
|
606
|
-
|
|
607
|
-
if (
|
|
608
|
-
gameObject.
|
|
609
|
-
}
|
|
610
|
-
};
|
|
611
|
-
//#endregion
|
|
612
|
-
//#region src/services/setterMap/TriangleSetterMap.ts
|
|
613
|
-
const TriangleSetterMap = {
|
|
614
|
-
to: (gameObject) => (value) => {
|
|
615
|
-
if (!value) return;
|
|
616
|
-
gameObject.setTo(...value);
|
|
571
|
+
text: (gameObject) => (value) => {
|
|
572
|
+
if (value === void 0) return;
|
|
573
|
+
gameObject.setText(value);
|
|
617
574
|
},
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
//#endregion
|
|
622
|
-
//#region src/components/Triangle.vue
|
|
623
|
-
const _sfc_main$24 = /*@__PURE__*/ defineComponent({
|
|
624
|
-
__name: "Triangle",
|
|
625
|
-
props: {
|
|
626
|
-
configuration: {},
|
|
627
|
-
immediate: { type: Boolean },
|
|
628
|
-
onComplete: { type: Function }
|
|
575
|
+
wordWrapCharCode: (gameObject) => (value) => {
|
|
576
|
+
if (value === void 0) return;
|
|
577
|
+
gameObject.wordWrapCharCode = value;
|
|
629
578
|
},
|
|
630
|
-
setup(__props, { emit: __emit }) {
|
|
631
|
-
useInitializeGameObject((scene) => {
|
|
632
|
-
const { alpha, fillColor, to, x, y } = __props.configuration;
|
|
633
|
-
const triangle = scene.add.triangle(x, y, to?.[0], to?.[1], to?.[2], to?.[3], to?.[4], to?.[5], fillColor, alpha);
|
|
634
|
-
__props.onComplete?.(scene, triangle);
|
|
635
|
-
return triangle;
|
|
636
|
-
}, () => __props.configuration, __emit, TriangleSetterMap, __props.immediate);
|
|
637
|
-
return (_ctx, _cache) => {
|
|
638
|
-
return null;
|
|
639
|
-
};
|
|
640
|
-
}
|
|
641
|
-
});
|
|
642
|
-
//#endregion
|
|
643
|
-
//#region src/services/setterMap/components/TextureSetterMap.ts
|
|
644
|
-
const TextureSetterMap = { ...BaseTextureSetterMap };
|
|
645
|
-
//#endregion
|
|
646
|
-
//#region src/services/setterMap/TileSpriteSetterMap.ts
|
|
647
|
-
const TileSpriteSetterMap = {
|
|
648
579
|
...AlphaSetterMap,
|
|
649
580
|
...BlendModeSetterMap,
|
|
650
|
-
...ComputedSizeSetterMap,
|
|
651
581
|
...DepthSetterMap,
|
|
652
|
-
...FlipSetterMap,
|
|
653
582
|
...MaskSetterMap,
|
|
654
583
|
...OriginSetterMap,
|
|
655
584
|
...RenderNodesSetterMap,
|
|
656
585
|
...ScrollFactorSetterMap,
|
|
657
|
-
...TextureSetterMap,
|
|
658
586
|
...TintSetterMap,
|
|
659
587
|
...TransformSetterMap,
|
|
660
588
|
...VisibleSetterMap,
|
|
661
589
|
...GlobalSetterMap
|
|
662
590
|
};
|
|
663
591
|
//#endregion
|
|
664
|
-
//#region src/components/
|
|
665
|
-
const _sfc_main$
|
|
666
|
-
__name: "
|
|
592
|
+
//#region src/components/BitmapText.vue
|
|
593
|
+
const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
594
|
+
__name: "BitmapText",
|
|
667
595
|
props: {
|
|
668
596
|
configuration: {},
|
|
669
597
|
immediate: { type: Boolean },
|
|
@@ -671,131 +599,86 @@ const _sfc_main$22 = /*@__PURE__*/ defineComponent({
|
|
|
671
599
|
},
|
|
672
600
|
setup(__props, { emit: __emit }) {
|
|
673
601
|
useInitializeGameObject((scene) => {
|
|
674
|
-
const {
|
|
675
|
-
const
|
|
676
|
-
__props.onComplete?.(scene,
|
|
677
|
-
return
|
|
678
|
-
}, () => __props.configuration, __emit,
|
|
602
|
+
const { align, font, fontSize, text, x, y } = __props.configuration;
|
|
603
|
+
const bitmapText = scene.add.bitmapText(x ?? 0, y ?? 0, font, text, fontSize, align);
|
|
604
|
+
__props.onComplete?.(scene, bitmapText);
|
|
605
|
+
return bitmapText;
|
|
606
|
+
}, () => __props.configuration, __emit, BitmapTextSetterMap, __props.immediate);
|
|
679
607
|
return (_ctx, _cache) => {
|
|
680
608
|
return null;
|
|
681
609
|
};
|
|
682
610
|
}
|
|
683
611
|
});
|
|
684
612
|
//#endregion
|
|
685
|
-
//#region src/components/
|
|
686
|
-
const _sfc_main$
|
|
687
|
-
__name: "
|
|
613
|
+
//#region src/components/Circle.vue
|
|
614
|
+
const _sfc_main$2 = /*@__PURE__*/ defineComponent({
|
|
615
|
+
__name: "Circle",
|
|
688
616
|
props: {
|
|
689
617
|
configuration: {},
|
|
618
|
+
immediate: { type: Boolean },
|
|
690
619
|
onComplete: { type: Function }
|
|
691
620
|
},
|
|
692
|
-
setup(__props) {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
});
|
|
699
|
-
watch(() => __props.configuration.key, (newKey) => {
|
|
700
|
-
const scene = getScene(sceneKey);
|
|
701
|
-
const oldTilemap = tilemap.value;
|
|
702
|
-
if (newKey) {
|
|
703
|
-
tilemap.value = scene.make.tilemap(__props.configuration);
|
|
704
|
-
__props.onComplete?.(scene, tilemap.value);
|
|
705
|
-
} else tilemap.value = void 0;
|
|
706
|
-
if (oldTilemap) oldTilemap.destroy();
|
|
707
|
-
});
|
|
708
|
-
onUnmounted(() => {
|
|
709
|
-
if (!tilemap.value) return;
|
|
710
|
-
tilemap.value.destroy();
|
|
711
|
-
});
|
|
621
|
+
setup(__props, { emit: __emit }) {
|
|
622
|
+
useInitializeGameObject((scene) => {
|
|
623
|
+
const { alpha, fillColor, radius, x, y } = __props.configuration;
|
|
624
|
+
const circle = scene.add.circle(x, y, radius, fillColor, alpha);
|
|
625
|
+
__props.onComplete?.(scene, circle);
|
|
626
|
+
return circle;
|
|
627
|
+
}, () => __props.configuration, __emit, ArcSetterMap, __props.immediate);
|
|
712
628
|
return (_ctx, _cache) => {
|
|
713
|
-
return
|
|
629
|
+
return null;
|
|
714
630
|
};
|
|
715
631
|
}
|
|
716
632
|
});
|
|
717
633
|
//#endregion
|
|
718
|
-
//#region src/services/setterMap/
|
|
719
|
-
const
|
|
720
|
-
|
|
721
|
-
if (!value) return;
|
|
722
|
-
gameObject.setPadding(value);
|
|
723
|
-
},
|
|
724
|
-
style: (gameObject) => (value) => {
|
|
725
|
-
if (!value) return;
|
|
726
|
-
gameObject.setStyle(value);
|
|
727
|
-
},
|
|
728
|
-
text: (gameObject, emit) => (value) => {
|
|
729
|
-
if (value === void 0) return;
|
|
730
|
-
gameObject.setText(value);
|
|
731
|
-
emit("update:width", gameObject.width);
|
|
732
|
-
emit("update:displayWidth", gameObject.displayWidth);
|
|
733
|
-
},
|
|
734
|
-
...AlphaSetterMap,
|
|
634
|
+
//#region src/services/setterMap/ContainerSetterMap.ts
|
|
635
|
+
const ContainerSetterMap = {
|
|
636
|
+
...AlphaSingleSetterMap,
|
|
735
637
|
...BlendModeSetterMap,
|
|
736
|
-
...ComputedSizeSetterMap,
|
|
737
638
|
...DepthSetterMap,
|
|
738
|
-
...FlipSetterMap,
|
|
739
639
|
...MaskSetterMap,
|
|
740
|
-
...OriginSetterMap,
|
|
741
|
-
...RenderNodesSetterMap,
|
|
742
640
|
...ScrollFactorSetterMap,
|
|
743
|
-
...TintSetterMap,
|
|
744
641
|
...TransformSetterMap,
|
|
745
642
|
...VisibleSetterMap,
|
|
746
643
|
...GlobalSetterMap
|
|
747
644
|
};
|
|
748
645
|
//#endregion
|
|
749
|
-
//#region src/
|
|
750
|
-
const
|
|
751
|
-
|
|
752
|
-
});
|
|
753
|
-
//#endregion
|
|
754
|
-
//#region src/components/Text.vue
|
|
755
|
-
const _sfc_main$21 = /*@__PURE__*/ defineComponent({
|
|
756
|
-
__name: "Text",
|
|
646
|
+
//#region src/components/Container.vue
|
|
647
|
+
const _sfc_main$3 = /*@__PURE__*/ defineComponent({
|
|
648
|
+
__name: "Container",
|
|
757
649
|
props: {
|
|
758
|
-
configuration: {},
|
|
759
|
-
|
|
650
|
+
configuration: { default: () => ({}) },
|
|
651
|
+
onComplete: { type: Function }
|
|
760
652
|
},
|
|
761
653
|
setup(__props, { emit: __emit }) {
|
|
762
654
|
const emit = __emit;
|
|
763
|
-
const
|
|
764
|
-
const { defaultTextStyle } = storeToRefs(textStore);
|
|
655
|
+
const container = shallowRef();
|
|
765
656
|
useInitializeGameObject((scene) => {
|
|
766
|
-
const {
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
657
|
+
const { children, x, y } = __props.configuration;
|
|
658
|
+
container.value = scene.add.container(x, y, children);
|
|
659
|
+
__props.onComplete?.(scene, container.value);
|
|
660
|
+
return container.value;
|
|
661
|
+
}, () => __props.configuration, emit, ContainerSetterMap);
|
|
662
|
+
provide(InjectionKeyMap.ParentContainer, container);
|
|
772
663
|
return (_ctx, _cache) => {
|
|
773
|
-
return
|
|
664
|
+
return renderSlot(_ctx.$slots, "default");
|
|
774
665
|
};
|
|
775
666
|
}
|
|
776
667
|
});
|
|
777
668
|
//#endregion
|
|
778
|
-
//#region src/services/setterMap/
|
|
779
|
-
const
|
|
780
|
-
|
|
781
|
-
if (value === void 0) return;
|
|
782
|
-
gameObject.setInnerRadius(value);
|
|
783
|
-
},
|
|
784
|
-
outerRadius: (gameObject) => (value) => {
|
|
785
|
-
if (value === void 0) return;
|
|
786
|
-
gameObject.setOuterRadius(value);
|
|
787
|
-
},
|
|
788
|
-
points: (gameObject) => (value) => {
|
|
669
|
+
//#region src/services/setterMap/CurveSetterMap.ts
|
|
670
|
+
const CurveSetterMap = {
|
|
671
|
+
smoothness: (gameObject) => (value) => {
|
|
789
672
|
if (value === void 0) return;
|
|
790
|
-
gameObject.
|
|
673
|
+
gameObject.setSmoothness(value);
|
|
791
674
|
},
|
|
792
675
|
...ShapeSetterMap,
|
|
793
676
|
...GlobalSetterMap
|
|
794
677
|
};
|
|
795
678
|
//#endregion
|
|
796
|
-
//#region src/components/
|
|
797
|
-
const _sfc_main$
|
|
798
|
-
__name: "
|
|
679
|
+
//#region src/components/Curve.vue
|
|
680
|
+
const _sfc_main$4 = /*@__PURE__*/ defineComponent({
|
|
681
|
+
__name: "Curve",
|
|
799
682
|
props: {
|
|
800
683
|
configuration: {},
|
|
801
684
|
immediate: { type: Boolean },
|
|
@@ -803,247 +686,276 @@ const _sfc_main$20 = /*@__PURE__*/ defineComponent({
|
|
|
803
686
|
},
|
|
804
687
|
setup(__props, { emit: __emit }) {
|
|
805
688
|
useInitializeGameObject((scene) => {
|
|
806
|
-
const { alpha,
|
|
807
|
-
const
|
|
808
|
-
__props.onComplete?.(scene,
|
|
809
|
-
return
|
|
810
|
-
}, () => __props.configuration, __emit,
|
|
689
|
+
const { alpha, curve, fillColor, x, y } = __props.configuration;
|
|
690
|
+
const curveObject = scene.add.curve(x, y, curve, fillColor, alpha);
|
|
691
|
+
__props.onComplete?.(scene, curveObject);
|
|
692
|
+
return curveObject;
|
|
693
|
+
}, () => __props.configuration, __emit, CurveSetterMap, __props.immediate);
|
|
811
694
|
return (_ctx, _cache) => {
|
|
812
695
|
return null;
|
|
813
696
|
};
|
|
814
697
|
}
|
|
815
698
|
});
|
|
816
699
|
//#endregion
|
|
817
|
-
//#region src/services/setterMap/components/
|
|
818
|
-
const
|
|
700
|
+
//#region src/services/setterMap/components/ComputedSizeSetterMap.ts
|
|
701
|
+
const ComputedSizeSetterMap = {
|
|
702
|
+
...DisplaySizeSetterMap,
|
|
703
|
+
height: (gameObject) => (value) => {
|
|
704
|
+
if (value === void 0) return;
|
|
705
|
+
gameObject.setSize(gameObject.width, value);
|
|
706
|
+
},
|
|
707
|
+
width: (gameObject) => (value) => {
|
|
708
|
+
if (value === void 0) return;
|
|
709
|
+
gameObject.setSize(value, gameObject.height);
|
|
710
|
+
}
|
|
711
|
+
};
|
|
819
712
|
//#endregion
|
|
820
|
-
//#region src/services/setterMap/
|
|
821
|
-
const
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
if (
|
|
825
|
-
|
|
826
|
-
completionListeners.set(gameObject, listeners);
|
|
827
|
-
for (const configuration of configurations) {
|
|
828
|
-
if (!configuration.key) continue;
|
|
829
|
-
const event = `${Animations.Events.ANIMATION_COMPLETE_KEY}${configuration.key}`;
|
|
830
|
-
const previousListener = listeners.get(event);
|
|
831
|
-
if (previousListener) gameObject.off(event, previousListener);
|
|
832
|
-
const listener = () => {
|
|
833
|
-
emit(event);
|
|
834
|
-
};
|
|
835
|
-
listeners.set(event, listener);
|
|
836
|
-
gameObject.once(event, listener);
|
|
837
|
-
if (gameObject.scene.anims.exists(configuration.key)) continue;
|
|
838
|
-
if (!gameObject.scene.anims.create(configuration)) throw new InvalidOperationError(Operation.Create, "Animation", configuration.key);
|
|
839
|
-
}
|
|
713
|
+
//#region src/services/setterMap/EllipseSetterMap.ts
|
|
714
|
+
const EllipseSetterMap = {
|
|
715
|
+
height: ComputedSizeSetterMap.height,
|
|
716
|
+
smoothness: (gameObject) => (value) => {
|
|
717
|
+
if (value === void 0) return;
|
|
718
|
+
gameObject.setSmoothness(value);
|
|
840
719
|
},
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
720
|
+
width: ComputedSizeSetterMap.width,
|
|
721
|
+
...ShapeSetterMap,
|
|
722
|
+
...GlobalSetterMap
|
|
723
|
+
};
|
|
724
|
+
//#endregion
|
|
725
|
+
//#region src/components/Ellipse.vue
|
|
726
|
+
const _sfc_main$5 = /*@__PURE__*/ defineComponent({
|
|
727
|
+
__name: "Ellipse",
|
|
728
|
+
props: {
|
|
729
|
+
configuration: {},
|
|
730
|
+
immediate: { type: Boolean },
|
|
731
|
+
onComplete: { type: Function }
|
|
732
|
+
},
|
|
733
|
+
setup(__props, { emit: __emit }) {
|
|
734
|
+
useInitializeGameObject((scene) => {
|
|
735
|
+
const { alpha, fillColor, height, width, x, y } = __props.configuration;
|
|
736
|
+
const ellipse = scene.add.ellipse(x, y, width, height, fillColor, alpha);
|
|
737
|
+
__props.onComplete?.(scene, ellipse);
|
|
738
|
+
return ellipse;
|
|
739
|
+
}, () => __props.configuration, __emit, EllipseSetterMap, __props.immediate);
|
|
740
|
+
return (_ctx, _cache) => {
|
|
741
|
+
return null;
|
|
742
|
+
};
|
|
743
|
+
}
|
|
744
|
+
});
|
|
745
|
+
//#endregion
|
|
746
|
+
//#region src/models/plugins/TilesetFile.ts
|
|
747
|
+
const XMLFile = Loader.FileTypes.XMLFile;
|
|
748
|
+
var TilesetFile = class extends XMLFile {
|
|
749
|
+
tilesetIndex;
|
|
750
|
+
constructor(tilesetIndex, ...args) {
|
|
751
|
+
super(...args);
|
|
752
|
+
this.tilesetIndex = tilesetIndex;
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
//#endregion
|
|
756
|
+
//#region src/models/plugins/TiledJSONExternalFile.ts
|
|
757
|
+
const GetFastValue = Utils.Objects.GetFastValue;
|
|
758
|
+
const JSONFile$1 = Loader.FileTypes.JSONFile;
|
|
759
|
+
const MultiFile = Loader.MultiFile;
|
|
760
|
+
const PUBLIC_FOLDER = "public";
|
|
761
|
+
var TiledJSONExternalFile = class extends MultiFile {
|
|
762
|
+
constructor(loader, key, tilemapURL, path, baseURL, tilemapXhrSettings, tilesetXhrSettings) {
|
|
763
|
+
if (checkIsPlainObject(key)) {
|
|
764
|
+
const configuration = key;
|
|
765
|
+
key = GetFastValue(configuration, "key");
|
|
766
|
+
tilemapURL = GetFastValue(configuration, "url");
|
|
767
|
+
tilemapXhrSettings = GetFastValue(configuration, "xhrSettings");
|
|
768
|
+
path = GetFastValue(configuration, "path");
|
|
769
|
+
baseURL = GetFastValue(configuration, "baseURL");
|
|
770
|
+
tilesetXhrSettings = GetFastValue(configuration, "tilesetXhrSettings");
|
|
845
771
|
}
|
|
846
|
-
|
|
772
|
+
const tilemapFile = new JSONFile$1(loader, key, tilemapURL, tilemapXhrSettings);
|
|
773
|
+
super(loader, "tilemapJSON", key, [tilemapFile]);
|
|
774
|
+
this.config.path = path;
|
|
775
|
+
this.config.baseURL = baseURL;
|
|
776
|
+
this.config.tilesetXhrSettings = tilesetXhrSettings;
|
|
777
|
+
}
|
|
778
|
+
async addToCache() {
|
|
779
|
+
if (!this.isReadyToProcess()) return;
|
|
780
|
+
const [tilemapFile, ...tilesetFiles] = this.files;
|
|
781
|
+
if (!(tilemapFile.type === "json" && Object.hasOwn(tilemapFile.data, "tilesets"))) return;
|
|
782
|
+
const tilemapData = tilemapFile.data;
|
|
783
|
+
const tilemapKey = tilemapFile.key;
|
|
784
|
+
const loader = this.loader;
|
|
785
|
+
const files = this.files;
|
|
786
|
+
this.complete = true;
|
|
787
|
+
await Promise.all(tilesetFiles.map(async (tilesetFile) => {
|
|
788
|
+
const responseText = tilesetFile.xhrLoader?.responseText;
|
|
789
|
+
if (!responseText) throw new InvalidOperationError(Operation.Read, this.addToCache.name, tilesetFile.key);
|
|
790
|
+
const responseData = await parseXmlString(responseText);
|
|
791
|
+
const tilesetData = parseTileset(responseData.tileset);
|
|
792
|
+
const index = tilesetFile.tilesetIndex;
|
|
793
|
+
Object.assign(tilemapData.tilesets[index], tilesetData, {
|
|
794
|
+
imageheight: tilesetData.image.height,
|
|
795
|
+
imagewidth: tilesetData.image.width,
|
|
796
|
+
source: void 0
|
|
797
|
+
});
|
|
798
|
+
}));
|
|
799
|
+
loader.cacheManager.tilemap.add(tilemapKey, {
|
|
800
|
+
data: tilemapData,
|
|
801
|
+
format: Tilemaps.Formats.TILED_JSON
|
|
802
|
+
});
|
|
803
|
+
for (const file of files) file.pendingDestroy();
|
|
804
|
+
}
|
|
805
|
+
onFileComplete(file) {
|
|
806
|
+
if (this.files.indexOf(file) === -1) return;
|
|
807
|
+
this.pending--;
|
|
808
|
+
if (!(file.type === "json" && Object.hasOwn(file.data, "tilesets"))) return;
|
|
809
|
+
const tilesets = file.data.tilesets;
|
|
810
|
+
const config = this.config;
|
|
811
|
+
const loader = this.loader;
|
|
812
|
+
const currentBaseURL = loader.baseURL;
|
|
813
|
+
const currentPath = loader.path;
|
|
814
|
+
const currentPrefix = loader.prefix;
|
|
815
|
+
const baseURL = GetFastValue(config, "baseURL", currentBaseURL);
|
|
816
|
+
const path = GetFastValue(config, "path", currentPath);
|
|
817
|
+
const prefix = GetFastValue(config, "prefix", currentPrefix);
|
|
818
|
+
const tilesetXhrSettings = GetFastValue(config, "tilesetXhrSettings");
|
|
819
|
+
loader.setBaseURL(baseURL);
|
|
820
|
+
loader.setPath(path);
|
|
821
|
+
loader.setPrefix(prefix);
|
|
822
|
+
for (const [tilesetIndex, tileset] of tilesets.entries()) {
|
|
823
|
+
const pathIndex = tileset.source.indexOf(PUBLIC_FOLDER);
|
|
824
|
+
if (pathIndex === -1) throw new NotFoundError(this.onFileComplete.name, tileset.source);
|
|
825
|
+
const relativePath = tileset.source.slice(pathIndex + 6);
|
|
826
|
+
const tilesetFile = new TilesetFile(tilesetIndex, loader, `${file.key}${ID_SEPARATOR}Tileset${ID_SEPARATOR}${relativePath}`, relativePath, tilesetXhrSettings);
|
|
827
|
+
this.addToMultiFile(tilesetFile);
|
|
828
|
+
loader.addFile(tilesetFile);
|
|
829
|
+
}
|
|
830
|
+
loader.setBaseURL(currentBaseURL);
|
|
831
|
+
loader.setPath(currentPath);
|
|
832
|
+
loader.setPrefix(currentPrefix);
|
|
847
833
|
}
|
|
848
834
|
};
|
|
849
835
|
//#endregion
|
|
850
|
-
//#region src/services/
|
|
851
|
-
const
|
|
852
|
-
|
|
836
|
+
//#region src/services/shared/constants.ts
|
|
837
|
+
const TILEMAP_TILED_JSON_EXTERNAL_KEY = "tilemapTiledJSONExternal";
|
|
838
|
+
//#endregion
|
|
839
|
+
//#region src/plugins/registerTiledJSONExternalLoader.ts
|
|
840
|
+
const FileTypesManager = Loader.FileTypesManager;
|
|
841
|
+
const registerTiledJSONExternalLoader = () => {
|
|
842
|
+
FileTypesManager.register(TILEMAP_TILED_JSON_EXTERNAL_KEY, function(...[key, tilemapURL, path, baseURL, tilemapXhrSettings, tilesetXhrSettings]) {
|
|
843
|
+
if (Array.isArray(key)) for (const keyElement of key) {
|
|
844
|
+
const multifile = new TiledJSONExternalFile(this, keyElement);
|
|
845
|
+
this.addFile(multifile.files);
|
|
846
|
+
}
|
|
847
|
+
else {
|
|
848
|
+
const multifile = new TiledJSONExternalFile(this, key, tilemapURL, path, baseURL, tilemapXhrSettings, tilesetXhrSettings);
|
|
849
|
+
this.addFile(multifile.files);
|
|
850
|
+
}
|
|
851
|
+
return this;
|
|
852
|
+
});
|
|
853
|
+
};
|
|
854
|
+
//#endregion
|
|
855
|
+
//#region src/components/Game.vue
|
|
856
|
+
const _sfc_main$6 = /*@__PURE__*/ defineComponent({
|
|
857
|
+
__name: "Game",
|
|
858
|
+
props: { configuration: {} },
|
|
859
|
+
setup(__props) {
|
|
860
|
+
const phaserStore = usePhaserStore();
|
|
861
|
+
const { game: storeGame } = storeToRefs(phaserStore);
|
|
862
|
+
const canvasRoot = useTemplateRef("canvasRoot");
|
|
863
|
+
const isReady = ref(false);
|
|
864
|
+
const readyListener = () => {
|
|
865
|
+
isReady.value = true;
|
|
866
|
+
};
|
|
867
|
+
onMounted(() => {
|
|
868
|
+
registerTiledJSONExternalLoader();
|
|
869
|
+
storeGame.value = new Game({
|
|
870
|
+
...__props.configuration,
|
|
871
|
+
parent: canvasRoot.value
|
|
872
|
+
});
|
|
873
|
+
storeGame.value.events.on(Core.Events.READY, readyListener);
|
|
874
|
+
});
|
|
875
|
+
onUnmounted(() => {
|
|
876
|
+
const game = useGame();
|
|
877
|
+
game.events.off(Core.Events.READY, readyListener);
|
|
878
|
+
game.destroy(true);
|
|
879
|
+
storeGame.value = void 0;
|
|
880
|
+
});
|
|
881
|
+
return (_ctx, _cache) => {
|
|
882
|
+
return openBlock(), createElementBlock(Fragment, null, [createElementVNode("div", {
|
|
883
|
+
ref_key: "canvasRoot",
|
|
884
|
+
ref: canvasRoot
|
|
885
|
+
}, null, 512), isReady.value ? renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 0) : createCommentVNode("v-if", true)], 64);
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
});
|
|
889
|
+
//#endregion
|
|
890
|
+
//#region src/services/setterMap/GraphicsSetterMap.ts
|
|
891
|
+
const GraphicsSetterMap = {
|
|
892
|
+
...AlphaSingleSetterMap,
|
|
853
893
|
...BlendModeSetterMap,
|
|
854
894
|
...DepthSetterMap,
|
|
855
|
-
...FlipSetterMap,
|
|
856
895
|
...MaskSetterMap,
|
|
857
|
-
...OriginSetterMap,
|
|
858
896
|
...RenderNodesSetterMap,
|
|
859
897
|
...ScrollFactorSetterMap,
|
|
860
|
-
...SizeSetterMap,
|
|
861
|
-
...TextureSetterMap,
|
|
862
|
-
...TintSetterMap,
|
|
863
898
|
...TransformSetterMap,
|
|
864
899
|
...VisibleSetterMap,
|
|
865
|
-
...AnimationSetterMap,
|
|
866
900
|
...GlobalSetterMap
|
|
867
901
|
};
|
|
868
902
|
//#endregion
|
|
869
|
-
//#region src/components/
|
|
870
|
-
const _sfc_main$
|
|
871
|
-
__name: "
|
|
903
|
+
//#region src/components/Graphics.vue
|
|
904
|
+
const _sfc_main$7 = /*@__PURE__*/ defineComponent({
|
|
905
|
+
__name: "Graphics",
|
|
872
906
|
props: {
|
|
873
|
-
configuration: {},
|
|
907
|
+
configuration: { default: () => ({}) },
|
|
874
908
|
immediate: { type: Boolean },
|
|
875
909
|
onComplete: { type: Function }
|
|
876
910
|
},
|
|
877
911
|
setup(__props, { emit: __emit }) {
|
|
878
912
|
useInitializeGameObject((scene) => {
|
|
879
|
-
const {
|
|
880
|
-
const
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
913
|
+
const { x, y } = __props.configuration;
|
|
914
|
+
const graphics = scene.add.graphics({
|
|
915
|
+
x,
|
|
916
|
+
y
|
|
917
|
+
});
|
|
918
|
+
__props.onComplete?.(scene, graphics);
|
|
919
|
+
return graphics;
|
|
920
|
+
}, () => __props.configuration, __emit, GraphicsSetterMap, __props.immediate);
|
|
884
921
|
return (_ctx, _cache) => {
|
|
885
922
|
return null;
|
|
886
923
|
};
|
|
887
924
|
}
|
|
888
925
|
});
|
|
889
926
|
//#endregion
|
|
890
|
-
//#region src/services/
|
|
891
|
-
const
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
927
|
+
//#region src/services/setterMap/components/FlipSetterMap.ts
|
|
928
|
+
const FlipSetterMap = {
|
|
929
|
+
flipX: (gameObject) => (value) => {
|
|
930
|
+
if (value === void 0) return;
|
|
931
|
+
gameObject.setFlipX(value);
|
|
932
|
+
},
|
|
933
|
+
flipY: (gameObject) => (value) => {
|
|
934
|
+
if (value === void 0) return;
|
|
935
|
+
gameObject.setFlipY(value);
|
|
936
|
+
}
|
|
895
937
|
};
|
|
896
938
|
//#endregion
|
|
897
|
-
//#region src/services/
|
|
898
|
-
const
|
|
899
|
-
const listenersMap = ExternalSceneStore.lifecycleListenersMap.get(lifecycle);
|
|
900
|
-
if (!listenersMap) return;
|
|
901
|
-
const listeners = listenersMap.get(scene.scene.key);
|
|
902
|
-
if (!listeners) return;
|
|
903
|
-
for (const listener of listeners) listener(scene);
|
|
904
|
-
if (isReset) resetLifecycleListeners(scene, lifecycle);
|
|
905
|
-
};
|
|
939
|
+
//#region src/services/setterMap/components/SizeSetterMap.ts
|
|
940
|
+
const SizeSetterMap = { ...ComputedSizeSetterMap };
|
|
906
941
|
//#endregion
|
|
907
|
-
//#region src/services/
|
|
908
|
-
const
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
const createSceneClass = (key, hooks = {}) => class extends Scene {
|
|
917
|
-
constructor() {
|
|
918
|
-
super({ key });
|
|
919
|
-
}
|
|
920
|
-
create() {
|
|
921
|
-
hooks.onCreate?.(this);
|
|
922
|
-
runLifecycleListeners(this, "Create");
|
|
923
|
-
}
|
|
924
|
-
init() {
|
|
925
|
-
hooks.onInit?.(this);
|
|
926
|
-
runLifecycleListeners(this, "Init");
|
|
927
|
-
}
|
|
928
|
-
preload() {
|
|
929
|
-
hooks.onPreload?.(this);
|
|
930
|
-
runLifecycleListeners(this, "Preload");
|
|
931
|
-
}
|
|
932
|
-
update(time, delta) {
|
|
933
|
-
hooks.onUpdate?.(this, time, delta);
|
|
934
|
-
runLifecycleListeners(this, "Update", false);
|
|
935
|
-
runLifecycleListeners(this, "NextTick");
|
|
942
|
+
//#region src/services/setterMap/components/BaseTextureSetterMap.ts
|
|
943
|
+
const BaseTextureSetterMap = {
|
|
944
|
+
frame: (gameObject) => (value) => {
|
|
945
|
+
if (value === void 0) return;
|
|
946
|
+
gameObject.setFrame(value);
|
|
947
|
+
},
|
|
948
|
+
texture: (gameObject) => (value) => {
|
|
949
|
+
if (!value) return;
|
|
950
|
+
gameObject.setTexture(value);
|
|
936
951
|
}
|
|
937
952
|
};
|
|
938
953
|
//#endregion
|
|
939
|
-
//#region src/
|
|
940
|
-
const
|
|
941
|
-
const isFading = ref(false);
|
|
942
|
-
const fadeIn = (scene, ...args) => {
|
|
943
|
-
isFading.value = true;
|
|
944
|
-
scene.cameras.main.fadeIn(...args);
|
|
945
|
-
};
|
|
946
|
-
const fadeOut = (scene, ...args) => {
|
|
947
|
-
isFading.value = true;
|
|
948
|
-
scene.cameras.main.fadeOut(...args);
|
|
949
|
-
};
|
|
950
|
-
return {
|
|
951
|
-
fadeIn,
|
|
952
|
-
fadeOut,
|
|
953
|
-
isFading
|
|
954
|
-
};
|
|
955
|
-
});
|
|
956
|
-
//#endregion
|
|
957
|
-
//#region src/store/input.ts
|
|
958
|
-
const useInputStore = defineStore("phaser/input", () => {
|
|
959
|
-
return { isInputActive: ref(false) };
|
|
960
|
-
});
|
|
961
|
-
//#endregion
|
|
962
|
-
//#region src/components/Scene.vue
|
|
963
|
-
const _sfc_main$18 = /*@__PURE__*/ defineComponent({
|
|
964
|
-
__name: "Scene",
|
|
965
|
-
props: {
|
|
966
|
-
autoStart: { type: Boolean },
|
|
967
|
-
sceneKey: {}
|
|
968
|
-
},
|
|
969
|
-
emits: [
|
|
970
|
-
"create",
|
|
971
|
-
"init",
|
|
972
|
-
"preload",
|
|
973
|
-
"shutdown",
|
|
974
|
-
"update"
|
|
975
|
-
],
|
|
976
|
-
setup(__props, { emit: __emit }) {
|
|
977
|
-
const emit = __emit;
|
|
978
|
-
const phaserStore = usePhaserStore();
|
|
979
|
-
const { isSameScene, switchToScene } = phaserStore;
|
|
980
|
-
const cameraStore = useCameraStore();
|
|
981
|
-
const { isFading } = storeToRefs(cameraStore);
|
|
982
|
-
const inputStore = useInputStore();
|
|
983
|
-
const { isInputActive } = storeToRefs(inputStore);
|
|
984
|
-
const { parallelSceneKeys } = storeToRefs(phaserStore);
|
|
985
|
-
const isActive = computed(() => isSameScene(__props.sceneKey) || parallelSceneKeys.value.includes(__props.sceneKey));
|
|
986
|
-
const fadeStartListener = () => {
|
|
987
|
-
isInputActive.value = false;
|
|
988
|
-
};
|
|
989
|
-
const fadeInCompleteListener = () => {
|
|
990
|
-
isFading.value = false;
|
|
991
|
-
isInputActive.value = true;
|
|
992
|
-
};
|
|
993
|
-
const fadeOutCompleteListener = () => {
|
|
994
|
-
isFading.value = false;
|
|
995
|
-
};
|
|
996
|
-
const cameraFadeListeners = [
|
|
997
|
-
[Cameras.Scene2D.Events.FADE_IN_START, fadeStartListener],
|
|
998
|
-
[Cameras.Scene2D.Events.FADE_IN_COMPLETE, fadeInCompleteListener],
|
|
999
|
-
[Cameras.Scene2D.Events.FADE_OUT_START, fadeStartListener],
|
|
1000
|
-
[Cameras.Scene2D.Events.FADE_OUT_COMPLETE, fadeOutCompleteListener]
|
|
1001
|
-
];
|
|
1002
|
-
const NewScene = createSceneClass(__props.sceneKey, {
|
|
1003
|
-
onCreate: (scene) => {
|
|
1004
|
-
emit("create", scene);
|
|
1005
|
-
for (const [event, listener] of cameraFadeListeners) scene.cameras.main.on(event, listener);
|
|
1006
|
-
isInputActive.value = true;
|
|
1007
|
-
},
|
|
1008
|
-
onInit: (scene) => emit("init", scene),
|
|
1009
|
-
onPreload: (scene) => emit("preload", scene),
|
|
1010
|
-
onUpdate: (scene, time, delta) => emit("update", scene, time, delta)
|
|
1011
|
-
});
|
|
1012
|
-
const readyListener = () => {
|
|
1013
|
-
ExternalSceneStore.sceneReadyMap.set(__props.sceneKey, true);
|
|
1014
|
-
};
|
|
1015
|
-
const shutdownListener = () => {
|
|
1016
|
-
const scene = getScene(__props.sceneKey);
|
|
1017
|
-
runSceneShutdown(scene);
|
|
1018
|
-
for (const [event, listener] of cameraFadeListeners) scene.cameras.main.off(event, listener);
|
|
1019
|
-
emit("shutdown", scene);
|
|
1020
|
-
};
|
|
1021
|
-
onMounted(async () => {
|
|
1022
|
-
const scene = useGame().scene.add(__props.sceneKey, NewScene);
|
|
1023
|
-
if (!scene) {
|
|
1024
|
-
console.error(`Failed to add scene: ${__props.sceneKey}`);
|
|
1025
|
-
return;
|
|
1026
|
-
}
|
|
1027
|
-
scene.events.on(Scenes.Events.READY, readyListener);
|
|
1028
|
-
scene.events.on(Scenes.Events.SHUTDOWN, shutdownListener);
|
|
1029
|
-
if (__props.autoStart) await switchToScene(__props.sceneKey);
|
|
1030
|
-
});
|
|
1031
|
-
onUnmounted(() => {
|
|
1032
|
-
const game = useGame();
|
|
1033
|
-
const scene = getScene(__props.sceneKey);
|
|
1034
|
-
scene.events.off(Scenes.Events.READY, readyListener);
|
|
1035
|
-
scene.events.off(Scenes.Events.SHUTDOWN, shutdownListener);
|
|
1036
|
-
game.scene.remove(__props.sceneKey);
|
|
1037
|
-
});
|
|
1038
|
-
provide(InjectionKeyMap.SceneKey, __props.sceneKey);
|
|
1039
|
-
return (_ctx, _cache) => {
|
|
1040
|
-
return isActive.value ? renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 0) : createCommentVNode("v-if", true);
|
|
1041
|
-
};
|
|
1042
|
-
}
|
|
1043
|
-
});
|
|
954
|
+
//#region src/services/setterMap/components/TextureCropSetterMap.ts
|
|
955
|
+
const TextureCropSetterMap = { ...BaseTextureSetterMap };
|
|
1044
956
|
//#endregion
|
|
1045
|
-
//#region src/services/setterMap/
|
|
1046
|
-
const
|
|
957
|
+
//#region src/services/setterMap/ImageSetterMap.ts
|
|
958
|
+
const ImageSetterMap = {
|
|
1047
959
|
...AlphaSetterMap,
|
|
1048
960
|
...BlendModeSetterMap,
|
|
1049
961
|
...DepthSetterMap,
|
|
@@ -1053,44 +965,75 @@ const RenderTextureSetterMap = {
|
|
|
1053
965
|
...RenderNodesSetterMap,
|
|
1054
966
|
...ScrollFactorSetterMap,
|
|
1055
967
|
...SizeSetterMap,
|
|
968
|
+
...TextureCropSetterMap,
|
|
1056
969
|
...TintSetterMap,
|
|
1057
970
|
...TransformSetterMap,
|
|
1058
971
|
...VisibleSetterMap,
|
|
1059
972
|
...GlobalSetterMap
|
|
1060
973
|
};
|
|
1061
974
|
//#endregion
|
|
1062
|
-
//#region src/components/
|
|
1063
|
-
const _sfc_main$
|
|
1064
|
-
__name: "
|
|
975
|
+
//#region src/components/Image.vue
|
|
976
|
+
const _sfc_main$8 = /*@__PURE__*/ defineComponent({
|
|
977
|
+
__name: "Image",
|
|
1065
978
|
props: {
|
|
1066
979
|
configuration: {},
|
|
1067
|
-
immediate: { type: Boolean },
|
|
1068
980
|
onComplete: { type: Function }
|
|
1069
981
|
},
|
|
1070
982
|
setup(__props, { emit: __emit }) {
|
|
1071
983
|
useInitializeGameObject((scene) => {
|
|
1072
|
-
const {
|
|
1073
|
-
const
|
|
1074
|
-
__props.onComplete?.(scene,
|
|
1075
|
-
return
|
|
1076
|
-
}, () => __props.configuration, __emit,
|
|
984
|
+
const { frame, texture, x, y } = __props.configuration;
|
|
985
|
+
const image = scene.add.image(x ?? 0, y ?? 0, texture, frame);
|
|
986
|
+
__props.onComplete?.(scene, image);
|
|
987
|
+
return image;
|
|
988
|
+
}, () => __props.configuration, __emit, ImageSetterMap);
|
|
1077
989
|
return (_ctx, _cache) => {
|
|
1078
990
|
return null;
|
|
1079
991
|
};
|
|
1080
992
|
}
|
|
1081
993
|
});
|
|
1082
994
|
//#endregion
|
|
1083
|
-
//#region src/services/setterMap/
|
|
1084
|
-
const
|
|
1085
|
-
|
|
1086
|
-
|
|
995
|
+
//#region src/services/setterMap/shared/IsoSetterMap.ts
|
|
996
|
+
const IsoSetterMap = {
|
|
997
|
+
fillLeft: (gameObject) => (value) => {
|
|
998
|
+
if (value === void 0) return;
|
|
999
|
+
gameObject.setFillStyle(gameObject.fillTop, value, gameObject.fillRight);
|
|
1000
|
+
},
|
|
1001
|
+
fillRight: (gameObject) => (value) => {
|
|
1002
|
+
if (value === void 0) return;
|
|
1003
|
+
gameObject.setFillStyle(gameObject.fillTop, gameObject.fillLeft, value);
|
|
1004
|
+
},
|
|
1005
|
+
fillTop: (gameObject) => (value) => {
|
|
1006
|
+
if (value === void 0) return;
|
|
1007
|
+
gameObject.setFillStyle(value, gameObject.fillLeft, gameObject.fillRight);
|
|
1008
|
+
},
|
|
1009
|
+
projection: (gameObject) => (value) => {
|
|
1010
|
+
if (value === void 0) return;
|
|
1011
|
+
gameObject.setProjection(value);
|
|
1012
|
+
},
|
|
1013
|
+
showLeft: (gameObject) => (value) => {
|
|
1014
|
+
if (value === void 0) return;
|
|
1015
|
+
gameObject.setFaces(gameObject.showTop, value, gameObject.showRight);
|
|
1016
|
+
},
|
|
1017
|
+
showRight: (gameObject) => (value) => {
|
|
1018
|
+
if (value === void 0) return;
|
|
1019
|
+
gameObject.setFaces(gameObject.showTop, gameObject.showLeft, value);
|
|
1020
|
+
},
|
|
1021
|
+
showTop: (gameObject) => (value) => {
|
|
1022
|
+
if (value === void 0) return;
|
|
1023
|
+
gameObject.setFaces(value, gameObject.showLeft, gameObject.showRight);
|
|
1024
|
+
}
|
|
1025
|
+
};
|
|
1026
|
+
//#endregion
|
|
1027
|
+
//#region src/services/setterMap/IsoBoxSetterMap.ts
|
|
1028
|
+
const IsoBoxSetterMap = {
|
|
1029
|
+
...IsoSetterMap,
|
|
1087
1030
|
...ShapeSetterMap,
|
|
1088
1031
|
...GlobalSetterMap
|
|
1089
1032
|
};
|
|
1090
1033
|
//#endregion
|
|
1091
|
-
//#region src/components/
|
|
1092
|
-
const _sfc_main$
|
|
1093
|
-
__name: "
|
|
1034
|
+
//#region src/components/IsoBox.vue
|
|
1035
|
+
const _sfc_main$9 = /*@__PURE__*/ defineComponent({
|
|
1036
|
+
__name: "IsoBox",
|
|
1094
1037
|
props: {
|
|
1095
1038
|
configuration: {},
|
|
1096
1039
|
immediate: { type: Boolean },
|
|
@@ -1098,30 +1041,31 @@ const _sfc_main$16 = /*@__PURE__*/ defineComponent({
|
|
|
1098
1041
|
},
|
|
1099
1042
|
setup(__props, { emit: __emit }) {
|
|
1100
1043
|
useInitializeGameObject((scene) => {
|
|
1101
|
-
const {
|
|
1102
|
-
const
|
|
1103
|
-
__props.onComplete?.(scene,
|
|
1104
|
-
return
|
|
1105
|
-
}, () => __props.configuration, __emit,
|
|
1044
|
+
const { fillLeft, fillRight, fillTop, height, size, x, y } = __props.configuration;
|
|
1045
|
+
const isoBox = scene.add.isobox(x, y, size, height, fillTop, fillLeft, fillRight);
|
|
1046
|
+
__props.onComplete?.(scene, isoBox);
|
|
1047
|
+
return isoBox;
|
|
1048
|
+
}, () => __props.configuration, __emit, IsoBoxSetterMap, __props.immediate);
|
|
1106
1049
|
return (_ctx, _cache) => {
|
|
1107
1050
|
return null;
|
|
1108
1051
|
};
|
|
1109
1052
|
}
|
|
1110
1053
|
});
|
|
1111
1054
|
//#endregion
|
|
1112
|
-
//#region src/services/setterMap/
|
|
1113
|
-
const
|
|
1114
|
-
|
|
1115
|
-
if (
|
|
1116
|
-
gameObject.
|
|
1055
|
+
//#region src/services/setterMap/IsoTriangleSetterMap.ts
|
|
1056
|
+
const IsoTriangleSetterMap = {
|
|
1057
|
+
isReversed: (gameObject) => (value) => {
|
|
1058
|
+
if (value === void 0) return;
|
|
1059
|
+
gameObject.setReversed(value);
|
|
1117
1060
|
},
|
|
1061
|
+
...IsoSetterMap,
|
|
1118
1062
|
...ShapeSetterMap,
|
|
1119
1063
|
...GlobalSetterMap
|
|
1120
1064
|
};
|
|
1121
1065
|
//#endregion
|
|
1122
|
-
//#region src/components/
|
|
1123
|
-
const _sfc_main$
|
|
1124
|
-
__name: "
|
|
1066
|
+
//#region src/components/IsoTriangle.vue
|
|
1067
|
+
const _sfc_main$10 = /*@__PURE__*/ defineComponent({
|
|
1068
|
+
__name: "IsoTriangle",
|
|
1125
1069
|
props: {
|
|
1126
1070
|
configuration: {},
|
|
1127
1071
|
immediate: { type: Boolean },
|
|
@@ -1129,56 +1073,87 @@ const _sfc_main$15 = /*@__PURE__*/ defineComponent({
|
|
|
1129
1073
|
},
|
|
1130
1074
|
setup(__props, { emit: __emit }) {
|
|
1131
1075
|
useInitializeGameObject((scene) => {
|
|
1132
|
-
const {
|
|
1133
|
-
const
|
|
1134
|
-
__props.onComplete?.(scene,
|
|
1135
|
-
return
|
|
1136
|
-
}, () => __props.configuration, __emit,
|
|
1076
|
+
const { fillLeft, fillRight, fillTop, height, isReversed, size, x, y } = __props.configuration;
|
|
1077
|
+
const isoTriangle = scene.add.isotriangle(x, y, size, height, isReversed, fillTop, fillLeft, fillRight);
|
|
1078
|
+
__props.onComplete?.(scene, isoTriangle);
|
|
1079
|
+
return isoTriangle;
|
|
1080
|
+
}, () => __props.configuration, __emit, IsoTriangleSetterMap, __props.immediate);
|
|
1137
1081
|
return (_ctx, _cache) => {
|
|
1138
1082
|
return null;
|
|
1139
1083
|
};
|
|
1140
1084
|
}
|
|
1141
1085
|
});
|
|
1142
1086
|
//#endregion
|
|
1143
|
-
//#region src/services/setterMap/
|
|
1144
|
-
const
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1087
|
+
//#region src/services/setterMap/LineSetterMap.ts
|
|
1088
|
+
const LineSetterMap = {
|
|
1089
|
+
lineWidth: (gameObject) => (value) => {
|
|
1090
|
+
if (value === void 0) return;
|
|
1091
|
+
gameObject.setLineWidth(value);
|
|
1092
|
+
},
|
|
1093
|
+
to: (gameObject) => (value) => {
|
|
1094
|
+
if (!value) return;
|
|
1095
|
+
gameObject.setTo(...value);
|
|
1096
|
+
},
|
|
1097
|
+
...ShapeSetterMap,
|
|
1098
|
+
...GlobalSetterMap
|
|
1099
|
+
};
|
|
1100
|
+
//#endregion
|
|
1101
|
+
//#region src/components/Line.vue
|
|
1102
|
+
const _sfc_main$11 = /*@__PURE__*/ defineComponent({
|
|
1103
|
+
__name: "Line",
|
|
1104
|
+
props: {
|
|
1105
|
+
configuration: {},
|
|
1106
|
+
immediate: { type: Boolean },
|
|
1107
|
+
onComplete: { type: Function }
|
|
1108
|
+
},
|
|
1109
|
+
setup(__props, { emit: __emit }) {
|
|
1110
|
+
useInitializeGameObject((scene) => {
|
|
1111
|
+
const { to, x, y } = __props.configuration;
|
|
1112
|
+
const line = scene.add.line(x, y, to?.[0], to?.[1], to?.[2], to?.[3]);
|
|
1113
|
+
__props.onComplete?.(scene, line);
|
|
1114
|
+
return line;
|
|
1115
|
+
}, () => __props.configuration, __emit, LineSetterMap, __props.immediate);
|
|
1116
|
+
return (_ctx, _cache) => {
|
|
1117
|
+
return null;
|
|
1118
|
+
};
|
|
1119
|
+
}
|
|
1120
|
+
});
|
|
1121
|
+
//#endregion
|
|
1122
|
+
//#region src/services/setterMap/components/TextureSetterMap.ts
|
|
1123
|
+
const TextureSetterMap = { ...BaseTextureSetterMap };
|
|
1124
|
+
//#endregion
|
|
1125
|
+
//#region src/services/setterMap/NinesliceSetterMap.ts
|
|
1126
|
+
const NinesliceSetterMap = {
|
|
1127
|
+
height: ComputedSizeSetterMap.height,
|
|
1128
|
+
width: ComputedSizeSetterMap.width,
|
|
1129
|
+
...AlphaSingleSetterMap,
|
|
1152
1130
|
...BlendModeSetterMap,
|
|
1153
1131
|
...DepthSetterMap,
|
|
1154
|
-
...FlipSetterMap,
|
|
1155
1132
|
...MaskSetterMap,
|
|
1156
1133
|
...OriginSetterMap,
|
|
1157
|
-
...PathFollowerComponentSetterMap,
|
|
1158
1134
|
...RenderNodesSetterMap,
|
|
1159
1135
|
...ScrollFactorSetterMap,
|
|
1160
|
-
...SizeSetterMap,
|
|
1161
1136
|
...TextureSetterMap,
|
|
1162
|
-
...TintSetterMap,
|
|
1163
1137
|
...TransformSetterMap,
|
|
1164
1138
|
...VisibleSetterMap,
|
|
1165
1139
|
...GlobalSetterMap
|
|
1166
1140
|
};
|
|
1167
1141
|
//#endregion
|
|
1168
|
-
//#region src/components/
|
|
1169
|
-
const _sfc_main$
|
|
1170
|
-
__name: "
|
|
1142
|
+
//#region src/components/Nineslice.vue
|
|
1143
|
+
const _sfc_main$12 = /*@__PURE__*/ defineComponent({
|
|
1144
|
+
__name: "Nineslice",
|
|
1171
1145
|
props: {
|
|
1172
1146
|
configuration: {},
|
|
1147
|
+
immediate: { type: Boolean },
|
|
1173
1148
|
onComplete: { type: Function }
|
|
1174
1149
|
},
|
|
1175
1150
|
setup(__props, { emit: __emit }) {
|
|
1176
1151
|
useInitializeGameObject((scene) => {
|
|
1177
|
-
const { frame,
|
|
1178
|
-
const
|
|
1179
|
-
__props.onComplete?.(scene,
|
|
1180
|
-
return
|
|
1181
|
-
}, () => __props.configuration, __emit,
|
|
1152
|
+
const { bottomHeight, frame, height, leftWidth, rightWidth, texture, topHeight, width, x, y } = __props.configuration;
|
|
1153
|
+
const nineSlice = scene.add.nineslice(x ?? 0, y ?? 0, texture, frame, width, height, leftWidth, rightWidth, topHeight, bottomHeight);
|
|
1154
|
+
__props.onComplete?.(scene, nineSlice);
|
|
1155
|
+
return nineSlice;
|
|
1156
|
+
}, () => __props.configuration, __emit, NinesliceSetterMap, __props.immediate);
|
|
1182
1157
|
return (_ctx, _cache) => {
|
|
1183
1158
|
return null;
|
|
1184
1159
|
};
|
|
@@ -1224,61 +1199,64 @@ const _sfc_main$13 = /*@__PURE__*/ defineComponent({
|
|
|
1224
1199
|
}
|
|
1225
1200
|
});
|
|
1226
1201
|
//#endregion
|
|
1227
|
-
//#region src/services/setterMap/
|
|
1228
|
-
const
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1202
|
+
//#region src/services/setterMap/components/PathFollowerComponentSetterMap.ts
|
|
1203
|
+
const PathFollowerComponentSetterMap = { path: (gameObject) => (value) => {
|
|
1204
|
+
if (!value) return;
|
|
1205
|
+
gameObject.setPath(value);
|
|
1206
|
+
} };
|
|
1207
|
+
//#endregion
|
|
1208
|
+
//#region src/services/setterMap/PathFollowerSetterMap.ts
|
|
1209
|
+
const PathFollowerSetterMap = {
|
|
1210
|
+
...AlphaSetterMap,
|
|
1232
1211
|
...BlendModeSetterMap,
|
|
1233
1212
|
...DepthSetterMap,
|
|
1213
|
+
...FlipSetterMap,
|
|
1234
1214
|
...MaskSetterMap,
|
|
1235
1215
|
...OriginSetterMap,
|
|
1216
|
+
...PathFollowerComponentSetterMap,
|
|
1236
1217
|
...RenderNodesSetterMap,
|
|
1237
1218
|
...ScrollFactorSetterMap,
|
|
1219
|
+
...SizeSetterMap,
|
|
1238
1220
|
...TextureSetterMap,
|
|
1221
|
+
...TintSetterMap,
|
|
1239
1222
|
...TransformSetterMap,
|
|
1240
1223
|
...VisibleSetterMap,
|
|
1241
1224
|
...GlobalSetterMap
|
|
1242
1225
|
};
|
|
1243
1226
|
//#endregion
|
|
1244
|
-
//#region src/components/
|
|
1245
|
-
const _sfc_main$
|
|
1246
|
-
__name: "
|
|
1227
|
+
//#region src/components/PathFollower.vue
|
|
1228
|
+
const _sfc_main$14 = /*@__PURE__*/ defineComponent({
|
|
1229
|
+
__name: "PathFollower",
|
|
1247
1230
|
props: {
|
|
1248
1231
|
configuration: {},
|
|
1249
|
-
immediate: { type: Boolean },
|
|
1250
1232
|
onComplete: { type: Function }
|
|
1251
1233
|
},
|
|
1252
1234
|
setup(__props, { emit: __emit }) {
|
|
1253
1235
|
useInitializeGameObject((scene) => {
|
|
1254
|
-
const {
|
|
1255
|
-
const
|
|
1256
|
-
__props.onComplete?.(scene,
|
|
1257
|
-
return
|
|
1258
|
-
}, () => __props.configuration, __emit,
|
|
1236
|
+
const { frame, path, texture, x, y } = __props.configuration;
|
|
1237
|
+
const pathFollower = scene.add.follower(path, x ?? 0, y ?? 0, texture, frame);
|
|
1238
|
+
__props.onComplete?.(scene, pathFollower);
|
|
1239
|
+
return pathFollower;
|
|
1240
|
+
}, () => __props.configuration, __emit, PathFollowerSetterMap);
|
|
1259
1241
|
return (_ctx, _cache) => {
|
|
1260
1242
|
return null;
|
|
1261
1243
|
};
|
|
1262
1244
|
}
|
|
1263
1245
|
});
|
|
1264
1246
|
//#endregion
|
|
1265
|
-
//#region src/services/setterMap/
|
|
1266
|
-
const
|
|
1267
|
-
|
|
1268
|
-
if (value === void 0) return;
|
|
1269
|
-
gameObject.setLineWidth(value);
|
|
1270
|
-
},
|
|
1271
|
-
to: (gameObject) => (value) => {
|
|
1247
|
+
//#region src/services/setterMap/PolygonSetterMap.ts
|
|
1248
|
+
const PolygonSetterMap = {
|
|
1249
|
+
points: (gameObject) => (value) => {
|
|
1272
1250
|
if (!value) return;
|
|
1273
|
-
gameObject.setTo(
|
|
1251
|
+
gameObject.setTo(value);
|
|
1274
1252
|
},
|
|
1275
1253
|
...ShapeSetterMap,
|
|
1276
1254
|
...GlobalSetterMap
|
|
1277
1255
|
};
|
|
1278
1256
|
//#endregion
|
|
1279
|
-
//#region src/components/
|
|
1280
|
-
const _sfc_main$
|
|
1281
|
-
__name: "
|
|
1257
|
+
//#region src/components/Polygon.vue
|
|
1258
|
+
const _sfc_main$15 = /*@__PURE__*/ defineComponent({
|
|
1259
|
+
__name: "Polygon",
|
|
1282
1260
|
props: {
|
|
1283
1261
|
configuration: {},
|
|
1284
1262
|
immediate: { type: Boolean },
|
|
@@ -1286,63 +1264,28 @@ const _sfc_main$11 = /*@__PURE__*/ defineComponent({
|
|
|
1286
1264
|
},
|
|
1287
1265
|
setup(__props, { emit: __emit }) {
|
|
1288
1266
|
useInitializeGameObject((scene) => {
|
|
1289
|
-
const {
|
|
1290
|
-
const
|
|
1291
|
-
__props.onComplete?.(scene,
|
|
1292
|
-
return
|
|
1293
|
-
}, () => __props.configuration, __emit,
|
|
1267
|
+
const { alpha, fillColor, points, x, y } = __props.configuration;
|
|
1268
|
+
const polygon = scene.add.polygon(x, y, points, fillColor, alpha);
|
|
1269
|
+
__props.onComplete?.(scene, polygon);
|
|
1270
|
+
return polygon;
|
|
1271
|
+
}, () => __props.configuration, __emit, PolygonSetterMap, __props.immediate);
|
|
1294
1272
|
return (_ctx, _cache) => {
|
|
1295
1273
|
return null;
|
|
1296
1274
|
};
|
|
1297
1275
|
}
|
|
1298
1276
|
});
|
|
1299
1277
|
//#endregion
|
|
1300
|
-
//#region src/services/setterMap/
|
|
1301
|
-
const
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
gameObject.setFillStyle(gameObject.fillTop, value, gameObject.fillRight);
|
|
1305
|
-
},
|
|
1306
|
-
fillRight: (gameObject) => (value) => {
|
|
1307
|
-
if (value === void 0) return;
|
|
1308
|
-
gameObject.setFillStyle(gameObject.fillTop, gameObject.fillLeft, value);
|
|
1309
|
-
},
|
|
1310
|
-
fillTop: (gameObject) => (value) => {
|
|
1311
|
-
if (value === void 0) return;
|
|
1312
|
-
gameObject.setFillStyle(value, gameObject.fillLeft, gameObject.fillRight);
|
|
1313
|
-
},
|
|
1314
|
-
projection: (gameObject) => (value) => {
|
|
1315
|
-
if (value === void 0) return;
|
|
1316
|
-
gameObject.setProjection(value);
|
|
1317
|
-
},
|
|
1318
|
-
showLeft: (gameObject) => (value) => {
|
|
1319
|
-
if (value === void 0) return;
|
|
1320
|
-
gameObject.setFaces(gameObject.showTop, value, gameObject.showRight);
|
|
1321
|
-
},
|
|
1322
|
-
showRight: (gameObject) => (value) => {
|
|
1323
|
-
if (value === void 0) return;
|
|
1324
|
-
gameObject.setFaces(gameObject.showTop, gameObject.showLeft, value);
|
|
1325
|
-
},
|
|
1326
|
-
showTop: (gameObject) => (value) => {
|
|
1327
|
-
if (value === void 0) return;
|
|
1328
|
-
gameObject.setFaces(value, gameObject.showLeft, gameObject.showRight);
|
|
1329
|
-
}
|
|
1330
|
-
};
|
|
1331
|
-
//#endregion
|
|
1332
|
-
//#region src/services/setterMap/IsoTriangleSetterMap.ts
|
|
1333
|
-
const IsoTriangleSetterMap = {
|
|
1334
|
-
isReversed: (gameObject) => (value) => {
|
|
1335
|
-
if (value === void 0) return;
|
|
1336
|
-
gameObject.setReversed(value);
|
|
1337
|
-
},
|
|
1338
|
-
...IsoSetterMap,
|
|
1278
|
+
//#region src/services/setterMap/RectangleSetterMap.ts
|
|
1279
|
+
const RectangleSetterMap = {
|
|
1280
|
+
height: ComputedSizeSetterMap.height,
|
|
1281
|
+
width: ComputedSizeSetterMap.width,
|
|
1339
1282
|
...ShapeSetterMap,
|
|
1340
1283
|
...GlobalSetterMap
|
|
1341
1284
|
};
|
|
1342
1285
|
//#endregion
|
|
1343
|
-
//#region src/components/
|
|
1344
|
-
const _sfc_main$
|
|
1345
|
-
__name: "
|
|
1286
|
+
//#region src/components/Rectangle.vue
|
|
1287
|
+
const _sfc_main$16 = /*@__PURE__*/ defineComponent({
|
|
1288
|
+
__name: "Rectangle",
|
|
1346
1289
|
props: {
|
|
1347
1290
|
configuration: {},
|
|
1348
1291
|
immediate: { type: Boolean },
|
|
@@ -1350,47 +1293,242 @@ const _sfc_main$10 = /*@__PURE__*/ defineComponent({
|
|
|
1350
1293
|
},
|
|
1351
1294
|
setup(__props, { emit: __emit }) {
|
|
1352
1295
|
useInitializeGameObject((scene) => {
|
|
1353
|
-
const {
|
|
1354
|
-
const
|
|
1355
|
-
__props.onComplete?.(scene,
|
|
1356
|
-
return
|
|
1357
|
-
}, () => __props.configuration, __emit,
|
|
1296
|
+
const { alpha, fillColor, height, width, x, y } = __props.configuration;
|
|
1297
|
+
const rectangle = scene.add.rectangle(x, y, width, height, fillColor, alpha);
|
|
1298
|
+
__props.onComplete?.(scene, rectangle);
|
|
1299
|
+
return rectangle;
|
|
1300
|
+
}, () => __props.configuration, __emit, RectangleSetterMap, __props.immediate);
|
|
1358
1301
|
return (_ctx, _cache) => {
|
|
1359
1302
|
return null;
|
|
1360
1303
|
};
|
|
1361
1304
|
}
|
|
1362
1305
|
});
|
|
1363
1306
|
//#endregion
|
|
1364
|
-
//#region src/services/setterMap/
|
|
1365
|
-
const
|
|
1366
|
-
...
|
|
1367
|
-
...
|
|
1307
|
+
//#region src/services/setterMap/RenderTextureSetterMap.ts
|
|
1308
|
+
const RenderTextureSetterMap = {
|
|
1309
|
+
...AlphaSetterMap,
|
|
1310
|
+
...BlendModeSetterMap,
|
|
1311
|
+
...DepthSetterMap,
|
|
1312
|
+
...FlipSetterMap,
|
|
1313
|
+
...MaskSetterMap,
|
|
1314
|
+
...OriginSetterMap,
|
|
1315
|
+
...RenderNodesSetterMap,
|
|
1316
|
+
...ScrollFactorSetterMap,
|
|
1317
|
+
...SizeSetterMap,
|
|
1318
|
+
...TintSetterMap,
|
|
1319
|
+
...TransformSetterMap,
|
|
1320
|
+
...VisibleSetterMap,
|
|
1368
1321
|
...GlobalSetterMap
|
|
1369
1322
|
};
|
|
1370
1323
|
//#endregion
|
|
1371
|
-
//#region src/components/
|
|
1372
|
-
const _sfc_main$
|
|
1373
|
-
__name: "
|
|
1324
|
+
//#region src/components/RenderTexture.vue
|
|
1325
|
+
const _sfc_main$17 = /*@__PURE__*/ defineComponent({
|
|
1326
|
+
__name: "RenderTexture",
|
|
1374
1327
|
props: {
|
|
1375
1328
|
configuration: {},
|
|
1376
1329
|
immediate: { type: Boolean },
|
|
1377
1330
|
onComplete: { type: Function }
|
|
1378
1331
|
},
|
|
1379
|
-
setup(__props, { emit: __emit }) {
|
|
1380
|
-
useInitializeGameObject((scene) => {
|
|
1381
|
-
const {
|
|
1382
|
-
const
|
|
1383
|
-
__props.onComplete?.(scene,
|
|
1384
|
-
return
|
|
1385
|
-
}, () => __props.configuration, __emit,
|
|
1386
|
-
return (_ctx, _cache) => {
|
|
1387
|
-
return null;
|
|
1388
|
-
};
|
|
1332
|
+
setup(__props, { emit: __emit }) {
|
|
1333
|
+
useInitializeGameObject((scene) => {
|
|
1334
|
+
const { height, width, x, y } = __props.configuration;
|
|
1335
|
+
const renderTexture = scene.add.renderTexture(x ?? 0, y ?? 0, width, height);
|
|
1336
|
+
__props.onComplete?.(scene, renderTexture);
|
|
1337
|
+
return renderTexture;
|
|
1338
|
+
}, () => __props.configuration, __emit, RenderTextureSetterMap, __props.immediate);
|
|
1339
|
+
return (_ctx, _cache) => {
|
|
1340
|
+
return null;
|
|
1341
|
+
};
|
|
1342
|
+
}
|
|
1343
|
+
});
|
|
1344
|
+
//#endregion
|
|
1345
|
+
//#region src/services/hooks/resetLifecycleListeners.ts
|
|
1346
|
+
const resetLifecycleListeners = (scene, lifecycle) => {
|
|
1347
|
+
const listenersMap = ExternalSceneStore.lifecycleListenersMap.get(lifecycle);
|
|
1348
|
+
if (!listenersMap?.has(scene.scene.key)) return;
|
|
1349
|
+
listenersMap.set(scene.scene.key, []);
|
|
1350
|
+
};
|
|
1351
|
+
//#endregion
|
|
1352
|
+
//#region src/services/hooks/runLifecycleListeners.ts
|
|
1353
|
+
const runLifecycleListeners = (scene, lifecycle, isReset = true) => {
|
|
1354
|
+
const listenersMap = ExternalSceneStore.lifecycleListenersMap.get(lifecycle);
|
|
1355
|
+
if (!listenersMap) return;
|
|
1356
|
+
const listeners = listenersMap.get(scene.scene.key);
|
|
1357
|
+
if (!listeners) return;
|
|
1358
|
+
for (const listener of listeners) listener(scene);
|
|
1359
|
+
if (isReset) resetLifecycleListeners(scene, lifecycle);
|
|
1360
|
+
};
|
|
1361
|
+
//#endregion
|
|
1362
|
+
//#region src/services/hooks/runSceneShutdown.ts
|
|
1363
|
+
const runSceneShutdown = (scene) => {
|
|
1364
|
+
resetLifecycleListeners(scene, "Update");
|
|
1365
|
+
resetLifecycleListeners(scene, "NextTick");
|
|
1366
|
+
runLifecycleListeners(scene, "Shutdown");
|
|
1367
|
+
ExternalSceneStore.sceneReadyMap.set(scene.scene.key, false);
|
|
1368
|
+
};
|
|
1369
|
+
//#endregion
|
|
1370
|
+
//#region src/services/shared/createSceneClass.ts
|
|
1371
|
+
const createSceneClass = (key, hooks = {}) => class extends Scene {
|
|
1372
|
+
constructor() {
|
|
1373
|
+
super({ key });
|
|
1374
|
+
}
|
|
1375
|
+
create() {
|
|
1376
|
+
hooks.onCreate?.(this);
|
|
1377
|
+
runLifecycleListeners(this, "Create");
|
|
1378
|
+
}
|
|
1379
|
+
init() {
|
|
1380
|
+
hooks.onInit?.(this);
|
|
1381
|
+
runLifecycleListeners(this, "Init");
|
|
1382
|
+
}
|
|
1383
|
+
preload() {
|
|
1384
|
+
hooks.onPreload?.(this);
|
|
1385
|
+
runLifecycleListeners(this, "Preload");
|
|
1386
|
+
}
|
|
1387
|
+
update(time, delta) {
|
|
1388
|
+
hooks.onUpdate?.(this, time, delta);
|
|
1389
|
+
runLifecycleListeners(this, "Update", false);
|
|
1390
|
+
runLifecycleListeners(this, "NextTick");
|
|
1391
|
+
}
|
|
1392
|
+
};
|
|
1393
|
+
//#endregion
|
|
1394
|
+
//#region src/store/camera.ts
|
|
1395
|
+
const useCameraStore = defineStore("phaser/camera", () => {
|
|
1396
|
+
const isFading = ref(false);
|
|
1397
|
+
const fadeIn = (scene, ...args) => {
|
|
1398
|
+
isFading.value = true;
|
|
1399
|
+
scene.cameras.main.fadeIn(...args);
|
|
1400
|
+
};
|
|
1401
|
+
const fadeOut = (scene, ...args) => {
|
|
1402
|
+
isFading.value = true;
|
|
1403
|
+
scene.cameras.main.fadeOut(...args);
|
|
1404
|
+
};
|
|
1405
|
+
return {
|
|
1406
|
+
fadeIn,
|
|
1407
|
+
fadeOut,
|
|
1408
|
+
isFading
|
|
1409
|
+
};
|
|
1410
|
+
});
|
|
1411
|
+
//#endregion
|
|
1412
|
+
//#region src/store/input.ts
|
|
1413
|
+
const useInputStore = defineStore("phaser/input", () => {
|
|
1414
|
+
return { isInputActive: ref(false) };
|
|
1415
|
+
});
|
|
1416
|
+
//#endregion
|
|
1417
|
+
//#region src/components/Scene.vue
|
|
1418
|
+
const _sfc_main$18 = /*@__PURE__*/ defineComponent({
|
|
1419
|
+
__name: "Scene",
|
|
1420
|
+
props: {
|
|
1421
|
+
autoStart: { type: Boolean },
|
|
1422
|
+
sceneKey: {}
|
|
1423
|
+
},
|
|
1424
|
+
emits: [
|
|
1425
|
+
"create",
|
|
1426
|
+
"init",
|
|
1427
|
+
"preload",
|
|
1428
|
+
"shutdown",
|
|
1429
|
+
"update"
|
|
1430
|
+
],
|
|
1431
|
+
setup(__props, { emit: __emit }) {
|
|
1432
|
+
const emit = __emit;
|
|
1433
|
+
const phaserStore = usePhaserStore();
|
|
1434
|
+
const { isSameScene, switchToScene } = phaserStore;
|
|
1435
|
+
const cameraStore = useCameraStore();
|
|
1436
|
+
const { isFading } = storeToRefs(cameraStore);
|
|
1437
|
+
const inputStore = useInputStore();
|
|
1438
|
+
const { isInputActive } = storeToRefs(inputStore);
|
|
1439
|
+
const { parallelSceneKeys } = storeToRefs(phaserStore);
|
|
1440
|
+
const isActive = computed(() => isSameScene(__props.sceneKey) || parallelSceneKeys.value.includes(__props.sceneKey));
|
|
1441
|
+
const fadeStartListener = () => {
|
|
1442
|
+
isInputActive.value = false;
|
|
1443
|
+
};
|
|
1444
|
+
const fadeInCompleteListener = () => {
|
|
1445
|
+
isFading.value = false;
|
|
1446
|
+
isInputActive.value = true;
|
|
1447
|
+
};
|
|
1448
|
+
const fadeOutCompleteListener = () => {
|
|
1449
|
+
isFading.value = false;
|
|
1450
|
+
};
|
|
1451
|
+
const cameraFadeListeners = [
|
|
1452
|
+
[Cameras.Scene2D.Events.FADE_IN_START, fadeStartListener],
|
|
1453
|
+
[Cameras.Scene2D.Events.FADE_IN_COMPLETE, fadeInCompleteListener],
|
|
1454
|
+
[Cameras.Scene2D.Events.FADE_OUT_START, fadeStartListener],
|
|
1455
|
+
[Cameras.Scene2D.Events.FADE_OUT_COMPLETE, fadeOutCompleteListener]
|
|
1456
|
+
];
|
|
1457
|
+
const NewScene = createSceneClass(__props.sceneKey, {
|
|
1458
|
+
onCreate: (scene) => {
|
|
1459
|
+
emit("create", scene);
|
|
1460
|
+
for (const [event, listener] of cameraFadeListeners) scene.cameras.main.on(event, listener);
|
|
1461
|
+
isInputActive.value = true;
|
|
1462
|
+
},
|
|
1463
|
+
onInit: (scene) => emit("init", scene),
|
|
1464
|
+
onPreload: (scene) => emit("preload", scene),
|
|
1465
|
+
onUpdate: (scene, time, delta) => emit("update", scene, time, delta)
|
|
1466
|
+
});
|
|
1467
|
+
const readyListener = () => {
|
|
1468
|
+
ExternalSceneStore.sceneReadyMap.set(__props.sceneKey, true);
|
|
1469
|
+
};
|
|
1470
|
+
const shutdownListener = () => {
|
|
1471
|
+
const scene = getScene(__props.sceneKey);
|
|
1472
|
+
runSceneShutdown(scene);
|
|
1473
|
+
for (const [event, listener] of cameraFadeListeners) scene.cameras.main.off(event, listener);
|
|
1474
|
+
emit("shutdown", scene);
|
|
1475
|
+
};
|
|
1476
|
+
onMounted(async () => {
|
|
1477
|
+
const scene = useGame().scene.add(__props.sceneKey, NewScene);
|
|
1478
|
+
if (!scene) {
|
|
1479
|
+
console.error(`Failed to add scene: ${__props.sceneKey}`);
|
|
1480
|
+
return;
|
|
1481
|
+
}
|
|
1482
|
+
scene.events.on(Scenes.Events.READY, readyListener);
|
|
1483
|
+
scene.events.on(Scenes.Events.SHUTDOWN, shutdownListener);
|
|
1484
|
+
if (__props.autoStart) await switchToScene(__props.sceneKey);
|
|
1485
|
+
});
|
|
1486
|
+
onUnmounted(() => {
|
|
1487
|
+
const game = useGame();
|
|
1488
|
+
const scene = getScene(__props.sceneKey);
|
|
1489
|
+
scene.events.off(Scenes.Events.READY, readyListener);
|
|
1490
|
+
scene.events.off(Scenes.Events.SHUTDOWN, shutdownListener);
|
|
1491
|
+
game.scene.remove(__props.sceneKey);
|
|
1492
|
+
});
|
|
1493
|
+
provide(InjectionKeyMap.SceneKey, __props.sceneKey);
|
|
1494
|
+
return (_ctx, _cache) => {
|
|
1495
|
+
return isActive.value ? renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 0) : createCommentVNode("v-if", true);
|
|
1496
|
+
};
|
|
1497
|
+
}
|
|
1498
|
+
});
|
|
1499
|
+
//#endregion
|
|
1500
|
+
//#region src/services/setterMap/shared/AnimationSetterMap.ts
|
|
1501
|
+
const completionListeners = /* @__PURE__ */ new WeakMap();
|
|
1502
|
+
const AnimationSetterMap = {
|
|
1503
|
+
animations: (gameObject, emit) => (configurations) => {
|
|
1504
|
+
if (!(configurations && configurations.length > 0)) return;
|
|
1505
|
+
const listeners = completionListeners.get(gameObject) ?? /* @__PURE__ */ new Map();
|
|
1506
|
+
completionListeners.set(gameObject, listeners);
|
|
1507
|
+
for (const configuration of configurations) {
|
|
1508
|
+
if (!configuration.key) continue;
|
|
1509
|
+
const event = `${Animations.Events.ANIMATION_COMPLETE_KEY}${configuration.key}`;
|
|
1510
|
+
const previousListener = listeners.get(event);
|
|
1511
|
+
if (previousListener) gameObject.off(event, previousListener);
|
|
1512
|
+
const listener = () => {
|
|
1513
|
+
emit(event);
|
|
1514
|
+
};
|
|
1515
|
+
listeners.set(event, listener);
|
|
1516
|
+
gameObject.once(event, listener);
|
|
1517
|
+
if (gameObject.scene.anims.exists(configuration.key)) continue;
|
|
1518
|
+
if (!gameObject.scene.anims.create(configuration)) throw new InvalidOperationError(Operation.Create, "Animation", configuration.key);
|
|
1519
|
+
}
|
|
1520
|
+
},
|
|
1521
|
+
playAnimationKey: (gameObject) => (value) => {
|
|
1522
|
+
if (value === void 0) {
|
|
1523
|
+
gameObject.stop();
|
|
1524
|
+
return;
|
|
1525
|
+
}
|
|
1526
|
+
gameObject.play(value);
|
|
1389
1527
|
}
|
|
1390
|
-
}
|
|
1528
|
+
};
|
|
1391
1529
|
//#endregion
|
|
1392
|
-
//#region src/services/setterMap/
|
|
1393
|
-
const
|
|
1530
|
+
//#region src/services/setterMap/SpriteSetterMap.ts
|
|
1531
|
+
const SpriteSetterMap = {
|
|
1394
1532
|
...AlphaSetterMap,
|
|
1395
1533
|
...BlendModeSetterMap,
|
|
1396
1534
|
...DepthSetterMap,
|
|
@@ -1400,229 +1538,56 @@ const ImageSetterMap = {
|
|
|
1400
1538
|
...RenderNodesSetterMap,
|
|
1401
1539
|
...ScrollFactorSetterMap,
|
|
1402
1540
|
...SizeSetterMap,
|
|
1403
|
-
...
|
|
1541
|
+
...TextureSetterMap,
|
|
1404
1542
|
...TintSetterMap,
|
|
1405
1543
|
...TransformSetterMap,
|
|
1406
1544
|
...VisibleSetterMap,
|
|
1545
|
+
...AnimationSetterMap,
|
|
1407
1546
|
...GlobalSetterMap
|
|
1408
1547
|
};
|
|
1409
1548
|
//#endregion
|
|
1410
|
-
//#region src/components/
|
|
1411
|
-
const _sfc_main$
|
|
1412
|
-
__name: "
|
|
1549
|
+
//#region src/components/Sprite.vue
|
|
1550
|
+
const _sfc_main$19 = /*@__PURE__*/ defineComponent({
|
|
1551
|
+
__name: "Sprite",
|
|
1413
1552
|
props: {
|
|
1414
1553
|
configuration: {},
|
|
1554
|
+
immediate: { type: Boolean },
|
|
1415
1555
|
onComplete: { type: Function }
|
|
1416
1556
|
},
|
|
1417
1557
|
setup(__props, { emit: __emit }) {
|
|
1418
1558
|
useInitializeGameObject((scene) => {
|
|
1419
1559
|
const { frame, texture, x, y } = __props.configuration;
|
|
1420
|
-
const
|
|
1421
|
-
__props.onComplete?.(scene,
|
|
1422
|
-
return
|
|
1423
|
-
}, () => __props.configuration, __emit,
|
|
1560
|
+
const sprite = scene.add.sprite(x ?? 0, y ?? 0, texture, frame);
|
|
1561
|
+
__props.onComplete?.(scene, sprite);
|
|
1562
|
+
return sprite;
|
|
1563
|
+
}, () => __props.configuration, __emit, SpriteSetterMap, __props.immediate);
|
|
1424
1564
|
return (_ctx, _cache) => {
|
|
1425
1565
|
return null;
|
|
1426
1566
|
};
|
|
1427
1567
|
}
|
|
1428
1568
|
});
|
|
1429
1569
|
//#endregion
|
|
1430
|
-
//#region src/services/setterMap/
|
|
1431
|
-
const
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
...MaskSetterMap,
|
|
1436
|
-
...RenderNodesSetterMap,
|
|
1437
|
-
...ScrollFactorSetterMap,
|
|
1438
|
-
...TransformSetterMap,
|
|
1439
|
-
...VisibleSetterMap,
|
|
1440
|
-
...GlobalSetterMap
|
|
1441
|
-
};
|
|
1442
|
-
//#endregion
|
|
1443
|
-
//#region src/components/Graphics.vue
|
|
1444
|
-
const _sfc_main$7 = /*@__PURE__*/ defineComponent({
|
|
1445
|
-
__name: "Graphics",
|
|
1446
|
-
props: {
|
|
1447
|
-
configuration: { default: () => ({}) },
|
|
1448
|
-
immediate: { type: Boolean },
|
|
1449
|
-
onComplete: { type: Function }
|
|
1570
|
+
//#region src/services/setterMap/StarSetterMap.ts
|
|
1571
|
+
const StarSetterMap = {
|
|
1572
|
+
innerRadius: (gameObject) => (value) => {
|
|
1573
|
+
if (value === void 0) return;
|
|
1574
|
+
gameObject.setInnerRadius(value);
|
|
1450
1575
|
},
|
|
1451
|
-
|
|
1452
|
-
useInitializeGameObject((scene) => {
|
|
1453
|
-
const { x, y } = __props.configuration;
|
|
1454
|
-
const graphics = scene.add.graphics({
|
|
1455
|
-
x,
|
|
1456
|
-
y
|
|
1457
|
-
});
|
|
1458
|
-
__props.onComplete?.(scene, graphics);
|
|
1459
|
-
return graphics;
|
|
1460
|
-
}, () => __props.configuration, __emit, GraphicsSetterMap, __props.immediate);
|
|
1461
|
-
return (_ctx, _cache) => {
|
|
1462
|
-
return null;
|
|
1463
|
-
};
|
|
1464
|
-
}
|
|
1465
|
-
});
|
|
1466
|
-
//#endregion
|
|
1467
|
-
//#region src/models/plugins/TilesetFile.ts
|
|
1468
|
-
const XMLFile = Loader.FileTypes.XMLFile;
|
|
1469
|
-
var TilesetFile = class extends XMLFile {
|
|
1470
|
-
tilesetIndex;
|
|
1471
|
-
constructor(tilesetIndex, ...args) {
|
|
1472
|
-
super(...args);
|
|
1473
|
-
this.tilesetIndex = tilesetIndex;
|
|
1474
|
-
}
|
|
1475
|
-
};
|
|
1476
|
-
//#endregion
|
|
1477
|
-
//#region src/models/plugins/TiledJSONExternalFile.ts
|
|
1478
|
-
const GetFastValue = Utils.Objects.GetFastValue;
|
|
1479
|
-
const JSONFile$1 = Loader.FileTypes.JSONFile;
|
|
1480
|
-
const MultiFile = Loader.MultiFile;
|
|
1481
|
-
const PUBLIC_FOLDER = "public";
|
|
1482
|
-
var TiledJSONExternalFile = class extends MultiFile {
|
|
1483
|
-
constructor(loader, key, tilemapURL, path, baseURL, tilemapXhrSettings, tilesetXhrSettings) {
|
|
1484
|
-
if (checkIsPlainObject(key)) {
|
|
1485
|
-
const configuration = key;
|
|
1486
|
-
key = GetFastValue(configuration, "key");
|
|
1487
|
-
tilemapURL = GetFastValue(configuration, "url");
|
|
1488
|
-
tilemapXhrSettings = GetFastValue(configuration, "xhrSettings");
|
|
1489
|
-
path = GetFastValue(configuration, "path");
|
|
1490
|
-
baseURL = GetFastValue(configuration, "baseURL");
|
|
1491
|
-
tilesetXhrSettings = GetFastValue(configuration, "tilesetXhrSettings");
|
|
1492
|
-
}
|
|
1493
|
-
const tilemapFile = new JSONFile$1(loader, key, tilemapURL, tilemapXhrSettings);
|
|
1494
|
-
super(loader, "tilemapJSON", key, [tilemapFile]);
|
|
1495
|
-
this.config.path = path;
|
|
1496
|
-
this.config.baseURL = baseURL;
|
|
1497
|
-
this.config.tilesetXhrSettings = tilesetXhrSettings;
|
|
1498
|
-
}
|
|
1499
|
-
async addToCache() {
|
|
1500
|
-
if (!this.isReadyToProcess()) return;
|
|
1501
|
-
const [tilemapFile, ...tilesetFiles] = this.files;
|
|
1502
|
-
if (!(tilemapFile.type === "json" && Object.hasOwn(tilemapFile.data, "tilesets"))) return;
|
|
1503
|
-
const tilemapData = tilemapFile.data;
|
|
1504
|
-
const tilemapKey = tilemapFile.key;
|
|
1505
|
-
const loader = this.loader;
|
|
1506
|
-
const files = this.files;
|
|
1507
|
-
this.complete = true;
|
|
1508
|
-
await Promise.all(tilesetFiles.map(async (tilesetFile) => {
|
|
1509
|
-
const responseText = tilesetFile.xhrLoader?.responseText;
|
|
1510
|
-
if (!responseText) throw new InvalidOperationError(Operation.Read, this.addToCache.name, tilesetFile.key);
|
|
1511
|
-
const responseData = await parseXmlString(responseText);
|
|
1512
|
-
const tilesetData = parseTileset(responseData.tileset);
|
|
1513
|
-
const index = tilesetFile.tilesetIndex;
|
|
1514
|
-
Object.assign(tilemapData.tilesets[index], tilesetData, {
|
|
1515
|
-
imageheight: tilesetData.image.height,
|
|
1516
|
-
imagewidth: tilesetData.image.width,
|
|
1517
|
-
source: void 0
|
|
1518
|
-
});
|
|
1519
|
-
}));
|
|
1520
|
-
loader.cacheManager.tilemap.add(tilemapKey, {
|
|
1521
|
-
data: tilemapData,
|
|
1522
|
-
format: Tilemaps.Formats.TILED_JSON
|
|
1523
|
-
});
|
|
1524
|
-
for (const file of files) file.pendingDestroy();
|
|
1525
|
-
}
|
|
1526
|
-
onFileComplete(file) {
|
|
1527
|
-
if (this.files.indexOf(file) === -1) return;
|
|
1528
|
-
this.pending--;
|
|
1529
|
-
if (!(file.type === "json" && Object.hasOwn(file.data, "tilesets"))) return;
|
|
1530
|
-
const tilesets = file.data.tilesets;
|
|
1531
|
-
const config = this.config;
|
|
1532
|
-
const loader = this.loader;
|
|
1533
|
-
const currentBaseURL = loader.baseURL;
|
|
1534
|
-
const currentPath = loader.path;
|
|
1535
|
-
const currentPrefix = loader.prefix;
|
|
1536
|
-
const baseURL = GetFastValue(config, "baseURL", currentBaseURL);
|
|
1537
|
-
const path = GetFastValue(config, "path", currentPath);
|
|
1538
|
-
const prefix = GetFastValue(config, "prefix", currentPrefix);
|
|
1539
|
-
const tilesetXhrSettings = GetFastValue(config, "tilesetXhrSettings");
|
|
1540
|
-
loader.setBaseURL(baseURL);
|
|
1541
|
-
loader.setPath(path);
|
|
1542
|
-
loader.setPrefix(prefix);
|
|
1543
|
-
for (const [tilesetIndex, tileset] of tilesets.entries()) {
|
|
1544
|
-
const pathIndex = tileset.source.indexOf(PUBLIC_FOLDER);
|
|
1545
|
-
if (pathIndex === -1) throw new NotFoundError(this.onFileComplete.name, tileset.source);
|
|
1546
|
-
const relativePath = tileset.source.slice(pathIndex + 6);
|
|
1547
|
-
const tilesetFile = new TilesetFile(tilesetIndex, loader, `${file.key}${ID_SEPARATOR}Tileset${ID_SEPARATOR}${relativePath}`, relativePath, tilesetXhrSettings);
|
|
1548
|
-
this.addToMultiFile(tilesetFile);
|
|
1549
|
-
loader.addFile(tilesetFile);
|
|
1550
|
-
}
|
|
1551
|
-
loader.setBaseURL(currentBaseURL);
|
|
1552
|
-
loader.setPath(currentPath);
|
|
1553
|
-
loader.setPrefix(currentPrefix);
|
|
1554
|
-
}
|
|
1555
|
-
};
|
|
1556
|
-
//#endregion
|
|
1557
|
-
//#region src/services/shared/constants.ts
|
|
1558
|
-
const TILEMAP_TILED_JSON_EXTERNAL_KEY = "tilemapTiledJSONExternal";
|
|
1559
|
-
//#endregion
|
|
1560
|
-
//#region src/plugins/registerTiledJSONExternalLoader.ts
|
|
1561
|
-
const FileTypesManager = Loader.FileTypesManager;
|
|
1562
|
-
const registerTiledJSONExternalLoader = () => {
|
|
1563
|
-
FileTypesManager.register(TILEMAP_TILED_JSON_EXTERNAL_KEY, function(...[key, tilemapURL, path, baseURL, tilemapXhrSettings, tilesetXhrSettings]) {
|
|
1564
|
-
if (Array.isArray(key)) for (const keyElement of key) {
|
|
1565
|
-
const multifile = new TiledJSONExternalFile(this, keyElement);
|
|
1566
|
-
this.addFile(multifile.files);
|
|
1567
|
-
}
|
|
1568
|
-
else {
|
|
1569
|
-
const multifile = new TiledJSONExternalFile(this, key, tilemapURL, path, baseURL, tilemapXhrSettings, tilesetXhrSettings);
|
|
1570
|
-
this.addFile(multifile.files);
|
|
1571
|
-
}
|
|
1572
|
-
return this;
|
|
1573
|
-
});
|
|
1574
|
-
};
|
|
1575
|
-
//#endregion
|
|
1576
|
-
//#region src/components/Game.vue
|
|
1577
|
-
const _sfc_main$6 = /*@__PURE__*/ defineComponent({
|
|
1578
|
-
__name: "Game",
|
|
1579
|
-
props: { configuration: {} },
|
|
1580
|
-
setup(__props) {
|
|
1581
|
-
const phaserStore = usePhaserStore();
|
|
1582
|
-
const { game: storeGame } = storeToRefs(phaserStore);
|
|
1583
|
-
const canvasRoot = useTemplateRef("canvasRoot");
|
|
1584
|
-
const isReady = ref(false);
|
|
1585
|
-
const readyListener = () => {
|
|
1586
|
-
isReady.value = true;
|
|
1587
|
-
};
|
|
1588
|
-
onMounted(() => {
|
|
1589
|
-
registerTiledJSONExternalLoader();
|
|
1590
|
-
storeGame.value = new Game({
|
|
1591
|
-
...__props.configuration,
|
|
1592
|
-
parent: canvasRoot.value
|
|
1593
|
-
});
|
|
1594
|
-
storeGame.value.events.on(Core.Events.READY, readyListener);
|
|
1595
|
-
});
|
|
1596
|
-
onUnmounted(() => {
|
|
1597
|
-
const game = useGame();
|
|
1598
|
-
game.events.off(Core.Events.READY, readyListener);
|
|
1599
|
-
game.destroy(true);
|
|
1600
|
-
storeGame.value = void 0;
|
|
1601
|
-
});
|
|
1602
|
-
return (_ctx, _cache) => {
|
|
1603
|
-
return openBlock(), createElementBlock(Fragment, null, [createElementVNode("div", {
|
|
1604
|
-
ref_key: "canvasRoot",
|
|
1605
|
-
ref: canvasRoot
|
|
1606
|
-
}, null, 512), isReady.value ? renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 0) : createCommentVNode("v-if", true)], 64);
|
|
1607
|
-
};
|
|
1608
|
-
}
|
|
1609
|
-
});
|
|
1610
|
-
//#endregion
|
|
1611
|
-
//#region src/services/setterMap/EllipseSetterMap.ts
|
|
1612
|
-
const EllipseSetterMap = {
|
|
1613
|
-
height: ComputedSizeSetterMap.height,
|
|
1614
|
-
smoothness: (gameObject) => (value) => {
|
|
1576
|
+
outerRadius: (gameObject) => (value) => {
|
|
1615
1577
|
if (value === void 0) return;
|
|
1616
|
-
gameObject.
|
|
1578
|
+
gameObject.setOuterRadius(value);
|
|
1579
|
+
},
|
|
1580
|
+
points: (gameObject) => (value) => {
|
|
1581
|
+
if (value === void 0) return;
|
|
1582
|
+
gameObject.setPoints(value);
|
|
1617
1583
|
},
|
|
1618
|
-
width: ComputedSizeSetterMap.width,
|
|
1619
1584
|
...ShapeSetterMap,
|
|
1620
1585
|
...GlobalSetterMap
|
|
1621
1586
|
};
|
|
1622
1587
|
//#endregion
|
|
1623
|
-
//#region src/components/
|
|
1624
|
-
const _sfc_main$
|
|
1625
|
-
__name: "
|
|
1588
|
+
//#region src/components/Star.vue
|
|
1589
|
+
const _sfc_main$20 = /*@__PURE__*/ defineComponent({
|
|
1590
|
+
__name: "Star",
|
|
1626
1591
|
props: {
|
|
1627
1592
|
configuration: {},
|
|
1628
1593
|
immediate: { type: Boolean },
|
|
@@ -1630,108 +1595,162 @@ const _sfc_main$5 = /*@__PURE__*/ defineComponent({
|
|
|
1630
1595
|
},
|
|
1631
1596
|
setup(__props, { emit: __emit }) {
|
|
1632
1597
|
useInitializeGameObject((scene) => {
|
|
1633
|
-
const { alpha, fillColor,
|
|
1634
|
-
const
|
|
1635
|
-
__props.onComplete?.(scene,
|
|
1636
|
-
return
|
|
1637
|
-
}, () => __props.configuration, __emit,
|
|
1598
|
+
const { alpha, fillColor, innerRadius, outerRadius, points, x, y } = __props.configuration;
|
|
1599
|
+
const star = scene.add.star(x, y, points, innerRadius, outerRadius, fillColor, alpha);
|
|
1600
|
+
__props.onComplete?.(scene, star);
|
|
1601
|
+
return star;
|
|
1602
|
+
}, () => __props.configuration, __emit, StarSetterMap, __props.immediate);
|
|
1638
1603
|
return (_ctx, _cache) => {
|
|
1639
1604
|
return null;
|
|
1640
1605
|
};
|
|
1641
1606
|
}
|
|
1642
1607
|
});
|
|
1643
1608
|
//#endregion
|
|
1644
|
-
//#region src/services/setterMap/
|
|
1645
|
-
const
|
|
1646
|
-
|
|
1609
|
+
//#region src/services/setterMap/TextSetterMap.ts
|
|
1610
|
+
const TextSetterMap = {
|
|
1611
|
+
padding: (gameObject) => (value) => {
|
|
1612
|
+
if (!value) return;
|
|
1613
|
+
gameObject.setPadding(value);
|
|
1614
|
+
},
|
|
1615
|
+
style: (gameObject) => (value) => {
|
|
1616
|
+
if (!value) return;
|
|
1617
|
+
gameObject.setStyle(value);
|
|
1618
|
+
},
|
|
1619
|
+
text: (gameObject, emit) => (value) => {
|
|
1647
1620
|
if (value === void 0) return;
|
|
1648
|
-
gameObject.
|
|
1621
|
+
gameObject.setText(value);
|
|
1622
|
+
emit("update:width", gameObject.width);
|
|
1623
|
+
emit("update:displayWidth", gameObject.displayWidth);
|
|
1649
1624
|
},
|
|
1650
|
-
...
|
|
1625
|
+
...AlphaSetterMap,
|
|
1626
|
+
...BlendModeSetterMap,
|
|
1627
|
+
...ComputedSizeSetterMap,
|
|
1628
|
+
...DepthSetterMap,
|
|
1629
|
+
...FlipSetterMap,
|
|
1630
|
+
...MaskSetterMap,
|
|
1631
|
+
...OriginSetterMap,
|
|
1632
|
+
...RenderNodesSetterMap,
|
|
1633
|
+
...ScrollFactorSetterMap,
|
|
1634
|
+
...TintSetterMap,
|
|
1635
|
+
...TransformSetterMap,
|
|
1636
|
+
...VisibleSetterMap,
|
|
1651
1637
|
...GlobalSetterMap
|
|
1652
1638
|
};
|
|
1653
1639
|
//#endregion
|
|
1654
|
-
//#region src/
|
|
1655
|
-
const
|
|
1656
|
-
|
|
1640
|
+
//#region src/store/text.ts
|
|
1641
|
+
const useTextStore = defineStore("phaser/text", () => {
|
|
1642
|
+
return { defaultTextStyle: ref() };
|
|
1643
|
+
});
|
|
1644
|
+
//#endregion
|
|
1645
|
+
//#region src/components/Text.vue
|
|
1646
|
+
const _sfc_main$21 = /*@__PURE__*/ defineComponent({
|
|
1647
|
+
__name: "Text",
|
|
1657
1648
|
props: {
|
|
1658
1649
|
configuration: {},
|
|
1659
|
-
immediate: { type: Boolean }
|
|
1660
|
-
onComplete: { type: Function }
|
|
1650
|
+
immediate: { type: Boolean }
|
|
1661
1651
|
},
|
|
1662
1652
|
setup(__props, { emit: __emit }) {
|
|
1653
|
+
const emit = __emit;
|
|
1654
|
+
const textStore = useTextStore();
|
|
1655
|
+
const { defaultTextStyle } = storeToRefs(textStore);
|
|
1663
1656
|
useInitializeGameObject((scene) => {
|
|
1664
|
-
const {
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1657
|
+
const { style, text, x, y } = __props.configuration;
|
|
1658
|
+
return scene.add.text(x ?? 0, y ?? 0, text, {
|
|
1659
|
+
...defaultTextStyle.value,
|
|
1660
|
+
...style
|
|
1661
|
+
});
|
|
1662
|
+
}, () => __props.configuration, emit, TextSetterMap, __props.immediate);
|
|
1669
1663
|
return (_ctx, _cache) => {
|
|
1670
1664
|
return null;
|
|
1671
1665
|
};
|
|
1672
1666
|
}
|
|
1673
1667
|
});
|
|
1674
1668
|
//#endregion
|
|
1675
|
-
//#region src/services/setterMap/
|
|
1676
|
-
const
|
|
1677
|
-
...
|
|
1669
|
+
//#region src/services/setterMap/TileSpriteSetterMap.ts
|
|
1670
|
+
const TileSpriteSetterMap = {
|
|
1671
|
+
...AlphaSetterMap,
|
|
1678
1672
|
...BlendModeSetterMap,
|
|
1673
|
+
...ComputedSizeSetterMap,
|
|
1679
1674
|
...DepthSetterMap,
|
|
1675
|
+
...FlipSetterMap,
|
|
1680
1676
|
...MaskSetterMap,
|
|
1677
|
+
...OriginSetterMap,
|
|
1678
|
+
...RenderNodesSetterMap,
|
|
1681
1679
|
...ScrollFactorSetterMap,
|
|
1680
|
+
...TextureSetterMap,
|
|
1681
|
+
...TintSetterMap,
|
|
1682
1682
|
...TransformSetterMap,
|
|
1683
1683
|
...VisibleSetterMap,
|
|
1684
1684
|
...GlobalSetterMap
|
|
1685
1685
|
};
|
|
1686
1686
|
//#endregion
|
|
1687
|
-
//#region src/components/
|
|
1688
|
-
const _sfc_main$
|
|
1689
|
-
__name: "
|
|
1687
|
+
//#region src/components/TileSprite.vue
|
|
1688
|
+
const _sfc_main$22 = /*@__PURE__*/ defineComponent({
|
|
1689
|
+
__name: "TileSprite",
|
|
1690
1690
|
props: {
|
|
1691
|
-
configuration: {
|
|
1691
|
+
configuration: {},
|
|
1692
|
+
immediate: { type: Boolean },
|
|
1692
1693
|
onComplete: { type: Function }
|
|
1693
1694
|
},
|
|
1694
1695
|
setup(__props, { emit: __emit }) {
|
|
1695
|
-
const emit = __emit;
|
|
1696
|
-
const container = shallowRef();
|
|
1697
1696
|
useInitializeGameObject((scene) => {
|
|
1698
|
-
const {
|
|
1699
|
-
|
|
1700
|
-
__props.onComplete?.(scene,
|
|
1701
|
-
return
|
|
1702
|
-
}, () => __props.configuration,
|
|
1703
|
-
provide(InjectionKeyMap.ParentContainer, container);
|
|
1697
|
+
const { frame, height, texture, width, x, y } = __props.configuration;
|
|
1698
|
+
const tileSprite = scene.add.tileSprite(x ?? 0, y ?? 0, width ?? 0, height ?? 0, texture, frame);
|
|
1699
|
+
__props.onComplete?.(scene, tileSprite);
|
|
1700
|
+
return tileSprite;
|
|
1701
|
+
}, () => __props.configuration, __emit, TileSpriteSetterMap, __props.immediate);
|
|
1704
1702
|
return (_ctx, _cache) => {
|
|
1705
|
-
return
|
|
1703
|
+
return null;
|
|
1706
1704
|
};
|
|
1707
1705
|
}
|
|
1708
1706
|
});
|
|
1709
1707
|
//#endregion
|
|
1710
|
-
//#region src/
|
|
1711
|
-
const
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
endAngle: (gameObject) => (value) => {
|
|
1717
|
-
if (value === void 0) return;
|
|
1718
|
-
gameObject.setEndAngle(value);
|
|
1719
|
-
},
|
|
1720
|
-
radius: (gameObject) => (value) => {
|
|
1721
|
-
if (value === void 0) return;
|
|
1722
|
-
gameObject.setRadius(value);
|
|
1708
|
+
//#region src/components/Tilemap.vue
|
|
1709
|
+
const _sfc_main$23 = /*@__PURE__*/ defineComponent({
|
|
1710
|
+
__name: "Tilemap",
|
|
1711
|
+
props: {
|
|
1712
|
+
configuration: {},
|
|
1713
|
+
onComplete: { type: Function }
|
|
1723
1714
|
},
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1715
|
+
setup(__props) {
|
|
1716
|
+
const sceneKey = useInjectSceneKey();
|
|
1717
|
+
const tilemap = shallowRef();
|
|
1718
|
+
onCreate((newScene) => {
|
|
1719
|
+
tilemap.value = newScene.make.tilemap(__props.configuration);
|
|
1720
|
+
__props.onComplete?.(newScene, tilemap.value);
|
|
1721
|
+
});
|
|
1722
|
+
watch(() => __props.configuration.key, (newKey) => {
|
|
1723
|
+
const scene = getScene(sceneKey);
|
|
1724
|
+
const oldTilemap = tilemap.value;
|
|
1725
|
+
if (newKey) {
|
|
1726
|
+
tilemap.value = scene.make.tilemap(__props.configuration);
|
|
1727
|
+
__props.onComplete?.(scene, tilemap.value);
|
|
1728
|
+
} else tilemap.value = void 0;
|
|
1729
|
+
if (oldTilemap) oldTilemap.destroy();
|
|
1730
|
+
});
|
|
1731
|
+
onUnmounted(() => {
|
|
1732
|
+
if (!tilemap.value) return;
|
|
1733
|
+
tilemap.value.destroy();
|
|
1734
|
+
});
|
|
1735
|
+
return (_ctx, _cache) => {
|
|
1736
|
+
return renderSlot(_ctx.$slots, "default");
|
|
1737
|
+
};
|
|
1738
|
+
}
|
|
1739
|
+
});
|
|
1740
|
+
//#endregion
|
|
1741
|
+
//#region src/services/setterMap/TriangleSetterMap.ts
|
|
1742
|
+
const TriangleSetterMap = {
|
|
1743
|
+
to: (gameObject) => (value) => {
|
|
1744
|
+
if (!value) return;
|
|
1745
|
+
gameObject.setTo(...value);
|
|
1727
1746
|
},
|
|
1728
1747
|
...ShapeSetterMap,
|
|
1729
1748
|
...GlobalSetterMap
|
|
1730
1749
|
};
|
|
1731
1750
|
//#endregion
|
|
1732
|
-
//#region src/components/
|
|
1733
|
-
const _sfc_main$
|
|
1734
|
-
__name: "
|
|
1751
|
+
//#region src/components/Triangle.vue
|
|
1752
|
+
const _sfc_main$24 = /*@__PURE__*/ defineComponent({
|
|
1753
|
+
__name: "Triangle",
|
|
1735
1754
|
props: {
|
|
1736
1755
|
configuration: {},
|
|
1737
1756
|
immediate: { type: Boolean },
|
|
@@ -1739,71 +1758,47 @@ const _sfc_main$2 = /*@__PURE__*/ defineComponent({
|
|
|
1739
1758
|
},
|
|
1740
1759
|
setup(__props, { emit: __emit }) {
|
|
1741
1760
|
useInitializeGameObject((scene) => {
|
|
1742
|
-
const { alpha, fillColor,
|
|
1743
|
-
const
|
|
1744
|
-
__props.onComplete?.(scene,
|
|
1745
|
-
return
|
|
1746
|
-
}, () => __props.configuration, __emit,
|
|
1761
|
+
const { alpha, fillColor, to, x, y } = __props.configuration;
|
|
1762
|
+
const triangle = scene.add.triangle(x, y, to?.[0], to?.[1], to?.[2], to?.[3], to?.[4], to?.[5], fillColor, alpha);
|
|
1763
|
+
__props.onComplete?.(scene, triangle);
|
|
1764
|
+
return triangle;
|
|
1765
|
+
}, () => __props.configuration, __emit, TriangleSetterMap, __props.immediate);
|
|
1747
1766
|
return (_ctx, _cache) => {
|
|
1748
1767
|
return null;
|
|
1749
1768
|
};
|
|
1750
1769
|
}
|
|
1751
1770
|
});
|
|
1752
1771
|
//#endregion
|
|
1753
|
-
//#region src/services/setterMap/
|
|
1754
|
-
const
|
|
1755
|
-
|
|
1756
|
-
if (value === void 0) return;
|
|
1757
|
-
gameObject.align = value;
|
|
1758
|
-
},
|
|
1759
|
-
dropShadow: (gameObject) => (value) => {
|
|
1760
|
-
if (!value) return;
|
|
1761
|
-
gameObject.setDropShadow(...value);
|
|
1762
|
-
},
|
|
1763
|
-
font: (gameObject) => (value) => {
|
|
1772
|
+
//#region src/services/setterMap/VideoSetterMap.ts
|
|
1773
|
+
const VideoSetterMap = {
|
|
1774
|
+
key: (gameObject) => (value) => {
|
|
1764
1775
|
if (!value) return;
|
|
1765
|
-
gameObject.
|
|
1766
|
-
},
|
|
1767
|
-
fontSize: (gameObject) => (value) => {
|
|
1768
|
-
if (value === void 0) return;
|
|
1769
|
-
gameObject.setFontSize(value);
|
|
1770
|
-
},
|
|
1771
|
-
letterSpacing: (gameObject) => (value) => {
|
|
1772
|
-
if (value === void 0) return;
|
|
1773
|
-
gameObject.setLetterSpacing(value);
|
|
1774
|
-
},
|
|
1775
|
-
lineSpacing: (gameObject) => (value) => {
|
|
1776
|
-
if (value === void 0) return;
|
|
1777
|
-
gameObject.setLineSpacing(value);
|
|
1778
|
-
},
|
|
1779
|
-
maxWidth: (gameObject) => (value) => {
|
|
1780
|
-
if (value === void 0) return;
|
|
1781
|
-
gameObject.setMaxWidth(value);
|
|
1776
|
+
gameObject.changeSource(value);
|
|
1782
1777
|
},
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
gameObject.setText(value);
|
|
1778
|
+
muted: (gameObject) => (value) => {
|
|
1779
|
+
gameObject.setMute(value);
|
|
1786
1780
|
},
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
gameObject.wordWrapCharCode = value;
|
|
1781
|
+
volume: (gameObject) => (value) => {
|
|
1782
|
+
gameObject.setVolume(value);
|
|
1790
1783
|
},
|
|
1791
1784
|
...AlphaSetterMap,
|
|
1792
1785
|
...BlendModeSetterMap,
|
|
1793
1786
|
...DepthSetterMap,
|
|
1787
|
+
...FlipSetterMap,
|
|
1794
1788
|
...MaskSetterMap,
|
|
1795
1789
|
...OriginSetterMap,
|
|
1796
1790
|
...RenderNodesSetterMap,
|
|
1797
1791
|
...ScrollFactorSetterMap,
|
|
1792
|
+
...TextureCropSetterMap,
|
|
1798
1793
|
...TintSetterMap,
|
|
1799
1794
|
...TransformSetterMap,
|
|
1800
1795
|
...VisibleSetterMap,
|
|
1801
1796
|
...GlobalSetterMap
|
|
1802
1797
|
};
|
|
1803
1798
|
//#endregion
|
|
1804
|
-
//#region src/components/
|
|
1805
|
-
const _sfc_main$
|
|
1806
|
-
__name: "
|
|
1799
|
+
//#region src/components/Video.vue
|
|
1800
|
+
const _sfc_main$25 = /*@__PURE__*/ defineComponent({
|
|
1801
|
+
__name: "Video",
|
|
1807
1802
|
props: {
|
|
1808
1803
|
configuration: {},
|
|
1809
1804
|
immediate: { type: Boolean },
|
|
@@ -1811,32 +1806,37 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
|
1811
1806
|
},
|
|
1812
1807
|
setup(__props, { emit: __emit }) {
|
|
1813
1808
|
useInitializeGameObject((scene) => {
|
|
1814
|
-
const {
|
|
1815
|
-
const
|
|
1816
|
-
__props.onComplete?.(scene,
|
|
1817
|
-
return
|
|
1818
|
-
}, () => __props.configuration, __emit,
|
|
1809
|
+
const { key, x, y } = __props.configuration;
|
|
1810
|
+
const video = scene.add.video(x ?? 0, y ?? 0, key);
|
|
1811
|
+
__props.onComplete?.(scene, video);
|
|
1812
|
+
return video;
|
|
1813
|
+
}, () => __props.configuration, __emit, VideoSetterMap, __props.immediate);
|
|
1819
1814
|
return (_ctx, _cache) => {
|
|
1820
1815
|
return null;
|
|
1821
1816
|
};
|
|
1822
1817
|
}
|
|
1823
1818
|
});
|
|
1824
1819
|
//#endregion
|
|
1825
|
-
//#region src/
|
|
1826
|
-
const
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1820
|
+
//#region src/services/setterMap/ZoneSetterMap.ts
|
|
1821
|
+
const ZoneSetterMap = {
|
|
1822
|
+
...ComputedSizeSetterMap,
|
|
1823
|
+
...DepthSetterMap,
|
|
1824
|
+
...OriginSetterMap,
|
|
1825
|
+
...ScrollFactorSetterMap,
|
|
1826
|
+
...TransformSetterMap,
|
|
1827
|
+
...VisibleSetterMap,
|
|
1828
|
+
...GlobalSetterMap
|
|
1829
|
+
};
|
|
1830
|
+
//#endregion
|
|
1831
|
+
//#region src/components/Zone.vue
|
|
1832
|
+
const _sfc_main$26 = /*@__PURE__*/ defineComponent({
|
|
1833
|
+
__name: "Zone",
|
|
1834
|
+
props: { configuration: {} },
|
|
1833
1835
|
setup(__props, { emit: __emit }) {
|
|
1834
1836
|
useInitializeGameObject((scene) => {
|
|
1835
|
-
const {
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
return arc;
|
|
1839
|
-
}, () => __props.configuration, __emit, ArcSetterMap, __props.immediate);
|
|
1837
|
+
const { height, width, x, y } = __props.configuration;
|
|
1838
|
+
return scene.add.zone(x, y, width, height);
|
|
1839
|
+
}, () => __props.configuration, __emit, ZoneSetterMap);
|
|
1840
1840
|
return (_ctx, _cache) => {
|
|
1841
1841
|
return null;
|
|
1842
1842
|
};
|