vue-phaserjs 2.37.2 → 2.38.1
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/LICENSE +201 -201
- package/dist/index.d.ts +10223 -193
- package/dist/index.js +1589 -889
- package/dist/vue-shims-Bl66Srx_.d.ts +6 -0
- package/package.json +24 -10
- package/dist/components/Arc.vue.d.ts +0 -285
- package/dist/components/BitmapText.vue.d.ts +0 -315
- package/dist/components/Circle.vue.d.ts +0 -285
- package/dist/components/Container.vue.d.ts +0 -262
- package/dist/components/Curve.vue.d.ts +0 -281
- package/dist/components/Ellipse.vue.d.ts +0 -283
- package/dist/components/Game.vue.d.ts +0 -18
- package/dist/components/Graphics.vue.d.ts +0 -257
- package/dist/components/Image.vue.d.ts +0 -321
- package/dist/components/IsoBox.vue.d.ts +0 -295
- package/dist/components/IsoTriangle.vue.d.ts +0 -297
- package/dist/components/Line.vue.d.ts +0 -281
- package/dist/components/Nineslice.vue.d.ts +0 -290
- package/dist/components/Particles.vue.d.ts +0 -263
- package/dist/components/PathFollower.vue.d.ts +0 -331
- package/dist/components/Polygon.vue.d.ts +0 -279
- package/dist/components/Rectangle.vue.d.ts +0 -281
- package/dist/components/RenderTexture.vue.d.ts +0 -309
- package/dist/components/Scene.vue.d.ts +0 -27
- package/dist/components/Sprite.vue.d.ts +0 -322
- package/dist/components/Star.vue.d.ts +0 -283
- package/dist/components/Text.vue.d.ts +0 -308
- package/dist/components/TileSprite.vue.d.ts +0 -16
- package/dist/components/Tilemap.vue.d.ts +0 -19
- package/dist/components/Triangle.vue.d.ts +0 -279
- package/dist/components/Video.vue.d.ts +0 -313
- package/dist/components/Zone.vue.d.ts +0 -260
- package/dist/components/index.d.ts +0 -28
- package/dist/composables/useAnimations.d.ts +0 -45
- package/dist/composables/useGame.d.ts +0 -2
- package/dist/composables/useInitializeGameObject.d.ts +0 -5
- package/dist/composables/useInitializeGameObjectEvents.d.ts +0 -7
- package/dist/composables/useInitializeGameObjectSetters.d.ts +0 -7
- package/dist/composables/useInjectSceneKey.d.ts +0 -2
- package/dist/composables/useTween.d.ts +0 -2
- package/dist/hooks/onCreate.d.ts +0 -2
- package/dist/hooks/onInit.d.ts +0 -2
- package/dist/hooks/onNextTick.d.ts +0 -2
- package/dist/hooks/onPreload.d.ts +0 -2
- package/dist/hooks/onShutdown.d.ts +0 -2
- package/dist/hooks/onUpdate.d.ts +0 -2
- package/dist/models/configuration/ArcConfiguration.d.ts +0 -4
- package/dist/models/configuration/BitmapTextConfiguration.d.ts +0 -16
- package/dist/models/configuration/ContainerConfiguration.d.ts +0 -12
- package/dist/models/configuration/CurveConfiguration.d.ts +0 -5
- package/dist/models/configuration/EllipseConfiguration.d.ts +0 -4
- package/dist/models/configuration/GraphicsConfiguration.d.ts +0 -11
- package/dist/models/configuration/ImageConfiguration.d.ts +0 -18
- package/dist/models/configuration/IsoBoxConfiguration.d.ts +0 -6
- package/dist/models/configuration/IsoTriangleConfiguration.d.ts +0 -6
- package/dist/models/configuration/LineConfiguration.d.ts +0 -5
- package/dist/models/configuration/NinesliceConfiguration.d.ts +0 -15
- package/dist/models/configuration/ParticlesConfiguration.d.ts +0 -14
- package/dist/models/configuration/PathFollowerConfiguration.d.ts +0 -19
- package/dist/models/configuration/PolygonConfiguration.d.ts +0 -5
- package/dist/models/configuration/RectangleConfiguration.d.ts +0 -4
- package/dist/models/configuration/RenderTextureConfiguration.d.ts +0 -17
- package/dist/models/configuration/SpriteConfiguration.d.ts +0 -19
- package/dist/models/configuration/StarConfiguration.d.ts +0 -4
- package/dist/models/configuration/TextConfiguration.d.ts +0 -18
- package/dist/models/configuration/TileSpriteConfiguration.d.ts +0 -18
- package/dist/models/configuration/TriangleConfiguration.d.ts +0 -5
- package/dist/models/configuration/VideoConfiguration.d.ts +0 -18
- package/dist/models/configuration/ZoneConfiguration.d.ts +0 -12
- package/dist/models/configuration/components/AlphaConfiguration.d.ts +0 -4
- package/dist/models/configuration/components/AlphaSingleConfiguration.d.ts +0 -4
- package/dist/models/configuration/components/BaseTextureConfiguration.d.ts +0 -4
- package/dist/models/configuration/components/BlendModeConfiguration.d.ts +0 -4
- package/dist/models/configuration/components/ComputedSizeConfiguration.d.ts +0 -4
- package/dist/models/configuration/components/DepthConfiguration.d.ts +0 -4
- package/dist/models/configuration/components/FlipConfiguration.d.ts +0 -4
- package/dist/models/configuration/components/MaskConfiguration.d.ts +0 -4
- package/dist/models/configuration/components/OriginConfiguration.d.ts +0 -5
- package/dist/models/configuration/components/PathFollowerComponentConfiguration.d.ts +0 -4
- package/dist/models/configuration/components/RenderNodesConfiguration.d.ts +0 -4
- package/dist/models/configuration/components/ScrollFactorConfiguration.d.ts +0 -5
- package/dist/models/configuration/components/SizeConfiguration.d.ts +0 -4
- package/dist/models/configuration/components/TextureConfiguration.d.ts +0 -6
- package/dist/models/configuration/components/TextureCropConfiguration.d.ts +0 -6
- package/dist/models/configuration/components/TintConfiguration.d.ts +0 -4
- package/dist/models/configuration/components/TransformConfiguration.d.ts +0 -4
- package/dist/models/configuration/components/VisibleConfiguration.d.ts +0 -4
- package/dist/models/configuration/global/GameObjectConfiguration.d.ts +0 -3
- package/dist/models/configuration/global/GlobalConfiguration.d.ts +0 -4
- package/dist/models/configuration/global/TweenConfiguration.d.ts +0 -5
- package/dist/models/configuration/shared/AnimationConfiguration.d.ts +0 -6
- package/dist/models/configuration/shared/ShapeConfiguration.d.ts +0 -19
- package/dist/models/configuration/shared/TweenBuilderConfiguration.d.ts +0 -3
- package/dist/models/emit/ArcEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/BitmapTextEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/ContainerEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/CurveEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/EllipseEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/GraphicsEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/ImageEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/IsoBoxEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/IsoTriangleEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/LineEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/NinesliceEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/ParticlesEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/PathFollowerEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/PolygonEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/RectangleEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/RenderTextureEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/SpriteEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/StarEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/TextEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/TileSpriteEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/TriangleEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/VideoEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/ZoneEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/components/AlphaEventEmitsOptions.d.ts +0 -3
- package/dist/models/emit/components/AlphaSingleEventEmitsOptions.d.ts +0 -3
- package/dist/models/emit/components/BaseTextureEventEmitsOptions.d.ts +0 -3
- package/dist/models/emit/components/BlendModeEventEmitsOptions.d.ts +0 -3
- package/dist/models/emit/components/ComputedSizeEventEmitsOptions.d.ts +0 -3
- package/dist/models/emit/components/DepthEventEmitsOptions.d.ts +0 -3
- package/dist/models/emit/components/FlipEventEmitsOptions.d.ts +0 -3
- package/dist/models/emit/components/MaskEventEmitsOptions.d.ts +0 -3
- package/dist/models/emit/components/OriginEventEmitsOptions.d.ts +0 -3
- package/dist/models/emit/components/PathFollowerComponentEventEmitsOptions.d.ts +0 -3
- package/dist/models/emit/components/RenderNodesEventEmitsOptions.d.ts +0 -3
- package/dist/models/emit/components/ScrollFactorEventEmitsOptions.d.ts +0 -3
- package/dist/models/emit/components/SizeEventEmitsOptions.d.ts +0 -3
- package/dist/models/emit/components/TextureCropEventEmitsOptions.d.ts +0 -3
- package/dist/models/emit/components/TextureEventEmitsOptions.d.ts +0 -3
- package/dist/models/emit/components/TintEventEmitsOptions.d.ts +0 -3
- package/dist/models/emit/components/TransformEventEmitsOptions.d.ts +0 -3
- package/dist/models/emit/components/VisibleEventEmitsOptions.d.ts +0 -3
- package/dist/models/emit/global/GameObjectEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/global/GlobalEventEmitsOptions.d.ts +0 -4
- package/dist/models/emit/global/TweenEventEmitsOptions.d.ts +0 -3
- package/dist/models/emit/shared/GameObjectEventMapEmitsOptions.d.ts +0 -5
- package/dist/models/emit/shared/ShapeEventEmitsOptions.d.ts +0 -3
- package/dist/models/keys/AnimationKey.d.ts +0 -2
- package/dist/models/lifecycle/HookArgs.d.ts +0 -2
- package/dist/models/lifecycle/Lifecycle.d.ts +0 -8
- package/dist/models/lifecycle/ListenersMap.d.ts +0 -2
- package/dist/models/plugins/TiledJSONExternalFile.d.ts +0 -11
- package/dist/models/plugins/TilemapFile.d.ts +0 -5
- package/dist/models/plugins/TilesetFile.d.ts +0 -7
- package/dist/models/scene/SceneLifecycleHooks.d.ts +0 -7
- package/dist/models/scene/ScenePlugins.d.ts +0 -2
- package/dist/models/scene/SceneProps.d.ts +0 -5
- package/dist/models/scene/SceneWithPlugins.d.ts +0 -4
- package/dist/models/setterMap/SetterMap.d.ts +0 -4
- package/dist/models/text/TextProps.d.ts +0 -6
- package/dist/plugins/registerTiledJSONExternalLoader.d.ts +0 -1
- package/dist/pushGameObject.d.ts +0 -2
- package/dist/store/camera.d.ts +0 -6
- package/dist/store/index.d.ts +0 -12
- package/dist/store/input.d.ts +0 -3
- package/dist/store/scene.d.ts +0 -6
- package/dist/store/text.d.ts +0 -4
- package/dist/test/setup.d.ts +0 -1
- package/dist/test/setupCanvas.d.ts +0 -1
- package/dist/util/InjectionKeyMap.d.ts +0 -6
- package/dist/util/constants.d.ts +0 -1
- package/dist/util/createSceneClass.d.ts +0 -3
- package/dist/util/emit/GameObjectEventMap.d.ts +0 -42
- package/dist/util/emit/constants.d.ts +0 -1
- package/dist/util/emit/getEventName.d.ts +0 -1
- package/dist/util/emit/getUpdateEvent.d.ts +0 -3
- package/dist/util/emit/isEvent.d.ts +0 -1
- package/dist/util/getDepthInsertIndex.d.ts +0 -2
- package/dist/util/getScene.d.ts +0 -2
- package/dist/util/hooks/getInitializeGameObjectLifecycleHook.d.ts +0 -1
- package/dist/util/hooks/pushListener.d.ts +0 -3
- package/dist/util/hooks/resetLifecycleListeners.d.ts +0 -3
- package/dist/util/hooks/runLifecycleListeners.d.ts +0 -3
- package/dist/util/setterMap/ArcSetterMap.d.ts +0 -5
- package/dist/util/setterMap/BitmapTextSetterMap.d.ts +0 -5
- package/dist/util/setterMap/ContainerSetterMap.d.ts +0 -5
- package/dist/util/setterMap/CurveSetterMap.d.ts +0 -5
- package/dist/util/setterMap/EllipseSetterMap.d.ts +0 -5
- package/dist/util/setterMap/GraphicsSetterMap.d.ts +0 -5
- package/dist/util/setterMap/ImageSetterMap.d.ts +0 -5
- package/dist/util/setterMap/IsoBoxSetterMap.d.ts +0 -5
- package/dist/util/setterMap/IsoTriangleSetterMap.d.ts +0 -5
- package/dist/util/setterMap/LineSetterMap.d.ts +0 -5
- package/dist/util/setterMap/NinesliceSetterMap.d.ts +0 -5
- package/dist/util/setterMap/ParticlesSetterMap.d.ts +0 -5
- package/dist/util/setterMap/PathFollowerSetterMap.d.ts +0 -5
- package/dist/util/setterMap/PolygonSetterMap.d.ts +0 -5
- package/dist/util/setterMap/RectangleSetterMap.d.ts +0 -5
- package/dist/util/setterMap/RenderTextureSetterMap.d.ts +0 -5
- package/dist/util/setterMap/SpriteSetterMap.d.ts +0 -5
- package/dist/util/setterMap/StarSetterMap.d.ts +0 -5
- package/dist/util/setterMap/TextSetterMap.d.ts +0 -5
- package/dist/util/setterMap/TileSpriteSetterMap.d.ts +0 -5
- package/dist/util/setterMap/TriangleSetterMap.d.ts +0 -5
- package/dist/util/setterMap/VideoSetterMap.d.ts +0 -5
- package/dist/util/setterMap/ZoneSetterMap.d.ts +0 -5
- package/dist/util/setterMap/components/AlphaSetterMap.d.ts +0 -8
- package/dist/util/setterMap/components/AlphaSingleSetterMap.d.ts +0 -4
- package/dist/util/setterMap/components/BaseTextureSetterMap.d.ts +0 -5
- package/dist/util/setterMap/components/BlendModeSetterMap.d.ts +0 -4
- package/dist/util/setterMap/components/ComputedSizeSetterMap.d.ts +0 -15
- package/dist/util/setterMap/components/DepthSetterMap.d.ts +0 -4
- package/dist/util/setterMap/components/DisplaySizeSetterMap.d.ts +0 -12
- package/dist/util/setterMap/components/FlipSetterMap.d.ts +0 -5
- package/dist/util/setterMap/components/MaskSetterMap.d.ts +0 -4
- package/dist/util/setterMap/components/OriginSetterMap.d.ts +0 -8
- package/dist/util/setterMap/components/PathFollowerComponentSetterMap.d.ts +0 -4
- package/dist/util/setterMap/components/RenderNodesSetterMap.d.ts +0 -1
- package/dist/util/setterMap/components/ScrollFactorSetterMap.d.ts +0 -6
- package/dist/util/setterMap/components/SizeSetterMap.d.ts +0 -15
- package/dist/util/setterMap/components/TextureCropSetterMap.d.ts +0 -5
- package/dist/util/setterMap/components/TextureSetterMap.d.ts +0 -5
- package/dist/util/setterMap/components/TintSetterMap.d.ts +0 -8
- package/dist/util/setterMap/components/TransformSetterMap.d.ts +0 -12
- package/dist/util/setterMap/components/VisibleSetterMap.d.ts +0 -4
- package/dist/util/setterMap/global/GameObjectSetterMap.d.ts +0 -4
- package/dist/util/setterMap/global/GlobalSetterMap.d.ts +0 -258
- package/dist/util/setterMap/global/TweenSetterMap.d.ts +0 -257
- package/dist/util/setterMap/shared/AnimationSetterMap.d.ts +0 -89
- package/dist/util/setterMap/shared/IsoSetterMap.d.ts +0 -79
- package/dist/util/setterMap/shared/ShapeSetterMap.d.ts +0 -39
- package/dist/util/sleep.d.ts +0 -2
- package/dist/util/types/EmitsOptionsFor.d.ts +0 -5
- package/dist/util/types/ExtractUpdateEvent.d.ts +0 -1
- package/dist/util/types/UpdateEvent.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -1,592 +1,937 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import "./vue-shims-Bl66Srx_.d.ts";
|
|
2
|
+
import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, getCurrentInstance, inject, nextTick, onMounted, onUnmounted, openBlock, provide, ref, renderSlot, toValue, useTemplateRef, watch } from "vue";
|
|
3
|
+
import { ID_SEPARATOR, InvalidOperationError, NotFoundError, NotInitializedError, Operation, checkIsPlainObject, takeOne, toKebabCase } from "@esposter/shared";
|
|
4
|
+
import ClickOutside from "phaser4-rex-plugins/plugins/clickoutside.js";
|
|
5
|
+
import { Animations, Cameras, Game, Loader, Scene, Scenes, Tilemaps, Tweens, Utils } from "phaser";
|
|
6
|
+
import { defineStore, storeToRefs } from "pinia";
|
|
7
|
+
import { parseTileset, parseXmlString } from "parse-tmx";
|
|
7
8
|
//#region src/util/getDepthInsertIndex.ts
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const getDepthInsertIndex = (list, depth) => typeof depth === "number" ? list.findIndex((gameObject) => "depth" in gameObject && typeof gameObject.depth === "number" && gameObject.depth > depth) : -1;
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/pushGameObject.ts
|
|
12
|
+
const pushGameObject = (parentContainer, configuration, gameObject) => {
|
|
13
|
+
const i = getDepthInsertIndex(parentContainer.list, "depth" in configuration ? configuration.depth : void 0);
|
|
14
|
+
if (i === -1) parentContainer.add(gameObject);
|
|
15
|
+
else parentContainer.addAt(gameObject, i);
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/util/emit/GameObjectEventMap.ts
|
|
19
|
+
const GameObjectEventMap = {
|
|
12
20
|
clickoutside: {},
|
|
13
|
-
drag: { drag:
|
|
14
|
-
dragend: { drag:
|
|
15
|
-
dragenter: { drag:
|
|
16
|
-
dragleave: { drag:
|
|
17
|
-
dragover: { drag:
|
|
18
|
-
dragstart: { drag:
|
|
19
|
-
drop: { drag:
|
|
21
|
+
drag: { drag: true },
|
|
22
|
+
dragend: { drag: true },
|
|
23
|
+
dragenter: { drag: true },
|
|
24
|
+
dragleave: { drag: true },
|
|
25
|
+
dragover: { drag: true },
|
|
26
|
+
dragstart: { drag: true },
|
|
27
|
+
drop: { drag: true },
|
|
20
28
|
pointerdown: { eventIndex: 3 },
|
|
21
29
|
pointermove: { eventIndex: 3 },
|
|
22
30
|
pointerout: { eventIndex: 1 },
|
|
23
31
|
pointerover: { eventIndex: 3 },
|
|
24
32
|
pointerup: { eventIndex: 3 },
|
|
25
33
|
wheel: { eventIndex: 4 }
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/util/emit/constants.ts
|
|
37
|
+
const EVENT_PREFIX = "on";
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/util/emit/getEventName.ts
|
|
40
|
+
const getEventName = (event) => {
|
|
41
|
+
if (!event.startsWith("on") || event.length <= 2) throw new InvalidOperationError(Operation.Read, getEventName.name, event);
|
|
42
|
+
return event.slice(2).toLowerCase();
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/util/emit/isEvent.ts
|
|
46
|
+
const isEvent = (property) => property.startsWith("on");
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/composables/useInitializeGameObjectEvents.ts
|
|
49
|
+
const useInitializeGameObjectEvents = () => {
|
|
50
|
+
const currentInstance = getCurrentInstance();
|
|
51
|
+
const events = new Set(Object.keys(currentInstance?.attrs ?? {}).filter((key) => isEvent(key)).map((key) => getEventName(key)));
|
|
52
|
+
const gameObjectEvents = Object.keys(GameObjectEventMap).filter((key) => events.has(key));
|
|
53
|
+
const eventStopHandles = [];
|
|
54
|
+
const initializeGameObjectEvents = (gameObject, emit, scene) => {
|
|
55
|
+
if (gameObjectEvents.length === 0) return;
|
|
56
|
+
if (!gameObject.input) gameObject.setInteractive();
|
|
57
|
+
if (gameObjectEvents.some((key) => "drag" in GameObjectEventMap[key])) scene.input.setDraggable(gameObject);
|
|
58
|
+
for (const gameObjectEvent of gameObjectEvents) {
|
|
59
|
+
const context = GameObjectEventMap[gameObjectEvent];
|
|
60
|
+
const eventListener = (...args) => {
|
|
61
|
+
if ("eventIndex" in context) takeOne(args).stopPropagation = takeOne(args, context.eventIndex).stopPropagation;
|
|
62
|
+
emit(gameObjectEvent, ...args);
|
|
63
|
+
};
|
|
64
|
+
if (gameObjectEvent === "clickoutside") {
|
|
65
|
+
const clickOutside = new ClickOutside(gameObject);
|
|
66
|
+
clickOutside.on(gameObjectEvent, eventListener);
|
|
67
|
+
eventStopHandles.push(() => {
|
|
68
|
+
clickOutside.off(gameObjectEvent, eventListener);
|
|
69
|
+
});
|
|
70
|
+
continue;
|
|
51
71
|
}
|
|
72
|
+
gameObject.on(gameObjectEvent, eventListener);
|
|
73
|
+
eventStopHandles.push(() => {
|
|
74
|
+
gameObject.off(gameObjectEvent, eventListener);
|
|
75
|
+
});
|
|
52
76
|
}
|
|
53
77
|
};
|
|
54
|
-
|
|
78
|
+
return {
|
|
79
|
+
eventStopHandles,
|
|
80
|
+
initializeGameObjectEvents
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/util/InjectionKeyMap.ts
|
|
85
|
+
const InjectionKeyMap = {
|
|
55
86
|
ParentContainer: Symbol("ParentContainer"),
|
|
56
87
|
SceneKey: Symbol("SceneKey")
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
88
|
+
};
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/composables/useInjectSceneKey.ts
|
|
91
|
+
const useInjectSceneKey = () => {
|
|
92
|
+
const sceneKey = inject(InjectionKeyMap.SceneKey);
|
|
93
|
+
if (!sceneKey) throw new NotInitializedError(InjectionKeyMap.SceneKey.description ?? "");
|
|
94
|
+
return sceneKey;
|
|
95
|
+
};
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/models/lifecycle/Lifecycle.ts
|
|
98
|
+
let Lifecycle = /* @__PURE__ */ function(Lifecycle) {
|
|
99
|
+
Lifecycle["Create"] = "Create";
|
|
100
|
+
Lifecycle["Init"] = "Init";
|
|
101
|
+
Lifecycle["NextTick"] = "NextTick";
|
|
102
|
+
Lifecycle["Preload"] = "Preload";
|
|
103
|
+
Lifecycle["Shutdown"] = "Shutdown";
|
|
104
|
+
Lifecycle["Update"] = "Update";
|
|
105
|
+
return Lifecycle;
|
|
106
|
+
}({});
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/store/scene.ts
|
|
109
|
+
const ExternalSceneStore = {
|
|
64
110
|
lifecycleListenersMap: /* @__PURE__ */ new Map(),
|
|
65
111
|
sceneReadyMap: /* @__PURE__ */ new Map()
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
112
|
+
};
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/util/hooks/pushListener.ts
|
|
115
|
+
const pushListener = (lifecycle, listener, key) => {
|
|
116
|
+
const sceneKey = key ?? useInjectSceneKey();
|
|
117
|
+
const listenersMap = ExternalSceneStore.lifecycleListenersMap.get(lifecycle);
|
|
118
|
+
if (!listenersMap) {
|
|
119
|
+
ExternalSceneStore.lifecycleListenersMap.set(lifecycle, /* @__PURE__ */ new Map([[sceneKey, [listener]]]));
|
|
70
120
|
return;
|
|
71
121
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
122
|
+
const listeners = listenersMap.get(sceneKey);
|
|
123
|
+
if (listeners) listeners.push(listener);
|
|
124
|
+
else listenersMap.set(sceneKey, [listener]);
|
|
125
|
+
};
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/hooks/onNextTick.ts
|
|
128
|
+
const onNextTick = (...args) => {
|
|
129
|
+
pushListener("NextTick", ...args);
|
|
130
|
+
};
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/util/emit/getUpdateEvent.ts
|
|
133
|
+
const getUpdateEvent = (property) => `update:${toKebabCase(property)}`;
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/composables/useInitializeGameObjectSetters.ts
|
|
136
|
+
const useInitializeGameObjectSetters = (gameObject, configuration, emit, setterMap, immediate) => {
|
|
137
|
+
const sceneKey = useInjectSceneKey();
|
|
138
|
+
const setters = [];
|
|
139
|
+
const setterWatchHandles = [];
|
|
140
|
+
for (const [key, value] of Object.entries(toValue(configuration))) {
|
|
141
|
+
const setter = setterMap[key];
|
|
142
|
+
if (!setter) continue;
|
|
143
|
+
const updateEvent = getUpdateEvent(key);
|
|
144
|
+
setters.push((targetGameObject) => {
|
|
145
|
+
setter(targetGameObject, emit)(value);
|
|
146
|
+
if (value !== void 0) emit(updateEvent, value);
|
|
147
|
+
else if (key in targetGameObject) emit(updateEvent, targetGameObject[key]);
|
|
148
|
+
});
|
|
149
|
+
setterWatchHandles.push(watch(() => toValue(configuration)[key], (newValue) => {
|
|
150
|
+
const updater = () => {
|
|
151
|
+
setter(toValue(gameObject), emit)(newValue);
|
|
152
|
+
emit(updateEvent, newValue);
|
|
87
153
|
};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
154
|
+
if (immediate) updater();
|
|
155
|
+
else onNextTick(() => {
|
|
156
|
+
updater();
|
|
157
|
+
}, sceneKey);
|
|
158
|
+
}, { deep: true }));
|
|
92
159
|
}
|
|
160
|
+
const initializeGameObjectSetters = (targetGameObject) => {
|
|
161
|
+
for (const setter of setters) setter(targetGameObject);
|
|
162
|
+
};
|
|
93
163
|
return {
|
|
94
|
-
initializeGameObjectSetters
|
|
95
|
-
|
|
96
|
-
},
|
|
97
|
-
setterWatchHandles: s
|
|
164
|
+
initializeGameObjectSetters,
|
|
165
|
+
setterWatchHandles
|
|
98
166
|
};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
167
|
+
};
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region src/store/index.ts
|
|
170
|
+
const usePhaserStore = defineStore("phaser", () => {
|
|
171
|
+
let baseGame;
|
|
172
|
+
const game = computed({
|
|
173
|
+
get: () => baseGame,
|
|
174
|
+
set: (newGame) => {
|
|
175
|
+
baseGame = newGame;
|
|
104
176
|
}
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
177
|
+
});
|
|
178
|
+
const sceneKey = ref();
|
|
179
|
+
const rootSceneKey = sceneKey;
|
|
180
|
+
const isSameScene = (newSceneKey) => newSceneKey === sceneKey.value;
|
|
181
|
+
const switchToScene = async (newSceneKey) => {
|
|
182
|
+
if (isSameScene(newSceneKey)) return;
|
|
183
|
+
const activeGame = game.value;
|
|
184
|
+
if (!activeGame) throw new NotInitializedError(Game.name);
|
|
185
|
+
const oldSceneKey = sceneKey.value;
|
|
186
|
+
sceneKey.value = newSceneKey;
|
|
187
|
+
await nextTick();
|
|
188
|
+
if (oldSceneKey && activeGame.scene.isActive(oldSceneKey)) activeGame.scene.stop(oldSceneKey);
|
|
189
|
+
activeGame.scene.start(newSceneKey);
|
|
190
|
+
};
|
|
191
|
+
const parallelSceneKeys = ref([]);
|
|
192
|
+
const prioritizedParallelSceneKeys = ref([]);
|
|
193
|
+
const launchParallelScene = (scene, targetSceneKey) => {
|
|
194
|
+
if (parallelSceneKeys.value.includes(targetSceneKey)) return;
|
|
195
|
+
scene.scene.bringToTop(targetSceneKey);
|
|
196
|
+
for (const prioritizedParallelSceneKey of prioritizedParallelSceneKeys.value) if (parallelSceneKeys.value.includes(prioritizedParallelSceneKey)) scene.scene.bringToTop(prioritizedParallelSceneKey);
|
|
197
|
+
scene.scene.launch(targetSceneKey);
|
|
198
|
+
parallelSceneKeys.value.push(targetSceneKey);
|
|
199
|
+
};
|
|
200
|
+
const removeParallelScene = (scene, targetSceneKey) => {
|
|
201
|
+
const index = parallelSceneKeys.value.indexOf(targetSceneKey);
|
|
202
|
+
if (index === -1) return;
|
|
203
|
+
const parallelSceneKey = parallelSceneKeys.value[index];
|
|
204
|
+
parallelSceneKeys.value = parallelSceneKeys.value.toSpliced(index, 1);
|
|
205
|
+
scene.scene.stop(parallelSceneKey);
|
|
206
|
+
};
|
|
112
207
|
return {
|
|
113
|
-
game
|
|
114
|
-
isSameScene
|
|
115
|
-
launchParallelScene
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
},
|
|
122
|
-
parallelSceneKeys: s,
|
|
123
|
-
prioritizedParallelSceneKeys: l,
|
|
124
|
-
removeParallelScene: (e, t) => {
|
|
125
|
-
let n = s.value.indexOf(t);
|
|
126
|
-
if (n === -1) return;
|
|
127
|
-
let r = s.value.splice(n, 1)[0];
|
|
128
|
-
e.scene.stop(r);
|
|
129
|
-
},
|
|
130
|
-
rootSceneKey: i,
|
|
131
|
-
switchToScene: o
|
|
208
|
+
game,
|
|
209
|
+
isSameScene,
|
|
210
|
+
launchParallelScene,
|
|
211
|
+
parallelSceneKeys,
|
|
212
|
+
prioritizedParallelSceneKeys,
|
|
213
|
+
removeParallelScene,
|
|
214
|
+
rootSceneKey,
|
|
215
|
+
switchToScene
|
|
132
216
|
};
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
217
|
+
});
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region src/composables/useGame.ts
|
|
220
|
+
const useGame = () => {
|
|
221
|
+
const phaserStore = usePhaserStore();
|
|
222
|
+
const { game } = storeToRefs(phaserStore);
|
|
223
|
+
if (!game.value) throw new NotInitializedError(Game.name);
|
|
224
|
+
return game.value;
|
|
225
|
+
};
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region src/util/getScene.ts
|
|
228
|
+
const getScene = (sceneKey) => {
|
|
229
|
+
return useGame().scene.getScene(sceneKey);
|
|
230
|
+
};
|
|
231
|
+
//#endregion
|
|
232
|
+
//#region src/hooks/onCreate.ts
|
|
233
|
+
const onCreate = (...args) => {
|
|
234
|
+
pushListener("Create", ...args);
|
|
235
|
+
};
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region src/util/hooks/getInitializeGameObjectLifecycleHook.ts
|
|
238
|
+
const getInitializeGameObjectLifecycleHook = (sceneKey) => ExternalSceneStore.sceneReadyMap.get(sceneKey) ? onNextTick : onCreate;
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/composables/useInitializeGameObject.ts
|
|
241
|
+
const useInitializeGameObject = (create, configuration, emit, setterMap, immediate) => {
|
|
242
|
+
let gameObject;
|
|
243
|
+
const { initializeGameObjectSetters, setterWatchHandles } = useInitializeGameObjectSetters(() => gameObject, configuration, emit, setterMap, immediate);
|
|
244
|
+
const { eventStopHandles, initializeGameObjectEvents } = useInitializeGameObjectEvents();
|
|
245
|
+
const parentContainer = inject(InjectionKeyMap.ParentContainer, void 0);
|
|
246
|
+
const sceneKey = useInjectSceneKey();
|
|
247
|
+
const lifecycleHook = getInitializeGameObjectLifecycleHook(sceneKey);
|
|
248
|
+
const initializeGameObject = (scene) => {
|
|
249
|
+
gameObject = create(scene);
|
|
250
|
+
initializeGameObjectSetters(gameObject);
|
|
251
|
+
initializeGameObjectEvents(gameObject, emit, scene);
|
|
144
252
|
};
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
253
|
+
const pushToParentContainer = () => {
|
|
254
|
+
if (!parentContainer?.value) return;
|
|
255
|
+
pushGameObject(parentContainer.value, toValue(configuration), gameObject);
|
|
256
|
+
};
|
|
257
|
+
if (immediate) {
|
|
258
|
+
initializeGameObject(getScene(sceneKey));
|
|
259
|
+
lifecycleHook(() => {
|
|
260
|
+
pushToParentContainer();
|
|
261
|
+
});
|
|
262
|
+
} else lifecycleHook((scene) => {
|
|
263
|
+
initializeGameObject(scene);
|
|
264
|
+
pushToParentContainer();
|
|
153
265
|
});
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
266
|
+
onUnmounted(() => {
|
|
267
|
+
for (const setterWatchHandle of setterWatchHandles) setterWatchHandle();
|
|
268
|
+
for (const eventStopHandle of eventStopHandles) eventStopHandle();
|
|
269
|
+
gameObject.destroy();
|
|
270
|
+
});
|
|
271
|
+
};
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region src/util/setterMap/components/DisplaySizeSetterMap.ts
|
|
274
|
+
const DisplaySizeSetterMap = {
|
|
275
|
+
displayHeight: (gameObject) => (value) => {
|
|
276
|
+
if (value === void 0) return;
|
|
277
|
+
gameObject.setDisplaySize(gameObject.displayWidth, value);
|
|
278
|
+
},
|
|
279
|
+
displayWidth: (gameObject) => (value) => {
|
|
280
|
+
if (value === void 0) return;
|
|
281
|
+
gameObject.setDisplaySize(value, gameObject.displayHeight);
|
|
160
282
|
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
283
|
+
};
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/util/setterMap/components/ComputedSizeSetterMap.ts
|
|
286
|
+
const ComputedSizeSetterMap = {
|
|
287
|
+
...DisplaySizeSetterMap,
|
|
288
|
+
height: (gameObject) => (value) => {
|
|
289
|
+
if (value === void 0) return;
|
|
290
|
+
gameObject.setSize(gameObject.width, value);
|
|
291
|
+
},
|
|
292
|
+
width: (gameObject) => (value) => {
|
|
293
|
+
if (value === void 0) return;
|
|
294
|
+
gameObject.setSize(value, gameObject.height);
|
|
168
295
|
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
296
|
+
};
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region src/util/setterMap/components/DepthSetterMap.ts
|
|
299
|
+
const DepthSetterMap = { depth: (gameObject) => (value) => {
|
|
300
|
+
if (value === void 0) return;
|
|
301
|
+
gameObject.setDepth(value);
|
|
302
|
+
if (!gameObject.parentContainer) return;
|
|
303
|
+
const i = getDepthInsertIndex(gameObject.parentContainer.list, gameObject.depth);
|
|
304
|
+
if (i === -1) gameObject.parentContainer.bringToTop(gameObject);
|
|
305
|
+
else gameObject.parentContainer.moveTo(gameObject, Math.max(i - 1, 0));
|
|
306
|
+
} };
|
|
307
|
+
//#endregion
|
|
308
|
+
//#region src/util/setterMap/components/OriginSetterMap.ts
|
|
309
|
+
const OriginSetterMap = {
|
|
310
|
+
displayOriginX: (gameObject) => (value) => {
|
|
311
|
+
gameObject.setDisplayOrigin(value, gameObject.displayOriginY);
|
|
176
312
|
},
|
|
177
|
-
displayOriginY: (
|
|
178
|
-
|
|
313
|
+
displayOriginY: (gameObject) => (value) => {
|
|
314
|
+
gameObject.setDisplayOrigin(gameObject.displayOriginX, value);
|
|
179
315
|
},
|
|
180
|
-
origin: (
|
|
181
|
-
|
|
316
|
+
origin: (gameObject) => (value) => {
|
|
317
|
+
gameObject.setOrigin(value, value);
|
|
182
318
|
},
|
|
183
|
-
originX: (
|
|
184
|
-
|
|
319
|
+
originX: (gameObject) => (value) => {
|
|
320
|
+
gameObject.setOrigin(value, gameObject.originY);
|
|
185
321
|
},
|
|
186
|
-
originY: (
|
|
187
|
-
|
|
322
|
+
originY: (gameObject) => (value) => {
|
|
323
|
+
gameObject.setOrigin(gameObject.originX, value);
|
|
188
324
|
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
325
|
+
};
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region src/util/setterMap/components/ScrollFactorSetterMap.ts
|
|
328
|
+
const ScrollFactorSetterMap = {
|
|
329
|
+
scrollFactor: (gameObject) => (value) => {
|
|
330
|
+
if (value === void 0) return;
|
|
331
|
+
gameObject.setScrollFactor(value, value);
|
|
332
|
+
},
|
|
333
|
+
scrollFactorX: (gameObject) => (value) => {
|
|
334
|
+
if (value === void 0) return;
|
|
335
|
+
gameObject.setScrollFactor(value, gameObject.scrollFactorY);
|
|
336
|
+
},
|
|
337
|
+
scrollFactorY: (gameObject) => (value) => {
|
|
338
|
+
if (value === void 0) return;
|
|
339
|
+
gameObject.setScrollFactor(gameObject.scrollFactorX, value);
|
|
198
340
|
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
341
|
+
};
|
|
342
|
+
//#endregion
|
|
343
|
+
//#region src/util/setterMap/components/TransformSetterMap.ts
|
|
344
|
+
const TransformSetterMap = {
|
|
345
|
+
angle: (gameObject) => (value) => {
|
|
346
|
+
gameObject.setAngle(value);
|
|
202
347
|
},
|
|
203
|
-
rotation: (
|
|
204
|
-
|
|
348
|
+
rotation: (gameObject) => (value) => {
|
|
349
|
+
gameObject.setRotation(value);
|
|
205
350
|
},
|
|
206
|
-
scale: (
|
|
207
|
-
|
|
351
|
+
scale: (gameObject) => (value) => {
|
|
352
|
+
gameObject.setScale(value, value);
|
|
208
353
|
},
|
|
209
|
-
scaleX: (
|
|
210
|
-
|
|
354
|
+
scaleX: (gameObject) => (value) => {
|
|
355
|
+
gameObject.setScale(value, gameObject.scaleY);
|
|
211
356
|
},
|
|
212
|
-
scaleY: (
|
|
213
|
-
|
|
357
|
+
scaleY: (gameObject) => (value) => {
|
|
358
|
+
gameObject.setScale(gameObject.scaleX, value);
|
|
214
359
|
},
|
|
215
|
-
w: (
|
|
216
|
-
|
|
360
|
+
w: (gameObject) => (value) => {
|
|
361
|
+
gameObject.setW(value);
|
|
217
362
|
},
|
|
218
|
-
x: (
|
|
219
|
-
|
|
363
|
+
x: (gameObject) => (value) => {
|
|
364
|
+
gameObject.setX(value);
|
|
220
365
|
},
|
|
221
|
-
y: (
|
|
222
|
-
|
|
366
|
+
y: (gameObject) => (value) => {
|
|
367
|
+
gameObject.setY(value);
|
|
223
368
|
},
|
|
224
|
-
z: (
|
|
225
|
-
|
|
369
|
+
z: (gameObject) => (value) => {
|
|
370
|
+
gameObject.setZ(value);
|
|
226
371
|
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
372
|
+
};
|
|
373
|
+
//#endregion
|
|
374
|
+
//#region src/util/setterMap/components/VisibleSetterMap.ts
|
|
375
|
+
const VisibleSetterMap = { visible: (gameObject) => (value) => {
|
|
376
|
+
if (value === void 0) return;
|
|
377
|
+
gameObject.setVisible(value);
|
|
378
|
+
} };
|
|
379
|
+
//#endregion
|
|
380
|
+
//#region src/util/setterMap/global/GameObjectSetterMap.ts
|
|
381
|
+
const GameObjectSetterMap = { active: (gameObject) => (value) => {
|
|
382
|
+
if (value === void 0) return;
|
|
383
|
+
gameObject.setActive(value);
|
|
384
|
+
} };
|
|
385
|
+
//#endregion
|
|
386
|
+
//#region src/util/setterMap/global/TweenSetterMap.ts
|
|
387
|
+
const TweenSetterMap = {
|
|
388
|
+
tween: (gameObject, emit) => (value) => {
|
|
389
|
+
if (!value) return;
|
|
390
|
+
gameObject.scene.add.tween({
|
|
391
|
+
...value,
|
|
392
|
+
targets: gameObject
|
|
393
|
+
}).on(Tweens.Events.TWEEN_COMPLETE, () => {
|
|
394
|
+
emit("update:tween", void 0);
|
|
238
395
|
});
|
|
239
396
|
},
|
|
240
|
-
tweenchain: (
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
397
|
+
tweenchain: (gameObject, emit) => (value) => {
|
|
398
|
+
if (!value) return;
|
|
399
|
+
gameObject.scene.add.tweenchain(value.map((c) => ({
|
|
400
|
+
...c,
|
|
401
|
+
targets: gameObject
|
|
402
|
+
}))).on(Tweens.Events.TWEEN_COMPLETE, () => {
|
|
403
|
+
emit("update:tweenchain", void 0);
|
|
246
404
|
});
|
|
247
405
|
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
...
|
|
253
|
-
...
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
...
|
|
259
|
-
|
|
406
|
+
};
|
|
407
|
+
//#endregion
|
|
408
|
+
//#region src/util/setterMap/global/GlobalSetterMap.ts
|
|
409
|
+
const GlobalSetterMap = {
|
|
410
|
+
...TweenSetterMap,
|
|
411
|
+
...GameObjectSetterMap
|
|
412
|
+
};
|
|
413
|
+
//#endregion
|
|
414
|
+
//#region src/util/setterMap/ZoneSetterMap.ts
|
|
415
|
+
const ZoneSetterMap = {
|
|
416
|
+
...ComputedSizeSetterMap,
|
|
417
|
+
...DepthSetterMap,
|
|
418
|
+
...OriginSetterMap,
|
|
419
|
+
...TransformSetterMap,
|
|
420
|
+
...ScrollFactorSetterMap,
|
|
421
|
+
...VisibleSetterMap,
|
|
422
|
+
...GlobalSetterMap
|
|
423
|
+
};
|
|
424
|
+
//#endregion
|
|
425
|
+
//#region src/components/Zone.vue
|
|
426
|
+
const _sfc_main$26 = /*@__PURE__*/ defineComponent({
|
|
260
427
|
__name: "Zone",
|
|
261
428
|
props: { configuration: {} },
|
|
262
|
-
setup(
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
return
|
|
266
|
-
}, () =>
|
|
429
|
+
setup(__props, { emit: __emit }) {
|
|
430
|
+
useInitializeGameObject((scene) => {
|
|
431
|
+
const { height, width, x, y } = __props.configuration;
|
|
432
|
+
return scene.add.zone(x, y, width, height);
|
|
433
|
+
}, () => __props.configuration, __emit, ZoneSetterMap);
|
|
434
|
+
return (_ctx, _cache) => {
|
|
435
|
+
return null;
|
|
436
|
+
};
|
|
267
437
|
}
|
|
268
|
-
})
|
|
269
|
-
|
|
270
|
-
|
|
438
|
+
});
|
|
439
|
+
//#endregion
|
|
440
|
+
//#region src/util/setterMap/components/AlphaSetterMap.ts
|
|
441
|
+
const AlphaSetterMap = {
|
|
442
|
+
alpha: (gameObject) => (value) => {
|
|
443
|
+
gameObject.setAlpha(value, value, value, value);
|
|
271
444
|
},
|
|
272
|
-
alphaBottomLeft: (
|
|
273
|
-
|
|
445
|
+
alphaBottomLeft: (gameObject) => (value) => {
|
|
446
|
+
gameObject.setAlpha(gameObject.alphaTopLeft, gameObject.alphaTopRight, value, gameObject.alphaBottomRight);
|
|
274
447
|
},
|
|
275
|
-
alphaBottomRight: (
|
|
276
|
-
|
|
448
|
+
alphaBottomRight: (gameObject) => (value) => {
|
|
449
|
+
gameObject.setAlpha(gameObject.alphaTopLeft, gameObject.alphaTopRight, gameObject.alphaBottomLeft, value);
|
|
277
450
|
},
|
|
278
|
-
alphaTopLeft: (
|
|
279
|
-
|
|
451
|
+
alphaTopLeft: (gameObject) => (value) => {
|
|
452
|
+
gameObject.setAlpha(value, gameObject.alphaTopRight, gameObject.alphaBottomLeft, gameObject.alphaBottomRight);
|
|
280
453
|
},
|
|
281
|
-
alphaTopRight: (
|
|
282
|
-
|
|
454
|
+
alphaTopRight: (gameObject) => (value) => {
|
|
455
|
+
gameObject.setAlpha(gameObject.alphaTopLeft, value, gameObject.alphaBottomLeft, gameObject.alphaBottomRight);
|
|
283
456
|
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
457
|
+
};
|
|
458
|
+
//#endregion
|
|
459
|
+
//#region src/util/setterMap/components/BlendModeSetterMap.ts
|
|
460
|
+
const BlendModeSetterMap = { blendMode: (gameObject) => (value) => {
|
|
461
|
+
if (value === void 0) return;
|
|
462
|
+
gameObject.setBlendMode(value);
|
|
463
|
+
} };
|
|
464
|
+
//#endregion
|
|
465
|
+
//#region src/util/setterMap/components/FlipSetterMap.ts
|
|
466
|
+
const FlipSetterMap = {
|
|
467
|
+
flipX: (gameObject) => (value) => {
|
|
468
|
+
if (value === void 0) return;
|
|
469
|
+
gameObject.setFlipX(value);
|
|
470
|
+
},
|
|
471
|
+
flipY: (gameObject) => (value) => {
|
|
472
|
+
if (value === void 0) return;
|
|
473
|
+
gameObject.setFlipY(value);
|
|
292
474
|
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
475
|
+
};
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region src/util/setterMap/components/MaskSetterMap.ts
|
|
478
|
+
const MaskSetterMap = { mask: (gameObject) => (value) => {
|
|
479
|
+
if (!value) return;
|
|
480
|
+
gameObject.setMask(value);
|
|
481
|
+
} };
|
|
482
|
+
//#endregion
|
|
483
|
+
//#region src/util/setterMap/components/RenderNodesSetterMap.ts
|
|
484
|
+
const RenderNodesSetterMap = {};
|
|
485
|
+
//#endregion
|
|
486
|
+
//#region src/util/setterMap/components/BaseTextureSetterMap.ts
|
|
487
|
+
const BaseTextureSetterMap = {
|
|
488
|
+
frame: (gameObject) => (value) => {
|
|
489
|
+
if (value === void 0) return;
|
|
490
|
+
gameObject.setFrame(value);
|
|
491
|
+
},
|
|
492
|
+
texture: (gameObject) => (value) => {
|
|
493
|
+
if (!value) return;
|
|
494
|
+
gameObject.setTexture(value);
|
|
301
495
|
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
496
|
+
};
|
|
497
|
+
//#endregion
|
|
498
|
+
//#region src/util/setterMap/components/TextureCropSetterMap.ts
|
|
499
|
+
const TextureCropSetterMap = { ...BaseTextureSetterMap };
|
|
500
|
+
//#endregion
|
|
501
|
+
//#region src/util/setterMap/components/TintSetterMap.ts
|
|
502
|
+
const TintSetterMap = {
|
|
503
|
+
tint: (gameObject) => (value) => {
|
|
504
|
+
gameObject.setTint(value, value, value, value);
|
|
305
505
|
},
|
|
306
|
-
tintBottomLeft: (
|
|
307
|
-
|
|
506
|
+
tintBottomLeft: (gameObject) => (value) => {
|
|
507
|
+
gameObject.setTint(gameObject.tintTopLeft, gameObject.tintTopRight, value, gameObject.tintBottomRight);
|
|
308
508
|
},
|
|
309
|
-
tintBottomRight: (
|
|
310
|
-
|
|
509
|
+
tintBottomRight: (gameObject) => (value) => {
|
|
510
|
+
gameObject.setTint(gameObject.tintTopLeft, gameObject.tintTopRight, gameObject.tintBottomLeft, value);
|
|
311
511
|
},
|
|
312
|
-
tintTopLeft: (
|
|
313
|
-
|
|
512
|
+
tintTopLeft: (gameObject) => (value) => {
|
|
513
|
+
gameObject.setTint(value, gameObject.tintTopRight, gameObject.tintBottomLeft, gameObject.tintBottomRight);
|
|
314
514
|
},
|
|
315
|
-
tintTopRight: (
|
|
316
|
-
|
|
515
|
+
tintTopRight: (gameObject) => (value) => {
|
|
516
|
+
gameObject.setTint(gameObject.tintTopLeft, value, gameObject.tintBottomLeft, gameObject.tintBottomRight);
|
|
317
517
|
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
...
|
|
323
|
-
...
|
|
324
|
-
...
|
|
325
|
-
...
|
|
326
|
-
...
|
|
327
|
-
...
|
|
328
|
-
...
|
|
329
|
-
...
|
|
330
|
-
...
|
|
331
|
-
...
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
518
|
+
};
|
|
519
|
+
//#endregion
|
|
520
|
+
//#region src/util/setterMap/VideoSetterMap.ts
|
|
521
|
+
const VideoSetterMap = {
|
|
522
|
+
...AlphaSetterMap,
|
|
523
|
+
...BlendModeSetterMap,
|
|
524
|
+
...DepthSetterMap,
|
|
525
|
+
...FlipSetterMap,
|
|
526
|
+
...MaskSetterMap,
|
|
527
|
+
...OriginSetterMap,
|
|
528
|
+
...RenderNodesSetterMap,
|
|
529
|
+
...ScrollFactorSetterMap,
|
|
530
|
+
...TextureCropSetterMap,
|
|
531
|
+
...TintSetterMap,
|
|
532
|
+
...TransformSetterMap,
|
|
533
|
+
...VisibleSetterMap,
|
|
534
|
+
...GlobalSetterMap,
|
|
535
|
+
key: (gameObject) => (value) => {
|
|
536
|
+
if (!value) return;
|
|
537
|
+
gameObject.changeSource(value);
|
|
538
|
+
},
|
|
539
|
+
muted: (gameObject) => (value) => {
|
|
540
|
+
gameObject.setMute(value);
|
|
541
|
+
},
|
|
542
|
+
volume: (gameObject) => (value) => {
|
|
543
|
+
gameObject.setVolume(value);
|
|
340
544
|
}
|
|
341
|
-
}
|
|
545
|
+
};
|
|
546
|
+
//#endregion
|
|
547
|
+
//#region src/components/Video.vue
|
|
548
|
+
const _sfc_main$25 = /*@__PURE__*/ defineComponent({
|
|
342
549
|
__name: "Video",
|
|
343
550
|
props: {
|
|
344
551
|
configuration: {},
|
|
345
552
|
immediate: { type: Boolean },
|
|
346
553
|
onComplete: { type: Function }
|
|
347
554
|
},
|
|
348
|
-
setup(
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
555
|
+
setup(__props, { emit: __emit }) {
|
|
556
|
+
useInitializeGameObject((scene) => {
|
|
557
|
+
const { key, x, y } = __props.configuration;
|
|
558
|
+
const video = scene.add.video(x ?? 0, y ?? 0, key);
|
|
559
|
+
__props.onComplete?.(scene, video);
|
|
560
|
+
return video;
|
|
561
|
+
}, () => __props.configuration, __emit, VideoSetterMap, __props.immediate);
|
|
562
|
+
return (_ctx, _cache) => {
|
|
563
|
+
return null;
|
|
564
|
+
};
|
|
353
565
|
}
|
|
354
|
-
})
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
...
|
|
364
|
-
...
|
|
365
|
-
...
|
|
366
|
-
...
|
|
367
|
-
...
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
566
|
+
});
|
|
567
|
+
//#endregion
|
|
568
|
+
//#region src/util/setterMap/components/AlphaSingleSetterMap.ts
|
|
569
|
+
const AlphaSingleSetterMap = { alpha: (gameObject) => (value) => {
|
|
570
|
+
gameObject.setAlpha(value);
|
|
571
|
+
} };
|
|
572
|
+
//#endregion
|
|
573
|
+
//#region src/util/setterMap/shared/ShapeSetterMap.ts
|
|
574
|
+
const ShapeSetterMap = {
|
|
575
|
+
...AlphaSingleSetterMap,
|
|
576
|
+
...BlendModeSetterMap,
|
|
577
|
+
...DepthSetterMap,
|
|
578
|
+
...DisplaySizeSetterMap,
|
|
579
|
+
...GameObjectSetterMap,
|
|
580
|
+
...MaskSetterMap,
|
|
581
|
+
...OriginSetterMap,
|
|
582
|
+
...RenderNodesSetterMap,
|
|
583
|
+
...ScrollFactorSetterMap,
|
|
584
|
+
...TransformSetterMap,
|
|
585
|
+
...VisibleSetterMap,
|
|
586
|
+
fillAlpha: (gameObject) => (value) => {
|
|
587
|
+
gameObject.setFillStyle(gameObject.fillColor, value);
|
|
588
|
+
},
|
|
589
|
+
fillColor: (gameObject) => (value) => {
|
|
590
|
+
gameObject.setFillStyle(value, gameObject.fillAlpha);
|
|
591
|
+
},
|
|
592
|
+
strokeStyle: (gameObject) => (value) => {
|
|
593
|
+
if (!value) return;
|
|
594
|
+
gameObject.setStrokeStyle(...value);
|
|
376
595
|
}
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
596
|
+
};
|
|
597
|
+
//#endregion
|
|
598
|
+
//#region src/util/setterMap/TriangleSetterMap.ts
|
|
599
|
+
const TriangleSetterMap = {
|
|
600
|
+
to: (gameObject) => (value) => {
|
|
601
|
+
if (!value) return;
|
|
602
|
+
gameObject.setTo(...value);
|
|
603
|
+
},
|
|
604
|
+
...ShapeSetterMap,
|
|
605
|
+
...GlobalSetterMap
|
|
606
|
+
};
|
|
607
|
+
//#endregion
|
|
608
|
+
//#region src/components/Triangle.vue
|
|
609
|
+
const _sfc_main$24 = /*@__PURE__*/ defineComponent({
|
|
384
610
|
__name: "Triangle",
|
|
385
611
|
props: {
|
|
386
612
|
configuration: {},
|
|
387
613
|
immediate: { type: Boolean },
|
|
388
614
|
onComplete: { type: Function }
|
|
389
615
|
},
|
|
390
|
-
setup(
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
616
|
+
setup(__props, { emit: __emit }) {
|
|
617
|
+
useInitializeGameObject((scene) => {
|
|
618
|
+
const { alpha, fillColor, to, x, y } = __props.configuration;
|
|
619
|
+
const triangle = scene.add.triangle(x, y, to?.[0], to?.[1], to?.[2], to?.[3], to?.[4], to?.[5], fillColor, alpha);
|
|
620
|
+
__props.onComplete?.(scene, triangle);
|
|
621
|
+
return triangle;
|
|
622
|
+
}, () => __props.configuration, __emit, TriangleSetterMap, __props.immediate);
|
|
623
|
+
return (_ctx, _cache) => {
|
|
624
|
+
return null;
|
|
625
|
+
};
|
|
395
626
|
}
|
|
396
|
-
})
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
...
|
|
404
|
-
...
|
|
405
|
-
...
|
|
406
|
-
...
|
|
407
|
-
...
|
|
408
|
-
...
|
|
409
|
-
...
|
|
410
|
-
...
|
|
411
|
-
|
|
627
|
+
});
|
|
628
|
+
//#endregion
|
|
629
|
+
//#region src/util/setterMap/components/TextureSetterMap.ts
|
|
630
|
+
const TextureSetterMap = { ...BaseTextureSetterMap };
|
|
631
|
+
//#endregion
|
|
632
|
+
//#region src/util/setterMap/TileSpriteSetterMap.ts
|
|
633
|
+
const TileSpriteSetterMap = {
|
|
634
|
+
...AlphaSetterMap,
|
|
635
|
+
...BlendModeSetterMap,
|
|
636
|
+
...ComputedSizeSetterMap,
|
|
637
|
+
...DepthSetterMap,
|
|
638
|
+
...FlipSetterMap,
|
|
639
|
+
...MaskSetterMap,
|
|
640
|
+
...OriginSetterMap,
|
|
641
|
+
...RenderNodesSetterMap,
|
|
642
|
+
...ScrollFactorSetterMap,
|
|
643
|
+
...TextureSetterMap,
|
|
644
|
+
...TintSetterMap,
|
|
645
|
+
...TransformSetterMap,
|
|
646
|
+
...VisibleSetterMap,
|
|
647
|
+
...GlobalSetterMap
|
|
648
|
+
};
|
|
649
|
+
//#endregion
|
|
650
|
+
//#region src/components/TileSprite.vue
|
|
651
|
+
const _sfc_main$22 = /*@__PURE__*/ defineComponent({
|
|
412
652
|
__name: "TileSprite",
|
|
413
653
|
props: {
|
|
414
654
|
configuration: {},
|
|
415
655
|
immediate: { type: Boolean },
|
|
416
656
|
onComplete: { type: Function }
|
|
417
657
|
},
|
|
418
|
-
setup(
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
658
|
+
setup(__props, { emit: __emit }) {
|
|
659
|
+
useInitializeGameObject((scene) => {
|
|
660
|
+
const { frame, height, texture, width, x, y } = __props.configuration;
|
|
661
|
+
const tileSprite = scene.add.tileSprite(x ?? 0, y ?? 0, width ?? 0, height ?? 0, texture, frame);
|
|
662
|
+
__props.onComplete?.(scene, tileSprite);
|
|
663
|
+
return tileSprite;
|
|
664
|
+
}, () => __props.configuration, __emit, TileSpriteSetterMap, __props.immediate);
|
|
665
|
+
return (_ctx, _cache) => {
|
|
666
|
+
return null;
|
|
667
|
+
};
|
|
423
668
|
}
|
|
424
|
-
})
|
|
669
|
+
});
|
|
670
|
+
//#endregion
|
|
671
|
+
//#region src/components/Tilemap.vue
|
|
672
|
+
const _sfc_main$23 = /*@__PURE__*/ defineComponent({
|
|
425
673
|
__name: "Tilemap",
|
|
426
674
|
props: {
|
|
427
675
|
configuration: {},
|
|
428
676
|
onComplete: { type: Function }
|
|
429
677
|
},
|
|
430
|
-
setup(
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
678
|
+
setup(__props) {
|
|
679
|
+
const sceneKey = useInjectSceneKey();
|
|
680
|
+
const tilemap = ref();
|
|
681
|
+
onCreate((newScene) => {
|
|
682
|
+
tilemap.value = newScene.make.tilemap(__props.configuration);
|
|
683
|
+
__props.onComplete?.(newScene, tilemap.value);
|
|
684
|
+
});
|
|
685
|
+
watch(() => __props.configuration.key, (newKey) => {
|
|
686
|
+
const scene = getScene(sceneKey);
|
|
687
|
+
const oldTilemap = tilemap.value;
|
|
688
|
+
if (newKey) {
|
|
689
|
+
tilemap.value = scene.make.tilemap(__props.configuration);
|
|
690
|
+
__props.onComplete?.(scene, tilemap.value);
|
|
691
|
+
} else tilemap.value = void 0;
|
|
692
|
+
if (oldTilemap) oldTilemap.destroy();
|
|
693
|
+
});
|
|
694
|
+
onUnmounted(() => {
|
|
695
|
+
if (!tilemap.value) return;
|
|
696
|
+
tilemap.value.destroy();
|
|
697
|
+
});
|
|
698
|
+
return (_ctx, _cache) => {
|
|
699
|
+
return renderSlot(_ctx.$slots, "default");
|
|
700
|
+
};
|
|
440
701
|
}
|
|
441
|
-
})
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
702
|
+
});
|
|
703
|
+
//#endregion
|
|
704
|
+
//#region src/store/text.ts
|
|
705
|
+
const useTextStore = defineStore("phaser/text", () => {
|
|
706
|
+
return { defaultTextStyle: ref() };
|
|
707
|
+
});
|
|
708
|
+
//#endregion
|
|
709
|
+
//#region src/util/setterMap/TextSetterMap.ts
|
|
710
|
+
const TextSetterMap = {
|
|
711
|
+
padding: (gameObject) => (value) => {
|
|
712
|
+
if (!value) return;
|
|
713
|
+
gameObject.setPadding(value);
|
|
714
|
+
},
|
|
715
|
+
style: (gameObject) => (value) => {
|
|
716
|
+
if (!value) return;
|
|
717
|
+
gameObject.setStyle(value);
|
|
718
|
+
},
|
|
719
|
+
text: (gameObject, emit) => (value) => {
|
|
720
|
+
if (value === void 0) return;
|
|
721
|
+
gameObject.setText(value);
|
|
722
|
+
emit("update:width", gameObject.width);
|
|
723
|
+
emit("update:displayWidth", gameObject.displayWidth);
|
|
724
|
+
},
|
|
725
|
+
...AlphaSetterMap,
|
|
726
|
+
...BlendModeSetterMap,
|
|
727
|
+
...ComputedSizeSetterMap,
|
|
728
|
+
...DepthSetterMap,
|
|
729
|
+
...FlipSetterMap,
|
|
730
|
+
...MaskSetterMap,
|
|
731
|
+
...OriginSetterMap,
|
|
732
|
+
...RenderNodesSetterMap,
|
|
733
|
+
...ScrollFactorSetterMap,
|
|
734
|
+
...TintSetterMap,
|
|
735
|
+
...TransformSetterMap,
|
|
736
|
+
...VisibleSetterMap,
|
|
737
|
+
...GlobalSetterMap
|
|
738
|
+
};
|
|
739
|
+
//#endregion
|
|
740
|
+
//#region src/components/Text.vue
|
|
741
|
+
const _sfc_main$21 = /*@__PURE__*/ defineComponent({
|
|
465
742
|
__name: "Text",
|
|
466
743
|
props: {
|
|
467
744
|
configuration: {},
|
|
468
745
|
immediate: { type: Boolean }
|
|
469
746
|
},
|
|
470
|
-
setup(
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
747
|
+
setup(__props, { emit: __emit }) {
|
|
748
|
+
const emit = __emit;
|
|
749
|
+
const textStore = useTextStore();
|
|
750
|
+
const { defaultTextStyle } = storeToRefs(textStore);
|
|
751
|
+
useInitializeGameObject((scene) => {
|
|
752
|
+
const { style, text, x, y } = __props.configuration;
|
|
753
|
+
return scene.add.text(x ?? 0, y ?? 0, text, {
|
|
754
|
+
...defaultTextStyle.value,
|
|
755
|
+
...style
|
|
477
756
|
});
|
|
478
|
-
}, () =>
|
|
757
|
+
}, () => __props.configuration, emit, TextSetterMap, __props.immediate);
|
|
758
|
+
return (_ctx, _cache) => {
|
|
759
|
+
return null;
|
|
760
|
+
};
|
|
479
761
|
}
|
|
480
|
-
})
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
762
|
+
});
|
|
763
|
+
//#endregion
|
|
764
|
+
//#region src/util/setterMap/StarSetterMap.ts
|
|
765
|
+
const StarSetterMap = {
|
|
766
|
+
innerRadius: (gameObject) => (value) => {
|
|
767
|
+
if (value === void 0) return;
|
|
768
|
+
gameObject.setInnerRadius(value);
|
|
769
|
+
},
|
|
770
|
+
outerRadius: (gameObject) => (value) => {
|
|
771
|
+
if (value === void 0) return;
|
|
772
|
+
gameObject.setOuterRadius(value);
|
|
773
|
+
},
|
|
774
|
+
points: (gameObject) => (value) => {
|
|
775
|
+
if (value === void 0) return;
|
|
776
|
+
gameObject.setPoints(value);
|
|
777
|
+
},
|
|
778
|
+
...ShapeSetterMap,
|
|
779
|
+
...GlobalSetterMap
|
|
780
|
+
};
|
|
781
|
+
//#endregion
|
|
782
|
+
//#region src/components/Star.vue
|
|
783
|
+
const _sfc_main$20 = /*@__PURE__*/ defineComponent({
|
|
493
784
|
__name: "Star",
|
|
494
785
|
props: {
|
|
495
786
|
configuration: {},
|
|
496
787
|
immediate: { type: Boolean },
|
|
497
788
|
onComplete: { type: Function }
|
|
498
789
|
},
|
|
499
|
-
setup(
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
790
|
+
setup(__props, { emit: __emit }) {
|
|
791
|
+
useInitializeGameObject((scene) => {
|
|
792
|
+
const { alpha, fillColor, innerRadius, outerRadius, points, x, y } = __props.configuration;
|
|
793
|
+
const star = scene.add.star(x, y, points, innerRadius, outerRadius, fillColor, alpha);
|
|
794
|
+
__props.onComplete?.(scene, star);
|
|
795
|
+
return star;
|
|
796
|
+
}, () => __props.configuration, __emit, StarSetterMap, __props.immediate);
|
|
797
|
+
return (_ctx, _cache) => {
|
|
798
|
+
return null;
|
|
799
|
+
};
|
|
504
800
|
}
|
|
505
|
-
})
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
801
|
+
});
|
|
802
|
+
//#endregion
|
|
803
|
+
//#region src/util/setterMap/components/SizeSetterMap.ts
|
|
804
|
+
const SizeSetterMap = { ...ComputedSizeSetterMap };
|
|
805
|
+
//#endregion
|
|
806
|
+
//#region src/util/setterMap/shared/AnimationSetterMap.ts
|
|
807
|
+
const AnimationSetterMap = {
|
|
808
|
+
animations: (gameObject, emit) => (configurations) => {
|
|
809
|
+
if (!(configurations && configurations.length > 0)) return;
|
|
810
|
+
for (const configuration of configurations) {
|
|
811
|
+
if (!configuration.key) continue;
|
|
812
|
+
const event = `${Animations.Events.ANIMATION_COMPLETE_KEY}${configuration.key}`;
|
|
813
|
+
gameObject.once(event, () => {
|
|
814
|
+
emit(event);
|
|
815
|
+
});
|
|
816
|
+
if (gameObject.scene.anims.exists(configuration.key)) continue;
|
|
817
|
+
else if (!gameObject.scene.anims.create(configuration)) throw new InvalidOperationError(Operation.Create, "Animation", configuration.key);
|
|
513
818
|
}
|
|
514
819
|
},
|
|
515
|
-
playAnimationKey: (
|
|
516
|
-
if (
|
|
517
|
-
|
|
820
|
+
playAnimationKey: (gameObject) => (value) => {
|
|
821
|
+
if (value === void 0) {
|
|
822
|
+
gameObject.stop();
|
|
518
823
|
return;
|
|
519
824
|
}
|
|
520
|
-
|
|
825
|
+
gameObject.play(value);
|
|
521
826
|
}
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
...
|
|
527
|
-
...
|
|
528
|
-
...
|
|
529
|
-
...
|
|
530
|
-
...
|
|
531
|
-
...
|
|
532
|
-
...
|
|
533
|
-
...
|
|
534
|
-
...
|
|
535
|
-
...
|
|
536
|
-
...
|
|
537
|
-
...
|
|
538
|
-
|
|
827
|
+
};
|
|
828
|
+
//#endregion
|
|
829
|
+
//#region src/util/setterMap/SpriteSetterMap.ts
|
|
830
|
+
const SpriteSetterMap = {
|
|
831
|
+
...AlphaSetterMap,
|
|
832
|
+
...BlendModeSetterMap,
|
|
833
|
+
...DepthSetterMap,
|
|
834
|
+
...FlipSetterMap,
|
|
835
|
+
...MaskSetterMap,
|
|
836
|
+
...OriginSetterMap,
|
|
837
|
+
...RenderNodesSetterMap,
|
|
838
|
+
...ScrollFactorSetterMap,
|
|
839
|
+
...SizeSetterMap,
|
|
840
|
+
...TextureSetterMap,
|
|
841
|
+
...TintSetterMap,
|
|
842
|
+
...TransformSetterMap,
|
|
843
|
+
...VisibleSetterMap,
|
|
844
|
+
...AnimationSetterMap,
|
|
845
|
+
...GlobalSetterMap
|
|
846
|
+
};
|
|
847
|
+
//#endregion
|
|
848
|
+
//#region src/components/Sprite.vue
|
|
849
|
+
const _sfc_main$19 = /*@__PURE__*/ defineComponent({
|
|
539
850
|
__name: "Sprite",
|
|
540
851
|
props: {
|
|
541
852
|
configuration: {},
|
|
542
853
|
immediate: { type: Boolean },
|
|
543
854
|
onComplete: { type: Function }
|
|
544
855
|
},
|
|
545
|
-
setup(
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
856
|
+
setup(__props, { emit: __emit }) {
|
|
857
|
+
useInitializeGameObject((scene) => {
|
|
858
|
+
const { frame, texture, x, y } = __props.configuration;
|
|
859
|
+
const sprite = scene.add.sprite(x ?? 0, y ?? 0, texture, frame);
|
|
860
|
+
__props.onComplete?.(scene, sprite);
|
|
861
|
+
return sprite;
|
|
862
|
+
}, () => __props.configuration, __emit, SpriteSetterMap, __props.immediate);
|
|
863
|
+
return (_ctx, _cache) => {
|
|
864
|
+
return null;
|
|
865
|
+
};
|
|
550
866
|
}
|
|
551
|
-
})
|
|
552
|
-
|
|
867
|
+
});
|
|
868
|
+
//#endregion
|
|
869
|
+
//#region src/store/camera.ts
|
|
870
|
+
const useCameraStore = defineStore("phaser/camera", () => {
|
|
871
|
+
const isFading = ref(false);
|
|
872
|
+
const fadeIn = (scene, ...args) => {
|
|
873
|
+
isFading.value = true;
|
|
874
|
+
scene.cameras.main.fadeIn(...args);
|
|
875
|
+
};
|
|
876
|
+
const fadeOut = (scene, ...args) => {
|
|
877
|
+
isFading.value = true;
|
|
878
|
+
scene.cameras.main.fadeOut(...args);
|
|
879
|
+
};
|
|
553
880
|
return {
|
|
554
|
-
fadeIn
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
fadeOut: (t, ...n) => {
|
|
558
|
-
e.value = !0, t.cameras.main.fadeOut(...n);
|
|
559
|
-
},
|
|
560
|
-
isFading: e
|
|
881
|
+
fadeIn,
|
|
882
|
+
fadeOut,
|
|
883
|
+
isFading
|
|
561
884
|
};
|
|
562
|
-
})
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
885
|
+
});
|
|
886
|
+
//#endregion
|
|
887
|
+
//#region src/store/input.ts
|
|
888
|
+
const useInputStore = defineStore("phaser/input", () => {
|
|
889
|
+
return { isInputActive: ref(false) };
|
|
890
|
+
});
|
|
891
|
+
//#endregion
|
|
892
|
+
//#region src/util/hooks/resetLifecycleListeners.ts
|
|
893
|
+
const resetLifecycleListeners = (scene, lifecycle) => {
|
|
894
|
+
const listenersMap = ExternalSceneStore.lifecycleListenersMap.get(lifecycle);
|
|
895
|
+
if (!listenersMap?.has(scene.scene.key)) return;
|
|
896
|
+
listenersMap.set(scene.scene.key, []);
|
|
897
|
+
};
|
|
898
|
+
//#endregion
|
|
899
|
+
//#region src/util/hooks/runLifecycleListeners.ts
|
|
900
|
+
const runLifecycleListeners = (scene, lifecycle, isReset = true) => {
|
|
901
|
+
const listenersMap = ExternalSceneStore.lifecycleListenersMap.get(lifecycle);
|
|
902
|
+
if (!listenersMap) return;
|
|
903
|
+
const listeners = listenersMap.get(scene.scene.key);
|
|
904
|
+
if (!listeners) return;
|
|
905
|
+
for (const listener of listeners) listener(scene);
|
|
906
|
+
if (isReset) resetLifecycleListeners(scene, lifecycle);
|
|
907
|
+
};
|
|
908
|
+
//#endregion
|
|
909
|
+
//#region src/util/createSceneClass.ts
|
|
910
|
+
const createSceneClass = (key, hooks = {}) => class extends Scene {
|
|
574
911
|
constructor() {
|
|
575
|
-
super({ key
|
|
912
|
+
super({ key });
|
|
576
913
|
}
|
|
577
914
|
create() {
|
|
578
|
-
|
|
915
|
+
hooks.onCreate?.(this);
|
|
916
|
+
runLifecycleListeners(this, "Create");
|
|
579
917
|
}
|
|
580
918
|
init() {
|
|
581
|
-
|
|
919
|
+
hooks.onInit?.(this);
|
|
920
|
+
runLifecycleListeners(this, "Init");
|
|
582
921
|
}
|
|
583
922
|
preload() {
|
|
584
|
-
|
|
923
|
+
hooks.onPreload?.(this);
|
|
924
|
+
runLifecycleListeners(this, "Preload");
|
|
585
925
|
}
|
|
586
|
-
update(
|
|
587
|
-
|
|
926
|
+
update(time, delta) {
|
|
927
|
+
hooks.onUpdate?.(this, time, delta);
|
|
928
|
+
runLifecycleListeners(this, "Update", false);
|
|
929
|
+
runLifecycleListeners(this, "NextTick");
|
|
588
930
|
}
|
|
589
|
-
}
|
|
931
|
+
};
|
|
932
|
+
//#endregion
|
|
933
|
+
//#region src/components/Scene.vue
|
|
934
|
+
const _sfc_main$18 = /*@__PURE__*/ defineComponent({
|
|
590
935
|
__name: "Scene",
|
|
591
936
|
props: {
|
|
592
937
|
autoStart: { type: Boolean },
|
|
@@ -599,581 +944,936 @@ var ge = (e, t) => typeof t == "number" ? e.findIndex((e) => "depth" in e && typ
|
|
|
599
944
|
"shutdown",
|
|
600
945
|
"update"
|
|
601
946
|
],
|
|
602
|
-
setup(
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
|
|
947
|
+
setup(__props, { emit: __emit }) {
|
|
948
|
+
const emit = __emit;
|
|
949
|
+
const phaserStore = usePhaserStore();
|
|
950
|
+
const { isSameScene, switchToScene } = phaserStore;
|
|
951
|
+
const cameraStore = useCameraStore();
|
|
952
|
+
const { isFading } = storeToRefs(cameraStore);
|
|
953
|
+
const inputStore = useInputStore();
|
|
954
|
+
const { isInputActive } = storeToRefs(inputStore);
|
|
955
|
+
const { parallelSceneKeys } = storeToRefs(phaserStore);
|
|
956
|
+
const isActive = computed(() => isSameScene(__props.sceneKey) || parallelSceneKeys.value.includes(__props.sceneKey));
|
|
957
|
+
const fadeStartListener = () => {
|
|
958
|
+
isInputActive.value = false;
|
|
959
|
+
};
|
|
960
|
+
const fadeInCompleteListener = () => {
|
|
961
|
+
isFading.value = false;
|
|
962
|
+
isInputActive.value = true;
|
|
963
|
+
};
|
|
964
|
+
const fadeOutCompleteListener = () => {
|
|
965
|
+
isFading.value = false;
|
|
966
|
+
};
|
|
967
|
+
const NewScene = createSceneClass(__props.sceneKey, {
|
|
968
|
+
onCreate: (scene) => {
|
|
969
|
+
emit("create", scene);
|
|
970
|
+
scene.cameras.main.on(Cameras.Scene2D.Events.FADE_IN_START, fadeStartListener);
|
|
971
|
+
scene.cameras.main.on(Cameras.Scene2D.Events.FADE_IN_COMPLETE, fadeInCompleteListener);
|
|
972
|
+
scene.cameras.main.on(Cameras.Scene2D.Events.FADE_OUT_START, fadeStartListener);
|
|
973
|
+
scene.cameras.main.on(Cameras.Scene2D.Events.FADE_OUT_COMPLETE, fadeOutCompleteListener);
|
|
974
|
+
isInputActive.value = true;
|
|
612
975
|
},
|
|
613
|
-
onInit: (
|
|
614
|
-
onPreload: (
|
|
615
|
-
onUpdate: (
|
|
616
|
-
})
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
976
|
+
onInit: (scene) => emit("init", scene),
|
|
977
|
+
onPreload: (scene) => emit("preload", scene),
|
|
978
|
+
onUpdate: (scene, time, delta) => emit("update", scene, time, delta)
|
|
979
|
+
});
|
|
980
|
+
const readyListener = () => {
|
|
981
|
+
ExternalSceneStore.sceneReadyMap.set(__props.sceneKey, true);
|
|
982
|
+
};
|
|
983
|
+
const shutdownListener = () => {
|
|
984
|
+
const scene = getScene(__props.sceneKey);
|
|
985
|
+
resetLifecycleListeners(scene, "Update");
|
|
986
|
+
resetLifecycleListeners(scene, "NextTick");
|
|
987
|
+
runLifecycleListeners(scene, "Shutdown");
|
|
988
|
+
scene.cameras.main.off(Cameras.Scene2D.Events.FADE_IN_START, fadeStartListener);
|
|
989
|
+
scene.cameras.main.off(Cameras.Scene2D.Events.FADE_IN_COMPLETE, fadeInCompleteListener);
|
|
990
|
+
scene.cameras.main.off(Cameras.Scene2D.Events.FADE_OUT_START, fadeStartListener);
|
|
991
|
+
scene.cameras.main.off(Cameras.Scene2D.Events.FADE_OUT_COMPLETE, fadeOutCompleteListener);
|
|
992
|
+
ExternalSceneStore.sceneReadyMap.set(__props.sceneKey, false);
|
|
993
|
+
emit("shutdown", scene);
|
|
621
994
|
};
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
if (!
|
|
625
|
-
console.error(`Failed to add scene: ${
|
|
995
|
+
onMounted(async () => {
|
|
996
|
+
const scene = useGame().scene.add(__props.sceneKey, NewScene);
|
|
997
|
+
if (!scene) {
|
|
998
|
+
console.error(`Failed to add scene: ${__props.sceneKey}`);
|
|
626
999
|
return;
|
|
627
1000
|
}
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
1001
|
+
scene.events.on(Scenes.Events.READY, readyListener);
|
|
1002
|
+
scene.events.on(Scenes.Events.SHUTDOWN, shutdownListener);
|
|
1003
|
+
if (__props.autoStart) await switchToScene(__props.sceneKey);
|
|
1004
|
+
});
|
|
1005
|
+
onUnmounted(() => {
|
|
1006
|
+
const game = useGame();
|
|
1007
|
+
const scene = getScene(__props.sceneKey);
|
|
1008
|
+
scene.events.off(Scenes.Events.READY, readyListener);
|
|
1009
|
+
scene.events.off(Scenes.Events.SHUTDOWN, shutdownListener);
|
|
1010
|
+
game.scene.remove(__props.sceneKey);
|
|
1011
|
+
});
|
|
1012
|
+
provide(InjectionKeyMap.SceneKey, __props.sceneKey);
|
|
1013
|
+
return (_ctx, _cache) => {
|
|
1014
|
+
return isActive.value ? renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 0) : createCommentVNode("v-if", true);
|
|
1015
|
+
};
|
|
633
1016
|
}
|
|
634
|
-
})
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
...
|
|
639
|
-
...
|
|
640
|
-
...
|
|
641
|
-
...
|
|
642
|
-
...
|
|
643
|
-
...
|
|
644
|
-
...
|
|
645
|
-
...
|
|
646
|
-
...
|
|
647
|
-
...
|
|
648
|
-
|
|
1017
|
+
});
|
|
1018
|
+
//#endregion
|
|
1019
|
+
//#region src/util/setterMap/RenderTextureSetterMap.ts
|
|
1020
|
+
const RenderTextureSetterMap = {
|
|
1021
|
+
...AlphaSetterMap,
|
|
1022
|
+
...BlendModeSetterMap,
|
|
1023
|
+
...DepthSetterMap,
|
|
1024
|
+
...FlipSetterMap,
|
|
1025
|
+
...MaskSetterMap,
|
|
1026
|
+
...OriginSetterMap,
|
|
1027
|
+
...RenderNodesSetterMap,
|
|
1028
|
+
...ScrollFactorSetterMap,
|
|
1029
|
+
...SizeSetterMap,
|
|
1030
|
+
...TintSetterMap,
|
|
1031
|
+
...TransformSetterMap,
|
|
1032
|
+
...VisibleSetterMap,
|
|
1033
|
+
...GlobalSetterMap
|
|
1034
|
+
};
|
|
1035
|
+
//#endregion
|
|
1036
|
+
//#region src/components/RenderTexture.vue
|
|
1037
|
+
const _sfc_main$17 = /*@__PURE__*/ defineComponent({
|
|
649
1038
|
__name: "RenderTexture",
|
|
650
1039
|
props: {
|
|
651
1040
|
configuration: {},
|
|
652
1041
|
immediate: { type: Boolean },
|
|
653
1042
|
onComplete: { type: Function }
|
|
654
1043
|
},
|
|
655
|
-
setup(
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
1044
|
+
setup(__props, { emit: __emit }) {
|
|
1045
|
+
useInitializeGameObject((scene) => {
|
|
1046
|
+
const { height, width, x, y } = __props.configuration;
|
|
1047
|
+
const renderTexture = scene.add.renderTexture(x ?? 0, y ?? 0, width, height);
|
|
1048
|
+
__props.onComplete?.(scene, renderTexture);
|
|
1049
|
+
return renderTexture;
|
|
1050
|
+
}, () => __props.configuration, __emit, RenderTextureSetterMap, __props.immediate);
|
|
1051
|
+
return (_ctx, _cache) => {
|
|
1052
|
+
return null;
|
|
1053
|
+
};
|
|
660
1054
|
}
|
|
661
|
-
})
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
1055
|
+
});
|
|
1056
|
+
//#endregion
|
|
1057
|
+
//#region src/util/setterMap/RectangleSetterMap.ts
|
|
1058
|
+
const RectangleSetterMap = {
|
|
1059
|
+
height: ComputedSizeSetterMap.height,
|
|
1060
|
+
width: ComputedSizeSetterMap.width,
|
|
1061
|
+
...ShapeSetterMap,
|
|
1062
|
+
...GlobalSetterMap
|
|
1063
|
+
};
|
|
1064
|
+
//#endregion
|
|
1065
|
+
//#region src/components/Rectangle.vue
|
|
1066
|
+
const _sfc_main$16 = /*@__PURE__*/ defineComponent({
|
|
667
1067
|
__name: "Rectangle",
|
|
668
1068
|
props: {
|
|
669
1069
|
configuration: {},
|
|
670
1070
|
immediate: { type: Boolean },
|
|
671
1071
|
onComplete: { type: Function }
|
|
672
1072
|
},
|
|
673
|
-
setup(
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
1073
|
+
setup(__props, { emit: __emit }) {
|
|
1074
|
+
useInitializeGameObject((scene) => {
|
|
1075
|
+
const { alpha, fillColor, height, width, x, y } = __props.configuration;
|
|
1076
|
+
const rectangle = scene.add.rectangle(x, y, width, height, fillColor, alpha);
|
|
1077
|
+
__props.onComplete?.(scene, rectangle);
|
|
1078
|
+
return rectangle;
|
|
1079
|
+
}, () => __props.configuration, __emit, RectangleSetterMap, __props.immediate);
|
|
1080
|
+
return (_ctx, _cache) => {
|
|
1081
|
+
return null;
|
|
1082
|
+
};
|
|
678
1083
|
}
|
|
679
|
-
})
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
1084
|
+
});
|
|
1085
|
+
//#endregion
|
|
1086
|
+
//#region src/util/setterMap/PolygonSetterMap.ts
|
|
1087
|
+
const PolygonSetterMap = {
|
|
1088
|
+
points: (gameObject) => (value) => {
|
|
1089
|
+
if (!value) return;
|
|
1090
|
+
gameObject.setTo(value);
|
|
1091
|
+
},
|
|
1092
|
+
...ShapeSetterMap,
|
|
1093
|
+
...GlobalSetterMap
|
|
1094
|
+
};
|
|
1095
|
+
//#endregion
|
|
1096
|
+
//#region src/components/Polygon.vue
|
|
1097
|
+
const _sfc_main$15 = /*@__PURE__*/ defineComponent({
|
|
686
1098
|
__name: "Polygon",
|
|
687
1099
|
props: {
|
|
688
1100
|
configuration: {},
|
|
689
1101
|
immediate: { type: Boolean },
|
|
690
1102
|
onComplete: { type: Function }
|
|
691
1103
|
},
|
|
692
|
-
setup(
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
1104
|
+
setup(__props, { emit: __emit }) {
|
|
1105
|
+
useInitializeGameObject((scene) => {
|
|
1106
|
+
const { alpha, fillColor, points, x, y } = __props.configuration;
|
|
1107
|
+
const polygon = scene.add.polygon(x, y, points, fillColor, alpha);
|
|
1108
|
+
__props.onComplete?.(scene, polygon);
|
|
1109
|
+
return polygon;
|
|
1110
|
+
}, () => __props.configuration, __emit, PolygonSetterMap, __props.immediate);
|
|
1111
|
+
return (_ctx, _cache) => {
|
|
1112
|
+
return null;
|
|
1113
|
+
};
|
|
697
1114
|
}
|
|
698
|
-
})
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
...
|
|
709
|
-
...
|
|
710
|
-
...
|
|
711
|
-
...
|
|
712
|
-
...
|
|
713
|
-
...
|
|
714
|
-
...
|
|
715
|
-
...
|
|
716
|
-
|
|
1115
|
+
});
|
|
1116
|
+
//#endregion
|
|
1117
|
+
//#region src/util/setterMap/components/PathFollowerComponentSetterMap.ts
|
|
1118
|
+
const PathFollowerComponentSetterMap = { path: (gameObject) => (value) => {
|
|
1119
|
+
if (!value) return;
|
|
1120
|
+
gameObject.setPath(value);
|
|
1121
|
+
} };
|
|
1122
|
+
//#endregion
|
|
1123
|
+
//#region src/util/setterMap/PathFollowerSetterMap.ts
|
|
1124
|
+
const PathFollowerSetterMap = {
|
|
1125
|
+
...AlphaSetterMap,
|
|
1126
|
+
...BlendModeSetterMap,
|
|
1127
|
+
...DepthSetterMap,
|
|
1128
|
+
...FlipSetterMap,
|
|
1129
|
+
...MaskSetterMap,
|
|
1130
|
+
...OriginSetterMap,
|
|
1131
|
+
...PathFollowerComponentSetterMap,
|
|
1132
|
+
...RenderNodesSetterMap,
|
|
1133
|
+
...ScrollFactorSetterMap,
|
|
1134
|
+
...SizeSetterMap,
|
|
1135
|
+
...TextureSetterMap,
|
|
1136
|
+
...TintSetterMap,
|
|
1137
|
+
...TransformSetterMap,
|
|
1138
|
+
...VisibleSetterMap,
|
|
1139
|
+
...GlobalSetterMap
|
|
1140
|
+
};
|
|
1141
|
+
//#endregion
|
|
1142
|
+
//#region src/components/PathFollower.vue
|
|
1143
|
+
const _sfc_main$14 = /*@__PURE__*/ defineComponent({
|
|
717
1144
|
__name: "PathFollower",
|
|
718
1145
|
props: {
|
|
719
1146
|
configuration: {},
|
|
720
1147
|
onComplete: { type: Function }
|
|
721
1148
|
},
|
|
722
|
-
setup(
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
1149
|
+
setup(__props, { emit: __emit }) {
|
|
1150
|
+
useInitializeGameObject((scene) => {
|
|
1151
|
+
const { frame, path, texture, x, y } = __props.configuration;
|
|
1152
|
+
const pathFollower = scene.add.follower(path, x ?? 0, y ?? 0, texture, frame);
|
|
1153
|
+
__props.onComplete?.(scene, pathFollower);
|
|
1154
|
+
return pathFollower;
|
|
1155
|
+
}, () => __props.configuration, __emit, PathFollowerSetterMap);
|
|
1156
|
+
return (_ctx, _cache) => {
|
|
1157
|
+
return null;
|
|
1158
|
+
};
|
|
727
1159
|
}
|
|
728
|
-
})
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
...
|
|
733
|
-
...
|
|
734
|
-
...
|
|
735
|
-
...
|
|
736
|
-
...
|
|
737
|
-
...
|
|
738
|
-
...
|
|
739
|
-
|
|
740
|
-
|
|
1160
|
+
});
|
|
1161
|
+
//#endregion
|
|
1162
|
+
//#region src/util/setterMap/ParticlesSetterMap.ts
|
|
1163
|
+
const ParticlesSetterMap = {
|
|
1164
|
+
...AlphaSingleSetterMap,
|
|
1165
|
+
...BlendModeSetterMap,
|
|
1166
|
+
...DepthSetterMap,
|
|
1167
|
+
...MaskSetterMap,
|
|
1168
|
+
...RenderNodesSetterMap,
|
|
1169
|
+
...ScrollFactorSetterMap,
|
|
1170
|
+
...TextureSetterMap,
|
|
1171
|
+
...TransformSetterMap,
|
|
1172
|
+
...VisibleSetterMap,
|
|
1173
|
+
...GlobalSetterMap,
|
|
1174
|
+
config: (gameObject) => (value) => {
|
|
1175
|
+
if (!value) return;
|
|
1176
|
+
gameObject.setConfig(value);
|
|
741
1177
|
}
|
|
742
|
-
}
|
|
1178
|
+
};
|
|
1179
|
+
//#endregion
|
|
1180
|
+
//#region src/components/Particles.vue
|
|
1181
|
+
const _sfc_main$13 = /*@__PURE__*/ defineComponent({
|
|
743
1182
|
__name: "Particles",
|
|
744
1183
|
props: {
|
|
745
1184
|
configuration: {},
|
|
746
1185
|
immediate: { type: Boolean },
|
|
747
1186
|
onComplete: { type: Function }
|
|
748
1187
|
},
|
|
749
|
-
setup(
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
1188
|
+
setup(__props, { emit: __emit }) {
|
|
1189
|
+
useInitializeGameObject((scene) => {
|
|
1190
|
+
const { config, texture, x, y } = __props.configuration;
|
|
1191
|
+
const particles = scene.add.particles(x ?? 0, y ?? 0, texture, config);
|
|
1192
|
+
__props.onComplete?.(scene, particles);
|
|
1193
|
+
return particles;
|
|
1194
|
+
}, () => __props.configuration, __emit, ParticlesSetterMap, __props.immediate);
|
|
1195
|
+
return (_ctx, _cache) => {
|
|
1196
|
+
return null;
|
|
1197
|
+
};
|
|
754
1198
|
}
|
|
755
|
-
})
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
...
|
|
762
|
-
...
|
|
763
|
-
...
|
|
764
|
-
...
|
|
765
|
-
...
|
|
766
|
-
...
|
|
767
|
-
...
|
|
768
|
-
...
|
|
769
|
-
|
|
1199
|
+
});
|
|
1200
|
+
//#endregion
|
|
1201
|
+
//#region src/util/setterMap/NinesliceSetterMap.ts
|
|
1202
|
+
const NinesliceSetterMap = {
|
|
1203
|
+
height: ComputedSizeSetterMap.height,
|
|
1204
|
+
width: ComputedSizeSetterMap.width,
|
|
1205
|
+
...AlphaSingleSetterMap,
|
|
1206
|
+
...BlendModeSetterMap,
|
|
1207
|
+
...DepthSetterMap,
|
|
1208
|
+
...MaskSetterMap,
|
|
1209
|
+
...OriginSetterMap,
|
|
1210
|
+
...RenderNodesSetterMap,
|
|
1211
|
+
...ScrollFactorSetterMap,
|
|
1212
|
+
...TextureSetterMap,
|
|
1213
|
+
...TransformSetterMap,
|
|
1214
|
+
...VisibleSetterMap,
|
|
1215
|
+
...GlobalSetterMap
|
|
1216
|
+
};
|
|
1217
|
+
//#endregion
|
|
1218
|
+
//#region src/components/Nineslice.vue
|
|
1219
|
+
const _sfc_main$12 = /*@__PURE__*/ defineComponent({
|
|
770
1220
|
__name: "Nineslice",
|
|
771
1221
|
props: {
|
|
772
1222
|
configuration: {},
|
|
773
1223
|
immediate: { type: Boolean },
|
|
774
1224
|
onComplete: { type: Function }
|
|
775
1225
|
},
|
|
776
|
-
setup(
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
1226
|
+
setup(__props, { emit: __emit }) {
|
|
1227
|
+
useInitializeGameObject((scene) => {
|
|
1228
|
+
const { bottomHeight, frame, height, leftWidth, rightWidth, texture, topHeight, width, x, y } = __props.configuration;
|
|
1229
|
+
const nineSlice = scene.add.nineslice(x ?? 0, y ?? 0, texture, frame, width, height, leftWidth, rightWidth, topHeight, bottomHeight);
|
|
1230
|
+
__props.onComplete?.(scene, nineSlice);
|
|
1231
|
+
return nineSlice;
|
|
1232
|
+
}, () => __props.configuration, __emit, NinesliceSetterMap, __props.immediate);
|
|
1233
|
+
return (_ctx, _cache) => {
|
|
1234
|
+
return null;
|
|
1235
|
+
};
|
|
781
1236
|
}
|
|
782
|
-
})
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
1237
|
+
});
|
|
1238
|
+
//#endregion
|
|
1239
|
+
//#region src/util/setterMap/LineSetterMap.ts
|
|
1240
|
+
const LineSetterMap = {
|
|
1241
|
+
lineWidth: (gameObject) => (value) => {
|
|
1242
|
+
if (value === void 0) return;
|
|
1243
|
+
gameObject.setLineWidth(value);
|
|
1244
|
+
},
|
|
1245
|
+
to: (gameObject) => (value) => {
|
|
1246
|
+
if (!value) return;
|
|
1247
|
+
gameObject.setTo(...value);
|
|
1248
|
+
},
|
|
1249
|
+
...ShapeSetterMap,
|
|
1250
|
+
...GlobalSetterMap
|
|
1251
|
+
};
|
|
1252
|
+
//#endregion
|
|
1253
|
+
//#region src/components/Line.vue
|
|
1254
|
+
const _sfc_main$11 = /*@__PURE__*/ defineComponent({
|
|
792
1255
|
__name: "Line",
|
|
793
1256
|
props: {
|
|
794
1257
|
configuration: {},
|
|
795
1258
|
immediate: { type: Boolean },
|
|
796
1259
|
onComplete: { type: Function }
|
|
797
1260
|
},
|
|
798
|
-
setup(
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
1261
|
+
setup(__props, { emit: __emit }) {
|
|
1262
|
+
useInitializeGameObject((scene) => {
|
|
1263
|
+
const { to, x, y } = __props.configuration;
|
|
1264
|
+
const line = scene.add.line(x, y, to?.[0], to?.[1], to?.[2], to?.[3]);
|
|
1265
|
+
__props.onComplete?.(scene, line);
|
|
1266
|
+
return line;
|
|
1267
|
+
}, () => __props.configuration, __emit, LineSetterMap, __props.immediate);
|
|
1268
|
+
return (_ctx, _cache) => {
|
|
1269
|
+
return null;
|
|
1270
|
+
};
|
|
803
1271
|
}
|
|
804
|
-
})
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
},
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
1272
|
+
});
|
|
1273
|
+
//#endregion
|
|
1274
|
+
//#region src/util/setterMap/shared/IsoSetterMap.ts
|
|
1275
|
+
const IsoSetterMap = {
|
|
1276
|
+
fillLeft: (gameObject) => (value) => {
|
|
1277
|
+
if (value === void 0) return;
|
|
1278
|
+
gameObject.setFillStyle(gameObject.fillTop, value, gameObject.fillRight);
|
|
1279
|
+
},
|
|
1280
|
+
fillRight: (gameObject) => (value) => {
|
|
1281
|
+
if (value === void 0) return;
|
|
1282
|
+
gameObject.setFillStyle(gameObject.fillTop, gameObject.fillLeft, value);
|
|
1283
|
+
},
|
|
1284
|
+
fillTop: (gameObject) => (value) => {
|
|
1285
|
+
if (value === void 0) return;
|
|
1286
|
+
gameObject.setFillStyle(value, gameObject.fillLeft, gameObject.fillRight);
|
|
1287
|
+
},
|
|
1288
|
+
projection: (gameObject) => (value) => {
|
|
1289
|
+
if (value === void 0) return;
|
|
1290
|
+
gameObject.setProjection(value);
|
|
1291
|
+
},
|
|
1292
|
+
showLeft: (gameObject) => (value) => {
|
|
1293
|
+
if (value === void 0) return;
|
|
1294
|
+
gameObject.setFaces(gameObject.showTop, value, gameObject.showRight);
|
|
1295
|
+
},
|
|
1296
|
+
showRight: (gameObject) => (value) => {
|
|
1297
|
+
if (value === void 0) return;
|
|
1298
|
+
gameObject.setFaces(gameObject.showTop, gameObject.showLeft, value);
|
|
1299
|
+
},
|
|
1300
|
+
showTop: (gameObject) => (value) => {
|
|
1301
|
+
if (value === void 0) return;
|
|
1302
|
+
gameObject.setFaces(value, gameObject.showLeft, gameObject.showRight);
|
|
825
1303
|
}
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
},
|
|
1304
|
+
};
|
|
1305
|
+
//#endregion
|
|
1306
|
+
//#region src/util/setterMap/IsoTriangleSetterMap.ts
|
|
1307
|
+
const IsoTriangleSetterMap = {
|
|
1308
|
+
isReversed: (gameObject) => (value) => {
|
|
1309
|
+
if (value === void 0) return;
|
|
1310
|
+
gameObject.setReversed(value);
|
|
1311
|
+
},
|
|
1312
|
+
...IsoSetterMap,
|
|
1313
|
+
...ShapeSetterMap,
|
|
1314
|
+
...GlobalSetterMap
|
|
1315
|
+
};
|
|
1316
|
+
//#endregion
|
|
1317
|
+
//#region src/components/IsoTriangle.vue
|
|
1318
|
+
const _sfc_main$10 = /*@__PURE__*/ defineComponent({
|
|
834
1319
|
__name: "IsoTriangle",
|
|
835
1320
|
props: {
|
|
836
1321
|
configuration: {},
|
|
837
1322
|
immediate: { type: Boolean },
|
|
838
1323
|
onComplete: { type: Function }
|
|
839
1324
|
},
|
|
840
|
-
setup(
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
1325
|
+
setup(__props, { emit: __emit }) {
|
|
1326
|
+
useInitializeGameObject((scene) => {
|
|
1327
|
+
const { fillLeft, fillRight, fillTop, height, isReversed, size, x, y } = __props.configuration;
|
|
1328
|
+
const isoTriangle = scene.add.isotriangle(x, y, size, height, isReversed, fillTop, fillLeft, fillRight);
|
|
1329
|
+
__props.onComplete?.(scene, isoTriangle);
|
|
1330
|
+
return isoTriangle;
|
|
1331
|
+
}, () => __props.configuration, __emit, IsoTriangleSetterMap, __props.immediate);
|
|
1332
|
+
return (_ctx, _cache) => {
|
|
1333
|
+
return null;
|
|
1334
|
+
};
|
|
845
1335
|
}
|
|
846
|
-
})
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
1336
|
+
});
|
|
1337
|
+
//#endregion
|
|
1338
|
+
//#region src/util/setterMap/IsoBoxSetterMap.ts
|
|
1339
|
+
const IsoBoxSetterMap = {
|
|
1340
|
+
...IsoSetterMap,
|
|
1341
|
+
...ShapeSetterMap,
|
|
1342
|
+
...GlobalSetterMap
|
|
1343
|
+
};
|
|
1344
|
+
//#endregion
|
|
1345
|
+
//#region src/components/IsoBox.vue
|
|
1346
|
+
const _sfc_main$9 = /*@__PURE__*/ defineComponent({
|
|
851
1347
|
__name: "IsoBox",
|
|
852
1348
|
props: {
|
|
853
1349
|
configuration: {},
|
|
854
1350
|
immediate: { type: Boolean },
|
|
855
1351
|
onComplete: { type: Function }
|
|
856
1352
|
},
|
|
857
|
-
setup(
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
1353
|
+
setup(__props, { emit: __emit }) {
|
|
1354
|
+
useInitializeGameObject((scene) => {
|
|
1355
|
+
const { fillLeft, fillRight, fillTop, height, size, x, y } = __props.configuration;
|
|
1356
|
+
const isoBox = scene.add.isobox(x, y, size, height, fillTop, fillLeft, fillRight);
|
|
1357
|
+
__props.onComplete?.(scene, isoBox);
|
|
1358
|
+
return isoBox;
|
|
1359
|
+
}, () => __props.configuration, __emit, IsoBoxSetterMap, __props.immediate);
|
|
1360
|
+
return (_ctx, _cache) => {
|
|
1361
|
+
return null;
|
|
1362
|
+
};
|
|
862
1363
|
}
|
|
863
|
-
})
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
...
|
|
868
|
-
...
|
|
869
|
-
...
|
|
870
|
-
...
|
|
871
|
-
...
|
|
872
|
-
...
|
|
873
|
-
...
|
|
874
|
-
...
|
|
875
|
-
...
|
|
876
|
-
...
|
|
877
|
-
...
|
|
878
|
-
|
|
1364
|
+
});
|
|
1365
|
+
//#endregion
|
|
1366
|
+
//#region src/util/setterMap/ImageSetterMap.ts
|
|
1367
|
+
const ImageSetterMap = {
|
|
1368
|
+
...AlphaSetterMap,
|
|
1369
|
+
...BlendModeSetterMap,
|
|
1370
|
+
...DepthSetterMap,
|
|
1371
|
+
...FlipSetterMap,
|
|
1372
|
+
...MaskSetterMap,
|
|
1373
|
+
...OriginSetterMap,
|
|
1374
|
+
...RenderNodesSetterMap,
|
|
1375
|
+
...ScrollFactorSetterMap,
|
|
1376
|
+
...SizeSetterMap,
|
|
1377
|
+
...TextureCropSetterMap,
|
|
1378
|
+
...TintSetterMap,
|
|
1379
|
+
...TransformSetterMap,
|
|
1380
|
+
...VisibleSetterMap,
|
|
1381
|
+
...GlobalSetterMap
|
|
1382
|
+
};
|
|
1383
|
+
//#endregion
|
|
1384
|
+
//#region src/components/Image.vue
|
|
1385
|
+
const _sfc_main$8 = /*@__PURE__*/ defineComponent({
|
|
879
1386
|
__name: "Image",
|
|
880
1387
|
props: {
|
|
881
1388
|
configuration: {},
|
|
882
1389
|
onComplete: { type: Function }
|
|
883
1390
|
},
|
|
884
|
-
setup(
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
1391
|
+
setup(__props, { emit: __emit }) {
|
|
1392
|
+
useInitializeGameObject((scene) => {
|
|
1393
|
+
const { frame, texture, x, y } = __props.configuration;
|
|
1394
|
+
const image = scene.add.image(x ?? 0, y ?? 0, texture, frame);
|
|
1395
|
+
__props.onComplete?.(scene, image);
|
|
1396
|
+
return image;
|
|
1397
|
+
}, () => __props.configuration, __emit, ImageSetterMap);
|
|
1398
|
+
return (_ctx, _cache) => {
|
|
1399
|
+
return null;
|
|
1400
|
+
};
|
|
889
1401
|
}
|
|
890
|
-
})
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
...
|
|
895
|
-
...
|
|
896
|
-
...
|
|
897
|
-
...
|
|
898
|
-
...
|
|
899
|
-
...
|
|
900
|
-
|
|
1402
|
+
});
|
|
1403
|
+
//#endregion
|
|
1404
|
+
//#region src/util/setterMap/GraphicsSetterMap.ts
|
|
1405
|
+
const GraphicsSetterMap = {
|
|
1406
|
+
...AlphaSingleSetterMap,
|
|
1407
|
+
...BlendModeSetterMap,
|
|
1408
|
+
...DepthSetterMap,
|
|
1409
|
+
...MaskSetterMap,
|
|
1410
|
+
...RenderNodesSetterMap,
|
|
1411
|
+
...ScrollFactorSetterMap,
|
|
1412
|
+
...TransformSetterMap,
|
|
1413
|
+
...VisibleSetterMap,
|
|
1414
|
+
...GlobalSetterMap
|
|
1415
|
+
};
|
|
1416
|
+
//#endregion
|
|
1417
|
+
//#region src/components/Graphics.vue
|
|
1418
|
+
const _sfc_main$7 = /*@__PURE__*/ defineComponent({
|
|
901
1419
|
__name: "Graphics",
|
|
902
1420
|
props: {
|
|
903
1421
|
configuration: { default: () => ({}) },
|
|
904
1422
|
immediate: { type: Boolean },
|
|
905
1423
|
onComplete: { type: Function }
|
|
906
1424
|
},
|
|
907
|
-
setup(
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
1425
|
+
setup(__props, { emit: __emit }) {
|
|
1426
|
+
useInitializeGameObject((scene) => {
|
|
1427
|
+
const { x, y } = __props.configuration;
|
|
1428
|
+
const graphics = scene.add.graphics({
|
|
1429
|
+
x,
|
|
1430
|
+
y
|
|
912
1431
|
});
|
|
913
|
-
|
|
914
|
-
|
|
1432
|
+
__props.onComplete?.(scene, graphics);
|
|
1433
|
+
return graphics;
|
|
1434
|
+
}, () => __props.configuration, __emit, GraphicsSetterMap, __props.immediate);
|
|
1435
|
+
return (_ctx, _cache) => {
|
|
1436
|
+
return null;
|
|
1437
|
+
};
|
|
915
1438
|
}
|
|
916
|
-
})
|
|
1439
|
+
});
|
|
1440
|
+
//#endregion
|
|
1441
|
+
//#region src/models/plugins/TilesetFile.ts
|
|
1442
|
+
const XMLFile = Loader.FileTypes.XMLFile;
|
|
1443
|
+
var TilesetFile = class extends XMLFile {
|
|
917
1444
|
tilesetIndex;
|
|
918
|
-
constructor(
|
|
919
|
-
super(...
|
|
1445
|
+
constructor(tilesetIndex, ...args) {
|
|
1446
|
+
super(...args);
|
|
1447
|
+
this.tilesetIndex = tilesetIndex;
|
|
920
1448
|
}
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
1449
|
+
};
|
|
1450
|
+
//#endregion
|
|
1451
|
+
//#region src/models/plugins/TiledJSONExternalFile.ts
|
|
1452
|
+
const GetFastValue = Utils.Objects.GetFastValue;
|
|
1453
|
+
const JSONFile$1 = Loader.FileTypes.JSONFile;
|
|
1454
|
+
const MultiFile = Loader.MultiFile;
|
|
1455
|
+
var TiledJSONExternalFile = class extends MultiFile {
|
|
1456
|
+
constructor(loader, key, tilemapURL, path, baseURL, tilemapXhrSettings, tilesetXhrSettings) {
|
|
1457
|
+
if (checkIsPlainObject(key)) {
|
|
1458
|
+
const configuration = key;
|
|
1459
|
+
key = GetFastValue(configuration, "key");
|
|
1460
|
+
tilemapURL = GetFastValue(configuration, "url");
|
|
1461
|
+
tilemapXhrSettings = GetFastValue(configuration, "xhrSettings");
|
|
1462
|
+
path = GetFastValue(configuration, "path");
|
|
1463
|
+
baseURL = GetFastValue(configuration, "baseURL");
|
|
1464
|
+
tilesetXhrSettings = GetFastValue(configuration, "tilesetXhrSettings");
|
|
926
1465
|
}
|
|
927
|
-
|
|
928
|
-
super(
|
|
1466
|
+
const tilemapFile = new JSONFile$1(loader, key, tilemapURL, tilemapXhrSettings);
|
|
1467
|
+
super(loader, "tilemapJSON", key, [tilemapFile]);
|
|
1468
|
+
this.config.path = path;
|
|
1469
|
+
this.config.baseURL = baseURL;
|
|
1470
|
+
this.config.tilesetXhrSettings = tilesetXhrSettings;
|
|
929
1471
|
}
|
|
930
1472
|
async addToCache() {
|
|
931
1473
|
if (!this.isReadyToProcess()) return;
|
|
932
|
-
|
|
933
|
-
if (!(
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
1474
|
+
const [tilemapFile, ...tilesetFiles] = this.files;
|
|
1475
|
+
if (!(tilemapFile.type === "json" && Object.hasOwn(tilemapFile.data, "tilesets"))) return;
|
|
1476
|
+
const tilemapData = tilemapFile.data;
|
|
1477
|
+
const tilemapKey = tilemapFile.key;
|
|
1478
|
+
const loader = this.loader;
|
|
1479
|
+
const files = this.files;
|
|
1480
|
+
this.complete = true;
|
|
1481
|
+
for (const tilesetFile of tilesetFiles) {
|
|
1482
|
+
const responseText = tilesetFile.xhrLoader?.responseText;
|
|
1483
|
+
if (!responseText) throw new InvalidOperationError(Operation.Read, this.addToCache.name, tilesetFile.key);
|
|
1484
|
+
const responseData = await parseXmlString(responseText);
|
|
1485
|
+
const tilesetData = parseTileset(responseData.tileset);
|
|
1486
|
+
const index = tilesetFile.tilesetIndex;
|
|
1487
|
+
Object.assign(tilemapData.tilesets[index], tilesetData, {
|
|
1488
|
+
imageheight: tilesetData.image.height,
|
|
1489
|
+
imagewidth: tilesetData.image.width,
|
|
943
1490
|
source: void 0
|
|
944
1491
|
});
|
|
945
1492
|
}
|
|
946
|
-
|
|
947
|
-
data:
|
|
948
|
-
format:
|
|
1493
|
+
loader.cacheManager.tilemap.add(tilemapKey, {
|
|
1494
|
+
data: tilemapData,
|
|
1495
|
+
format: Tilemaps.Formats.TILED_JSON
|
|
949
1496
|
});
|
|
950
|
-
for (
|
|
1497
|
+
for (const file of files) file.pendingDestroy();
|
|
951
1498
|
}
|
|
952
|
-
onFileComplete(
|
|
953
|
-
if (this.files.indexOf(
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
1499
|
+
onFileComplete(file) {
|
|
1500
|
+
if (this.files.indexOf(file) === -1) return;
|
|
1501
|
+
this.pending--;
|
|
1502
|
+
if (!(file.type === "json" && Object.hasOwn(file.data, "tilesets"))) return;
|
|
1503
|
+
const tilesets = file.data.tilesets;
|
|
1504
|
+
const config = this.config;
|
|
1505
|
+
const loader = this.loader;
|
|
1506
|
+
const currentBaseURL = loader.baseURL;
|
|
1507
|
+
const currentPath = loader.path;
|
|
1508
|
+
const currentPrefix = loader.prefix;
|
|
1509
|
+
const baseURL = GetFastValue(config, "baseURL", currentBaseURL);
|
|
1510
|
+
const path = GetFastValue(config, "path", currentPath);
|
|
1511
|
+
const prefix = GetFastValue(config, "prefix", currentPrefix);
|
|
1512
|
+
const tilesetXhrSettings = GetFastValue(config, "tilesetXhrSettings");
|
|
1513
|
+
loader.setBaseURL(baseURL);
|
|
1514
|
+
loader.setPath(path);
|
|
1515
|
+
loader.setPrefix(prefix);
|
|
1516
|
+
for (const [tilesetIndex, tileset] of tilesets.entries()) {
|
|
1517
|
+
const pathIndex = tileset.source.indexOf("public");
|
|
1518
|
+
if (pathIndex === -1) throw new NotFoundError(this.onFileComplete.name, tileset.source);
|
|
1519
|
+
const relativePath = tileset.source.slice(pathIndex + 6);
|
|
1520
|
+
const tilesetFile = new TilesetFile(tilesetIndex, loader, `${file.key}${ID_SEPARATOR}Tileset${ID_SEPARATOR}${relativePath}`, relativePath, tilesetXhrSettings);
|
|
1521
|
+
this.addToMultiFile(tilesetFile);
|
|
1522
|
+
loader.addFile(tilesetFile);
|
|
961
1523
|
}
|
|
962
|
-
|
|
1524
|
+
loader.setBaseURL(currentBaseURL);
|
|
1525
|
+
loader.setPath(currentPath);
|
|
1526
|
+
loader.setPrefix(currentPrefix);
|
|
963
1527
|
}
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
1528
|
+
};
|
|
1529
|
+
//#endregion
|
|
1530
|
+
//#region src/util/constants.ts
|
|
1531
|
+
const TILEMAP_TILED_JSON_EXTERNAL_KEY = "tilemapTiledJSONExternal";
|
|
1532
|
+
//#endregion
|
|
1533
|
+
//#region src/plugins/registerTiledJSONExternalLoader.ts
|
|
1534
|
+
const FileTypesManager = Loader.FileTypesManager;
|
|
1535
|
+
const registerTiledJSONExternalLoader = () => {
|
|
1536
|
+
FileTypesManager.register(TILEMAP_TILED_JSON_EXTERNAL_KEY, function(...[key, tilemapURL, path, baseURL, tilemapXhrSettings, tilesetXhrSettings]) {
|
|
1537
|
+
if (Array.isArray(key)) for (const keyElement of key) {
|
|
1538
|
+
const multifile = new TiledJSONExternalFile(this, keyElement);
|
|
1539
|
+
this.addFile(multifile.files);
|
|
969
1540
|
}
|
|
970
1541
|
else {
|
|
971
|
-
|
|
972
|
-
this.addFile(
|
|
1542
|
+
const multifile = new TiledJSONExternalFile(this, key, tilemapURL, path, baseURL, tilemapXhrSettings, tilesetXhrSettings);
|
|
1543
|
+
this.addFile(multifile.files);
|
|
973
1544
|
}
|
|
974
1545
|
return this;
|
|
975
1546
|
});
|
|
976
|
-
}
|
|
1547
|
+
};
|
|
1548
|
+
//#endregion
|
|
1549
|
+
//#region src/components/Game.vue
|
|
1550
|
+
const _sfc_main$6 = /*@__PURE__*/ defineComponent({
|
|
977
1551
|
__name: "Game",
|
|
978
1552
|
props: { configuration: {} },
|
|
979
|
-
setup(
|
|
980
|
-
|
|
981
|
-
|
|
1553
|
+
setup(__props) {
|
|
1554
|
+
const phaserStore = usePhaserStore();
|
|
1555
|
+
const { game: storeGame } = storeToRefs(phaserStore);
|
|
1556
|
+
const canvasRoot = useTemplateRef("canvasRoot");
|
|
1557
|
+
const isReady = ref(false);
|
|
1558
|
+
const readyListener = () => {
|
|
1559
|
+
isReady.value = true;
|
|
1560
|
+
};
|
|
1561
|
+
onMounted(() => {
|
|
1562
|
+
registerTiledJSONExternalLoader();
|
|
1563
|
+
storeGame.value = new Game({
|
|
1564
|
+
...__props.configuration,
|
|
1565
|
+
parent: canvasRoot.value
|
|
1566
|
+
});
|
|
1567
|
+
storeGame.value.events.on("ready", readyListener);
|
|
1568
|
+
});
|
|
1569
|
+
onUnmounted(() => {
|
|
1570
|
+
const game = useGame();
|
|
1571
|
+
game.events.off("ready", readyListener);
|
|
1572
|
+
game.destroy(true);
|
|
1573
|
+
storeGame.value = void 0;
|
|
1574
|
+
});
|
|
1575
|
+
return (_ctx, _cache) => {
|
|
1576
|
+
return openBlock(), createElementBlock(Fragment, null, [createElementVNode("div", {
|
|
1577
|
+
ref_key: "canvasRoot",
|
|
1578
|
+
ref: canvasRoot
|
|
1579
|
+
}, null, 512), isReady.value ? renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 0) : createCommentVNode("v-if", true)], 64);
|
|
982
1580
|
};
|
|
983
|
-
return l(() => {
|
|
984
|
-
jt(), o.value = new se({
|
|
985
|
-
...t.configuration,
|
|
986
|
-
parent: s.value
|
|
987
|
-
}), o.value.events.on("ready", f);
|
|
988
|
-
}), u(() => {
|
|
989
|
-
let e = M();
|
|
990
|
-
e.events.off("ready", f), e.destroy(!0), o.value = void 0;
|
|
991
|
-
}), (t, a) => (d(), r(e, null, [i("div", {
|
|
992
|
-
ref_key: "canvasRoot",
|
|
993
|
-
ref: s
|
|
994
|
-
}, null, 512), g(c) ? m(t.$slots, "default", {}, void 0, void 0, 0) : n("", !0)], 64));
|
|
995
1581
|
}
|
|
996
|
-
})
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
},
|
|
1582
|
+
});
|
|
1583
|
+
//#endregion
|
|
1584
|
+
//#region src/util/setterMap/EllipseSetterMap.ts
|
|
1585
|
+
const EllipseSetterMap = {
|
|
1586
|
+
height: ComputedSizeSetterMap.height,
|
|
1587
|
+
smoothness: (gameObject) => (value) => {
|
|
1588
|
+
if (value === void 0) return;
|
|
1589
|
+
gameObject.setSmoothness(value);
|
|
1590
|
+
},
|
|
1591
|
+
width: ComputedSizeSetterMap.width,
|
|
1592
|
+
...ShapeSetterMap,
|
|
1593
|
+
...GlobalSetterMap
|
|
1594
|
+
};
|
|
1595
|
+
//#endregion
|
|
1596
|
+
//#region src/components/Ellipse.vue
|
|
1597
|
+
const _sfc_main$5 = /*@__PURE__*/ defineComponent({
|
|
1005
1598
|
__name: "Ellipse",
|
|
1006
1599
|
props: {
|
|
1007
1600
|
configuration: {},
|
|
1008
1601
|
immediate: { type: Boolean },
|
|
1009
1602
|
onComplete: { type: Function }
|
|
1010
1603
|
},
|
|
1011
|
-
setup(
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1604
|
+
setup(__props, { emit: __emit }) {
|
|
1605
|
+
useInitializeGameObject((scene) => {
|
|
1606
|
+
const { alpha, fillColor, height, width, x, y } = __props.configuration;
|
|
1607
|
+
const ellipse = scene.add.ellipse(x, y, width, height, fillColor, alpha);
|
|
1608
|
+
__props.onComplete?.(scene, ellipse);
|
|
1609
|
+
return ellipse;
|
|
1610
|
+
}, () => __props.configuration, __emit, EllipseSetterMap, __props.immediate);
|
|
1611
|
+
return (_ctx, _cache) => {
|
|
1612
|
+
return null;
|
|
1613
|
+
};
|
|
1016
1614
|
}
|
|
1017
|
-
})
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1615
|
+
});
|
|
1616
|
+
//#endregion
|
|
1617
|
+
//#region src/util/setterMap/CurveSetterMap.ts
|
|
1618
|
+
const CurveSetterMap = {
|
|
1619
|
+
smoothness: (gameObject) => (value) => {
|
|
1620
|
+
if (value === void 0) return;
|
|
1621
|
+
gameObject.setSmoothness(value);
|
|
1622
|
+
},
|
|
1623
|
+
...ShapeSetterMap,
|
|
1624
|
+
...GlobalSetterMap
|
|
1625
|
+
};
|
|
1626
|
+
//#endregion
|
|
1627
|
+
//#region src/components/Curve.vue
|
|
1628
|
+
const _sfc_main$4 = /*@__PURE__*/ defineComponent({
|
|
1024
1629
|
__name: "Curve",
|
|
1025
1630
|
props: {
|
|
1026
1631
|
configuration: {},
|
|
1027
1632
|
immediate: { type: Boolean },
|
|
1028
1633
|
onComplete: { type: Function }
|
|
1029
1634
|
},
|
|
1030
|
-
setup(
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1635
|
+
setup(__props, { emit: __emit }) {
|
|
1636
|
+
useInitializeGameObject((scene) => {
|
|
1637
|
+
const { alpha, curve, fillColor, x, y } = __props.configuration;
|
|
1638
|
+
const curveObject = scene.add.curve(x, y, curve, fillColor, alpha);
|
|
1639
|
+
__props.onComplete?.(scene, curveObject);
|
|
1640
|
+
return curveObject;
|
|
1641
|
+
}, () => __props.configuration, __emit, CurveSetterMap, __props.immediate);
|
|
1642
|
+
return (_ctx, _cache) => {
|
|
1643
|
+
return null;
|
|
1644
|
+
};
|
|
1035
1645
|
}
|
|
1036
|
-
})
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
...
|
|
1041
|
-
...
|
|
1042
|
-
...
|
|
1043
|
-
...
|
|
1044
|
-
...
|
|
1045
|
-
|
|
1646
|
+
});
|
|
1647
|
+
//#endregion
|
|
1648
|
+
//#region src/util/setterMap/ContainerSetterMap.ts
|
|
1649
|
+
const ContainerSetterMap = {
|
|
1650
|
+
...AlphaSingleSetterMap,
|
|
1651
|
+
...BlendModeSetterMap,
|
|
1652
|
+
...DepthSetterMap,
|
|
1653
|
+
...ScrollFactorSetterMap,
|
|
1654
|
+
...MaskSetterMap,
|
|
1655
|
+
...TransformSetterMap,
|
|
1656
|
+
...VisibleSetterMap,
|
|
1657
|
+
...GlobalSetterMap
|
|
1658
|
+
};
|
|
1659
|
+
//#endregion
|
|
1660
|
+
//#region src/components/Container.vue
|
|
1661
|
+
const _sfc_main$3 = /*@__PURE__*/ defineComponent({
|
|
1046
1662
|
__name: "Container",
|
|
1047
1663
|
props: {
|
|
1048
1664
|
configuration: { default: () => ({}) },
|
|
1049
1665
|
onComplete: { type: Function }
|
|
1050
1666
|
},
|
|
1051
|
-
setup(
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1667
|
+
setup(__props, { emit: __emit }) {
|
|
1668
|
+
const emit = __emit;
|
|
1669
|
+
const container = ref();
|
|
1670
|
+
useInitializeGameObject((scene) => {
|
|
1671
|
+
const { children, x, y } = __props.configuration;
|
|
1672
|
+
container.value = scene.add.container(x, y, children);
|
|
1673
|
+
__props.onComplete?.(scene, container.value);
|
|
1674
|
+
return container.value;
|
|
1675
|
+
}, () => __props.configuration, emit, ContainerSetterMap);
|
|
1676
|
+
provide(InjectionKeyMap.ParentContainer, container);
|
|
1677
|
+
return (_ctx, _cache) => {
|
|
1678
|
+
return renderSlot(_ctx.$slots, "default");
|
|
1679
|
+
};
|
|
1057
1680
|
}
|
|
1058
|
-
})
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
},
|
|
1681
|
+
});
|
|
1682
|
+
//#endregion
|
|
1683
|
+
//#region src/util/setterMap/ArcSetterMap.ts
|
|
1684
|
+
const ArcSetterMap = {
|
|
1685
|
+
closePath: (gameObject) => (value) => {
|
|
1686
|
+
if (value === void 0) return;
|
|
1687
|
+
gameObject.setClosePath(value);
|
|
1688
|
+
},
|
|
1689
|
+
endAngle: (gameObject) => (value) => {
|
|
1690
|
+
if (value === void 0) return;
|
|
1691
|
+
gameObject.setEndAngle(value);
|
|
1692
|
+
},
|
|
1693
|
+
radius: (gameObject) => (value) => {
|
|
1694
|
+
if (value === void 0) return;
|
|
1695
|
+
gameObject.setRadius(value);
|
|
1696
|
+
},
|
|
1697
|
+
startAngle: (gameObject) => (value) => {
|
|
1698
|
+
if (value === void 0) return;
|
|
1699
|
+
gameObject.setStartAngle(value);
|
|
1700
|
+
},
|
|
1701
|
+
...ShapeSetterMap,
|
|
1702
|
+
...GlobalSetterMap
|
|
1703
|
+
};
|
|
1704
|
+
//#endregion
|
|
1705
|
+
//#region src/components/Circle.vue
|
|
1706
|
+
const _sfc_main$2 = /*@__PURE__*/ defineComponent({
|
|
1074
1707
|
__name: "Circle",
|
|
1075
1708
|
props: {
|
|
1076
1709
|
configuration: {},
|
|
1077
1710
|
immediate: { type: Boolean },
|
|
1078
1711
|
onComplete: { type: Function }
|
|
1079
1712
|
},
|
|
1080
|
-
setup(
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1713
|
+
setup(__props, { emit: __emit }) {
|
|
1714
|
+
useInitializeGameObject((scene) => {
|
|
1715
|
+
const { alpha, fillColor, radius, x, y } = __props.configuration;
|
|
1716
|
+
const circle = scene.add.circle(x, y, radius, fillColor, alpha);
|
|
1717
|
+
__props.onComplete?.(scene, circle);
|
|
1718
|
+
return circle;
|
|
1719
|
+
}, () => __props.configuration, __emit, ArcSetterMap, __props.immediate);
|
|
1720
|
+
return (_ctx, _cache) => {
|
|
1721
|
+
return null;
|
|
1722
|
+
};
|
|
1085
1723
|
}
|
|
1086
|
-
})
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
},
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
},
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
},
|
|
1724
|
+
});
|
|
1725
|
+
//#endregion
|
|
1726
|
+
//#region src/util/setterMap/BitmapTextSetterMap.ts
|
|
1727
|
+
const BitmapTextSetterMap = {
|
|
1728
|
+
align: (gameObject) => (value) => {
|
|
1729
|
+
if (value === void 0) return;
|
|
1730
|
+
gameObject.align = value;
|
|
1731
|
+
},
|
|
1732
|
+
dropShadow: (gameObject) => (value) => {
|
|
1733
|
+
if (!value) return;
|
|
1734
|
+
gameObject.setDropShadow(...value);
|
|
1735
|
+
},
|
|
1736
|
+
font: (gameObject) => (value) => {
|
|
1737
|
+
if (!value) return;
|
|
1738
|
+
gameObject.setFont(value);
|
|
1739
|
+
},
|
|
1740
|
+
fontSize: (gameObject) => (value) => {
|
|
1741
|
+
if (value === void 0) return;
|
|
1742
|
+
gameObject.setFontSize(value);
|
|
1743
|
+
},
|
|
1744
|
+
letterSpacing: (gameObject) => (value) => {
|
|
1745
|
+
if (value === void 0) return;
|
|
1746
|
+
gameObject.setLetterSpacing(value);
|
|
1747
|
+
},
|
|
1748
|
+
lineSpacing: (gameObject) => (value) => {
|
|
1749
|
+
if (value === void 0) return;
|
|
1750
|
+
gameObject.setLineSpacing(value);
|
|
1751
|
+
},
|
|
1752
|
+
maxWidth: (gameObject) => (value) => {
|
|
1753
|
+
if (value === void 0) return;
|
|
1754
|
+
gameObject.setMaxWidth(value);
|
|
1755
|
+
},
|
|
1756
|
+
text: (gameObject) => (value) => {
|
|
1757
|
+
if (value === void 0) return;
|
|
1758
|
+
gameObject.setText(value);
|
|
1759
|
+
},
|
|
1760
|
+
wordWrapCharCode: (gameObject) => (value) => {
|
|
1761
|
+
if (value === void 0) return;
|
|
1762
|
+
gameObject.wordWrapCharCode = value;
|
|
1763
|
+
},
|
|
1764
|
+
...AlphaSetterMap,
|
|
1765
|
+
...BlendModeSetterMap,
|
|
1766
|
+
...DepthSetterMap,
|
|
1767
|
+
...MaskSetterMap,
|
|
1768
|
+
...OriginSetterMap,
|
|
1769
|
+
...RenderNodesSetterMap,
|
|
1770
|
+
...ScrollFactorSetterMap,
|
|
1771
|
+
...TintSetterMap,
|
|
1772
|
+
...TransformSetterMap,
|
|
1773
|
+
...VisibleSetterMap,
|
|
1774
|
+
...GlobalSetterMap
|
|
1775
|
+
};
|
|
1776
|
+
//#endregion
|
|
1777
|
+
//#region src/components/BitmapText.vue
|
|
1778
|
+
const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
1126
1779
|
__name: "BitmapText",
|
|
1127
1780
|
props: {
|
|
1128
1781
|
configuration: {},
|
|
1129
1782
|
immediate: { type: Boolean },
|
|
1130
1783
|
onComplete: { type: Function }
|
|
1131
1784
|
},
|
|
1132
|
-
setup(
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1785
|
+
setup(__props, { emit: __emit }) {
|
|
1786
|
+
useInitializeGameObject((scene) => {
|
|
1787
|
+
const { align, font, fontSize, text, x, y } = __props.configuration;
|
|
1788
|
+
const bitmapText = scene.add.bitmapText(x ?? 0, y ?? 0, font, text, fontSize, align);
|
|
1789
|
+
__props.onComplete?.(scene, bitmapText);
|
|
1790
|
+
return bitmapText;
|
|
1791
|
+
}, () => __props.configuration, __emit, BitmapTextSetterMap, __props.immediate);
|
|
1792
|
+
return (_ctx, _cache) => {
|
|
1793
|
+
return null;
|
|
1794
|
+
};
|
|
1137
1795
|
}
|
|
1138
|
-
})
|
|
1796
|
+
});
|
|
1797
|
+
//#endregion
|
|
1798
|
+
//#region src/components/Arc.vue
|
|
1799
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
1139
1800
|
__name: "Arc",
|
|
1140
1801
|
props: {
|
|
1141
1802
|
configuration: {},
|
|
1142
1803
|
immediate: { type: Boolean },
|
|
1143
1804
|
onComplete: { type: Function }
|
|
1144
1805
|
},
|
|
1145
|
-
setup(
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1806
|
+
setup(__props, { emit: __emit }) {
|
|
1807
|
+
useInitializeGameObject((scene) => {
|
|
1808
|
+
const { alpha, endAngle, fillColor, radius, startAngle, x, y } = __props.configuration;
|
|
1809
|
+
const arc = scene.add.arc(x, y, radius, startAngle, endAngle, void 0, fillColor, alpha);
|
|
1810
|
+
__props.onComplete?.(scene, arc);
|
|
1811
|
+
return arc;
|
|
1812
|
+
}, () => __props.configuration, __emit, ArcSetterMap, __props.immediate);
|
|
1813
|
+
return (_ctx, _cache) => {
|
|
1814
|
+
return null;
|
|
1815
|
+
};
|
|
1150
1816
|
}
|
|
1151
|
-
})
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1817
|
+
});
|
|
1818
|
+
//#endregion
|
|
1819
|
+
//#region src/hooks/onShutdown.ts
|
|
1820
|
+
const onShutdown = (...args) => {
|
|
1821
|
+
pushListener("Shutdown", ...args);
|
|
1822
|
+
};
|
|
1823
|
+
//#endregion
|
|
1824
|
+
//#region src/composables/useAnimations.ts
|
|
1825
|
+
const useAnimations = (createConfigurations, immediate) => {
|
|
1826
|
+
const animations = ref([]);
|
|
1827
|
+
if (immediate) {
|
|
1828
|
+
const sceneKey = useInjectSceneKey();
|
|
1829
|
+
animations.value = createConfigurations(getScene(sceneKey));
|
|
1830
|
+
} else onNextTick((scene) => {
|
|
1831
|
+
animations.value = createConfigurations(scene);
|
|
1832
|
+
});
|
|
1833
|
+
onShutdown((scene) => {
|
|
1834
|
+
for (const { key } of animations.value) {
|
|
1835
|
+
if (!key) continue;
|
|
1836
|
+
scene.anims.remove(key);
|
|
1837
|
+
}
|
|
1838
|
+
});
|
|
1839
|
+
return animations;
|
|
1840
|
+
};
|
|
1841
|
+
//#endregion
|
|
1842
|
+
//#region src/composables/useTween.ts
|
|
1843
|
+
const useTween = (tween, newTween) => {
|
|
1844
|
+
tween.value = {
|
|
1845
|
+
...newTween,
|
|
1846
|
+
onComplete: (...args) => {
|
|
1847
|
+
tween.value = void 0;
|
|
1848
|
+
newTween.onComplete?.(...args);
|
|
1165
1849
|
}
|
|
1166
1850
|
};
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1851
|
+
};
|
|
1852
|
+
//#endregion
|
|
1853
|
+
//#region src/hooks/onInit.ts
|
|
1854
|
+
const onInit = (...args) => {
|
|
1855
|
+
pushListener("Init", ...args);
|
|
1856
|
+
};
|
|
1857
|
+
//#endregion
|
|
1858
|
+
//#region src/hooks/onPreload.ts
|
|
1859
|
+
const onPreload = (...args) => {
|
|
1860
|
+
pushListener("Preload", ...args);
|
|
1861
|
+
};
|
|
1862
|
+
//#endregion
|
|
1863
|
+
//#region src/hooks/onUpdate.ts
|
|
1864
|
+
const onUpdate = (...args) => {
|
|
1865
|
+
pushListener("Update", ...args);
|
|
1866
|
+
};
|
|
1867
|
+
//#endregion
|
|
1868
|
+
//#region src/util/sleep.ts
|
|
1869
|
+
const sleep = (scene, ms) => new Promise((resolve) => {
|
|
1870
|
+
scene.time.delayedCall(ms, () => {
|
|
1871
|
+
resolve();
|
|
1176
1872
|
});
|
|
1177
|
-
})
|
|
1873
|
+
});
|
|
1874
|
+
//#endregion
|
|
1875
|
+
//#region src/models/plugins/TilemapFile.ts
|
|
1876
|
+
const JSONFile = Loader.FileTypes.JSONFile;
|
|
1877
|
+
var TilemapFile = class extends JSONFile {};
|
|
1178
1878
|
//#endregion
|
|
1179
|
-
export {
|
|
1879
|
+
export { AlphaSetterMap, AlphaSingleSetterMap, AnimationSetterMap, _sfc_main as Arc, ArcSetterMap, BaseTextureSetterMap, _sfc_main$1 as BitmapText, BitmapTextSetterMap, BlendModeSetterMap, _sfc_main$2 as Circle, ComputedSizeSetterMap, _sfc_main$3 as Container, ContainerSetterMap, _sfc_main$4 as Curve, CurveSetterMap, DepthSetterMap, DisplaySizeSetterMap, EVENT_PREFIX, _sfc_main$5 as Ellipse, EllipseSetterMap, ExternalSceneStore, FlipSetterMap, _sfc_main$6 as Game, GameObjectEventMap, GameObjectSetterMap, GlobalSetterMap, _sfc_main$7 as Graphics, GraphicsSetterMap, _sfc_main$8 as Image, ImageSetterMap, InjectionKeyMap, _sfc_main$9 as IsoBox, IsoBoxSetterMap, IsoSetterMap, _sfc_main$10 as IsoTriangle, IsoTriangleSetterMap, Lifecycle, _sfc_main$11 as Line, LineSetterMap, MaskSetterMap, _sfc_main$12 as Nineslice, NinesliceSetterMap, OriginSetterMap, _sfc_main$13 as Particles, ParticlesSetterMap, _sfc_main$14 as PathFollower, PathFollowerComponentSetterMap, PathFollowerSetterMap, _sfc_main$15 as Polygon, PolygonSetterMap, _sfc_main$16 as Rectangle, RectangleSetterMap, RenderNodesSetterMap, _sfc_main$17 as RenderTexture, RenderTextureSetterMap, _sfc_main$18 as Scene, ScrollFactorSetterMap, ShapeSetterMap, SizeSetterMap, _sfc_main$19 as Sprite, SpriteSetterMap, _sfc_main$20 as Star, StarSetterMap, TILEMAP_TILED_JSON_EXTERNAL_KEY, _sfc_main$21 as Text, TextSetterMap, TextureCropSetterMap, TextureSetterMap, _sfc_main$22 as TileSprite, TileSpriteSetterMap, TiledJSONExternalFile, _sfc_main$23 as Tilemap, TilemapFile, TilesetFile, TintSetterMap, TransformSetterMap, _sfc_main$24 as Triangle, TriangleSetterMap, TweenSetterMap, _sfc_main$25 as Video, VideoSetterMap, VisibleSetterMap, _sfc_main$26 as Zone, ZoneSetterMap, createSceneClass, getDepthInsertIndex, getEventName, getInitializeGameObjectLifecycleHook, getScene, getUpdateEvent, isEvent, onCreate, onInit, onNextTick, onPreload, onShutdown, onUpdate, pushGameObject, pushListener, registerTiledJSONExternalLoader, resetLifecycleListeners, runLifecycleListeners, sleep, useAnimations, useCameraStore, useGame, useInitializeGameObject, useInitializeGameObjectEvents, useInitializeGameObjectSetters, useInjectSceneKey, useInputStore, usePhaserStore, useTextStore, useTween };
|