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