vue-phaserjs 2.34.2 → 2.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/composables/useInitializeGameObjectSetters.d.ts +1 -1
- package/dist/index.js +104 -102
- package/dist/store/camera.d.ts +2 -10
- package/dist/store/index.d.ts +4 -22
- package/dist/store/input.d.ts +2 -6
- package/dist/store/text.d.ts +2 -6
- package/package.json +14 -14
|
@@ -2,6 +2,6 @@ import { SetterMap } from '../models/setterMap/SetterMap';
|
|
|
2
2
|
import { GameObjects } from 'phaser';
|
|
3
3
|
import { SetupContext, WatchHandle } from 'vue';
|
|
4
4
|
export declare const useInitializeGameObjectSetters: <TConfiguration extends object, TGameObject extends GameObjects.GameObject, TEmitsOptions extends Record<string, unknown[]>>(gameObject: () => TGameObject, configuration: () => TConfiguration, emit: SetupContext<TEmitsOptions>["emit"], setterMap: SetterMap<TConfiguration, TGameObject, TEmitsOptions>, immediate?: true) => {
|
|
5
|
-
initializeGameObjectSetters: (
|
|
5
|
+
initializeGameObjectSetters: (targetGameObject: TGameObject) => void;
|
|
6
6
|
setterWatchHandles: WatchHandle[];
|
|
7
7
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, defineComponent as a, getCurrentInstance as o, inject as s, nextTick as c, onMounted as l, onUnmounted as u, openBlock as d, provide as f, ref as p, renderSlot as m, toValue as h, unref as ee, useTemplateRef as g, watch as
|
|
2
|
-
import { ID_SEPARATOR as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { parseTileset as
|
|
1
|
+
import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, defineComponent as a, getCurrentInstance as o, inject as s, nextTick as c, onMounted as l, onUnmounted as u, openBlock as d, provide as f, ref as p, renderSlot as m, toValue as h, unref as ee, useTemplateRef as g, watch as te } from "vue";
|
|
2
|
+
import { ID_SEPARATOR as ne, InvalidOperationError as _, NotFoundError as re, NotInitializedError as v, Operation as y, checkIsPlainObject as ie, takeOne as b, toKebabCase as ae } from "@esposter/shared";
|
|
3
|
+
import oe from "phaser4-rex-plugins/plugins/clickoutside.js";
|
|
4
|
+
import { Animations as se, Cameras as x, Game as ce, Loader as S, Scene as le, Scenes as ue, Tilemaps as de, Tweens as fe, Utils as pe } from "phaser";
|
|
5
|
+
import { defineStore as me, storeToRefs as C } from "pinia";
|
|
6
|
+
import { parseTileset as he, parseXmlString as ge } from "parse-tmx";
|
|
7
7
|
//#region src/pushGameObject.ts
|
|
8
|
-
var
|
|
8
|
+
var _e = (e, t, n) => {
|
|
9
9
|
let r = e.list.findIndex((e) => "depth" in e && typeof e.depth == "number" && "depth" in t && typeof t.depth == "number" && e.depth > t.depth);
|
|
10
10
|
r === -1 ? e.add(n) : e.addAt(n, r);
|
|
11
|
-
},
|
|
11
|
+
}, ve = {
|
|
12
12
|
clickoutside: {},
|
|
13
13
|
drag: { drag: !0 },
|
|
14
14
|
dragend: { drag: !0 },
|
|
@@ -23,22 +23,22 @@ var ge = (e, t, n) => {
|
|
|
23
23
|
pointerover: { eventIndex: 3 },
|
|
24
24
|
pointerup: { eventIndex: 3 },
|
|
25
25
|
wheel: { eventIndex: 4 }
|
|
26
|
-
},
|
|
27
|
-
if (!e.startsWith(
|
|
26
|
+
}, ye = "on", be = (e) => {
|
|
27
|
+
if (!e.startsWith(ye) || e.length <= 2) throw new _(y.Read, be.name, e);
|
|
28
28
|
return e.slice(2).toLowerCase();
|
|
29
|
-
},
|
|
30
|
-
let e = o(), t = new Set(Object.keys(e?.attrs ?? {}).filter((e) =>
|
|
29
|
+
}, xe = (e) => e.startsWith("on"), Se = () => {
|
|
30
|
+
let e = o(), t = new Set(Object.keys(e?.attrs ?? {}).filter((e) => xe(e)).map((e) => be(e))), n = Object.keys(ve).filter((e) => t.has(e)), r = [];
|
|
31
31
|
return {
|
|
32
32
|
eventStopHandles: r,
|
|
33
33
|
initializeGameObjectEvents: (e, t, i) => {
|
|
34
34
|
if (n.length !== 0) {
|
|
35
|
-
e.input || e.setInteractive(), n.some((e) => "drag" in
|
|
35
|
+
e.input || e.setInteractive(), n.some((e) => "drag" in ve[e]) && i.input.setDraggable(e);
|
|
36
36
|
for (let i of n) {
|
|
37
|
-
let n =
|
|
38
|
-
"eventIndex" in n && (
|
|
37
|
+
let n = ve[i], a = (...e) => {
|
|
38
|
+
"eventIndex" in n && (b(e).stopPropagation = b(e, n.eventIndex).stopPropagation), t(i, ...e);
|
|
39
39
|
};
|
|
40
40
|
if (i === "clickoutside") {
|
|
41
|
-
let t = new
|
|
41
|
+
let t = new oe(e);
|
|
42
42
|
t.on(i, a), r.push(() => {
|
|
43
43
|
t.off(i, a);
|
|
44
44
|
});
|
|
@@ -51,39 +51,39 @@ var ge = (e, t, n) => {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
},
|
|
54
|
+
}, w = {
|
|
55
55
|
ParentContainer: Symbol("ParentContainer"),
|
|
56
56
|
SceneKey: Symbol("SceneKey")
|
|
57
|
-
},
|
|
58
|
-
let e = s(
|
|
59
|
-
if (!e) throw new
|
|
57
|
+
}, T = () => {
|
|
58
|
+
let e = s(w.SceneKey);
|
|
59
|
+
if (!e) throw new v(w.SceneKey.description ?? "");
|
|
60
60
|
return e;
|
|
61
|
-
},
|
|
61
|
+
}, E = /* @__PURE__ */ function(e) {
|
|
62
62
|
return e.Create = "Create", e.Init = "Init", e.NextTick = "NextTick", e.Preload = "Preload", e.Shutdown = "Shutdown", e.Update = "Update", e;
|
|
63
|
-
}({}),
|
|
63
|
+
}({}), D = {
|
|
64
64
|
lifecycleListenersMap: /* @__PURE__ */ new Map(),
|
|
65
65
|
sceneReadyMap: /* @__PURE__ */ new Map()
|
|
66
|
-
},
|
|
67
|
-
let r = n ??
|
|
66
|
+
}, O = (e, t, n) => {
|
|
67
|
+
let r = n ?? T(), i = D.lifecycleListenersMap.get(e);
|
|
68
68
|
if (!i) {
|
|
69
|
-
|
|
69
|
+
D.lifecycleListenersMap.set(e, /* @__PURE__ */ new Map([[r, [t]]]));
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
let a = i.get(r);
|
|
73
73
|
a ? a.push(t) : i.set(r, [t]);
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
let a =
|
|
74
|
+
}, k = (...e) => {
|
|
75
|
+
O(E.NextTick, ...e);
|
|
76
|
+
}, A = (e) => `update:${ae(e)}`, Ce = (e, t, n, r, i) => {
|
|
77
|
+
let a = T(), o = [], s = [];
|
|
78
78
|
for (let [c, l] of Object.entries(h(t))) {
|
|
79
79
|
let u = r[c];
|
|
80
80
|
u && (o.push((e) => {
|
|
81
|
-
u(e, n)(l), l === void 0 ? c in e && n(
|
|
82
|
-
}), s.push(
|
|
81
|
+
u(e, n)(l), l === void 0 ? c in e && n(A(c), e[c]) : n(A(c), l);
|
|
82
|
+
}), s.push(te(() => h(t)[c], (t) => {
|
|
83
83
|
let r = () => {
|
|
84
|
-
u(h(e), n)(t), n(
|
|
84
|
+
u(h(e), n)(t), n(A(c), t);
|
|
85
85
|
};
|
|
86
|
-
i ? r() :
|
|
86
|
+
i ? r() : k(() => {
|
|
87
87
|
r();
|
|
88
88
|
}, a);
|
|
89
89
|
}, { deep: typeof h(t)[c] == "object" })));
|
|
@@ -94,7 +94,7 @@ var ge = (e, t, n) => {
|
|
|
94
94
|
},
|
|
95
95
|
setterWatchHandles: s
|
|
96
96
|
};
|
|
97
|
-
},
|
|
97
|
+
}, j = me("phaser", () => {
|
|
98
98
|
let e, n = t({
|
|
99
99
|
get: () => e,
|
|
100
100
|
set: (t) => {
|
|
@@ -102,8 +102,10 @@ var ge = (e, t, n) => {
|
|
|
102
102
|
}
|
|
103
103
|
}), r = p(), i = r, a = (e) => e === r.value, o = async (e) => {
|
|
104
104
|
if (a(e)) return;
|
|
105
|
-
let t =
|
|
106
|
-
|
|
105
|
+
let t = n.value;
|
|
106
|
+
if (!t) throw new v(ce.name);
|
|
107
|
+
let i = r.value;
|
|
108
|
+
r.value = e, await c(), i && t.scene.isActive(i) && t.scene.stop(i), t.scene.start(e);
|
|
107
109
|
}, s = p([]), l = p([]);
|
|
108
110
|
return {
|
|
109
111
|
game: n,
|
|
@@ -127,16 +129,16 @@ var ge = (e, t, n) => {
|
|
|
127
129
|
switchToScene: o
|
|
128
130
|
};
|
|
129
131
|
}), M = () => {
|
|
130
|
-
let { game:
|
|
131
|
-
if (!
|
|
132
|
-
return
|
|
132
|
+
let e = j(), { game: t } = C(e);
|
|
133
|
+
if (!t.value) throw new v(ce.name);
|
|
134
|
+
return t.value;
|
|
133
135
|
}, N = (e) => M().scene.getScene(e), we = (...e) => {
|
|
134
|
-
|
|
135
|
-
}, Te = (e) =>
|
|
136
|
-
let a, { initializeGameObjectSetters: o, setterWatchHandles: c } =
|
|
136
|
+
O(E.Create, ...e);
|
|
137
|
+
}, Te = (e) => D.sceneReadyMap.get(e) ? k : we, P = (e, t, n, r, i) => {
|
|
138
|
+
let a, { initializeGameObjectSetters: o, setterWatchHandles: c } = Ce(() => a, t, n, r, i), { eventStopHandles: l, initializeGameObjectEvents: d } = Se(), f = s(w.ParentContainer), p = T(), m = Te(p), ee = (t) => {
|
|
137
139
|
a = e(t), o(a), d(a, n, t);
|
|
138
140
|
}, g = () => {
|
|
139
|
-
f?.value &&
|
|
141
|
+
f?.value && _e(f.value, h(t), a);
|
|
140
142
|
};
|
|
141
143
|
i ? (ee(N(p)), m(() => {
|
|
142
144
|
g();
|
|
@@ -437,17 +439,17 @@ var ge = (e, t, n) => {
|
|
|
437
439
|
onComplete: { type: Function }
|
|
438
440
|
},
|
|
439
441
|
setup(e) {
|
|
440
|
-
let t =
|
|
442
|
+
let t = T(), n = p();
|
|
441
443
|
return we((t) => {
|
|
442
444
|
n.value = t.make.tilemap(e.configuration), e.onComplete?.(t, n.value);
|
|
443
|
-
}),
|
|
445
|
+
}), te(() => e.configuration.key, (r) => {
|
|
444
446
|
let i = N(t), a = n.value;
|
|
445
447
|
r ? (n.value = i.make.tilemap(e.configuration), e.onComplete?.(i, n.value)) : n.value = void 0, a && a.destroy();
|
|
446
448
|
}), u(() => {
|
|
447
449
|
n.value && n.value.destroy();
|
|
448
450
|
}), (e, t) => m(e.$slots, "default");
|
|
449
451
|
}
|
|
450
|
-
}), Be =
|
|
452
|
+
}), Be = me("phaser/text", () => ({ defaultTextStyle: p() })), Ve = {
|
|
451
453
|
padding: (e) => (t) => {
|
|
452
454
|
t && e.setPadding(t);
|
|
453
455
|
},
|
|
@@ -477,11 +479,11 @@ var ge = (e, t, n) => {
|
|
|
477
479
|
immediate: { type: Boolean }
|
|
478
480
|
},
|
|
479
481
|
setup(e, { emit: t }) {
|
|
480
|
-
let n = t, { defaultTextStyle:
|
|
482
|
+
let n = t, r = Be(), { defaultTextStyle: i } = C(r);
|
|
481
483
|
return P((t) => {
|
|
482
|
-
let { style: n, text:
|
|
483
|
-
return t.add.text(a ?? 0, o ?? 0,
|
|
484
|
-
...
|
|
484
|
+
let { style: n, text: r, x: a, y: o } = e.configuration;
|
|
485
|
+
return t.add.text(a ?? 0, o ?? 0, r, {
|
|
486
|
+
...i.value,
|
|
485
487
|
...n
|
|
486
488
|
});
|
|
487
489
|
}, () => e.configuration, n, Ve, e.immediate), (e, t) => null;
|
|
@@ -518,7 +520,7 @@ var ge = (e, t, n) => {
|
|
|
518
520
|
let n = `${se.Events.ANIMATION_COMPLETE_KEY}${r.key}`;
|
|
519
521
|
if (e.once(n, () => {
|
|
520
522
|
t(n);
|
|
521
|
-
}), !e.scene.anims.exists(r.key) && !e.scene.anims.create(r)) throw new y
|
|
523
|
+
}), !e.scene.anims.exists(r.key) && !e.scene.anims.create(r)) throw new _(y.Create, "Animation", r.key);
|
|
522
524
|
}
|
|
523
525
|
},
|
|
524
526
|
playAnimationKey: (e) => (t) => {
|
|
@@ -557,7 +559,7 @@ var ge = (e, t, n) => {
|
|
|
557
559
|
return e.onComplete?.(t, o), o;
|
|
558
560
|
}, () => e.configuration, t, Ke, e.immediate), (e, t) => null;
|
|
559
561
|
}
|
|
560
|
-
}), Je =
|
|
562
|
+
}), Je = me("phaser/camera", () => {
|
|
561
563
|
let e = p(!1);
|
|
562
564
|
return {
|
|
563
565
|
fadeIn: (t, ...n) => {
|
|
@@ -568,11 +570,11 @@ var ge = (e, t, n) => {
|
|
|
568
570
|
},
|
|
569
571
|
isFading: e
|
|
570
572
|
};
|
|
571
|
-
}), Ye =
|
|
572
|
-
let n =
|
|
573
|
+
}), Ye = me("phaser/input", () => ({ isInputActive: p(!1) })), Xe = (e, t) => {
|
|
574
|
+
let n = D.lifecycleListenersMap.get(t);
|
|
573
575
|
n && n.get(e.scene.key) && n.set(e.scene.key, []);
|
|
574
576
|
}, Q = (e, t, n = !0) => {
|
|
575
|
-
let r =
|
|
577
|
+
let r = D.lifecycleListenersMap.get(t);
|
|
576
578
|
if (!r) return;
|
|
577
579
|
let i = r.get(e.scene.key);
|
|
578
580
|
if (i) {
|
|
@@ -584,16 +586,16 @@ var ge = (e, t, n) => {
|
|
|
584
586
|
super({ key: e });
|
|
585
587
|
}
|
|
586
588
|
create() {
|
|
587
|
-
t.onCreate?.(this), Q(this,
|
|
589
|
+
t.onCreate?.(this), Q(this, E.Create);
|
|
588
590
|
}
|
|
589
591
|
init() {
|
|
590
|
-
t.onInit?.(this), Q(this,
|
|
592
|
+
t.onInit?.(this), Q(this, E.Init);
|
|
591
593
|
}
|
|
592
594
|
preload() {
|
|
593
|
-
t.onPreload?.(this), Q(this,
|
|
595
|
+
t.onPreload?.(this), Q(this, E.Preload);
|
|
594
596
|
}
|
|
595
597
|
update(e, n) {
|
|
596
|
-
t.onUpdate?.(this, e, n), Q(this,
|
|
598
|
+
t.onUpdate?.(this, e, n), Q(this, E.Update, !1), Q(this, E.NextTick);
|
|
597
599
|
}
|
|
598
600
|
}, Qe = /* @__PURE__ */ a({
|
|
599
601
|
__name: "Scene",
|
|
@@ -609,38 +611,38 @@ var ge = (e, t, n) => {
|
|
|
609
611
|
"update"
|
|
610
612
|
],
|
|
611
613
|
setup(e, { emit: r }) {
|
|
612
|
-
let i = r, a =
|
|
613
|
-
|
|
614
|
+
let i = r, a = j(), { isSameScene: o, switchToScene: s } = a, c = Je(), { isFading: d } = C(c), p = Ye(), { isInputActive: h } = C(p), { parallelSceneKeys: g } = C(a), te = t(() => o(e.sceneKey) || g.value.includes(e.sceneKey)), ne = () => {
|
|
615
|
+
h.value &&= !1;
|
|
614
616
|
}, _ = () => {
|
|
615
|
-
|
|
617
|
+
d.value = !1, h.value ||= !0;
|
|
618
|
+
}, re = () => {
|
|
619
|
+
h.value &&= !1;
|
|
616
620
|
}, v = () => {
|
|
617
|
-
d.value
|
|
618
|
-
}, y = (
|
|
619
|
-
c.value = !1;
|
|
620
|
-
}, te = Ze(e.sceneKey, {
|
|
621
|
+
d.value = !1;
|
|
622
|
+
}, y = Ze(e.sceneKey, {
|
|
621
623
|
onCreate: (e) => {
|
|
622
|
-
i("create", e), e.cameras.main.on(
|
|
624
|
+
i("create", e), e.cameras.main.on(x.Scene2D.Events.FADE_IN_START, ne), e.cameras.main.on(x.Scene2D.Events.FADE_IN_COMPLETE, _), e.cameras.main.on(x.Scene2D.Events.FADE_OUT_START, re), e.cameras.main.on(x.Scene2D.Events.FADE_OUT_COMPLETE, v), h.value ||= !0;
|
|
623
625
|
},
|
|
624
626
|
onInit: (e) => i("init", e),
|
|
625
627
|
onPreload: (e) => i("preload", e),
|
|
626
628
|
onUpdate: (e, t, n) => i("update", e, t, n)
|
|
627
|
-
}),
|
|
628
|
-
|
|
629
|
-
},
|
|
629
|
+
}), ie = () => {
|
|
630
|
+
D.sceneReadyMap.set(e.sceneKey, !0);
|
|
631
|
+
}, b = () => {
|
|
630
632
|
let t = N(e.sceneKey);
|
|
631
|
-
Xe(t,
|
|
633
|
+
Xe(t, E.Update), Xe(t, E.NextTick), Q(t, E.Shutdown), t.cameras.main.off(x.Scene2D.Events.FADE_IN_START, ne), t.cameras.main.off(x.Scene2D.Events.FADE_IN_COMPLETE, _), t.cameras.main.off(x.Scene2D.Events.FADE_OUT_START, re), t.cameras.main.off(x.Scene2D.Events.FADE_OUT_COMPLETE, v), D.sceneReadyMap.set(e.sceneKey, !1), i("shutdown", t);
|
|
632
634
|
};
|
|
633
635
|
return l(async () => {
|
|
634
|
-
let t = M().scene.add(e.sceneKey,
|
|
636
|
+
let t = M().scene.add(e.sceneKey, y);
|
|
635
637
|
if (!t) {
|
|
636
638
|
console.error(`Failed to add scene: ${e.sceneKey}`);
|
|
637
639
|
return;
|
|
638
640
|
}
|
|
639
|
-
t.events.on(ue.Events.READY,
|
|
641
|
+
t.events.on(ue.Events.READY, ie), t.events.on(ue.Events.SHUTDOWN, b), e.autoStart && await s(e.sceneKey);
|
|
640
642
|
}), u(() => {
|
|
641
643
|
let t = M(), n = N(e.sceneKey);
|
|
642
|
-
n.events.off(ue.Events.READY,
|
|
643
|
-
}), f(
|
|
644
|
+
n.events.off(ue.Events.READY, ie), n.events.off(ue.Events.SHUTDOWN, b), t.scene.remove(e.sceneKey);
|
|
645
|
+
}), f(w.SceneKey, e.sceneKey), (e, t) => ee(te) ? m(e.$slots, "default", {}, void 0, void 0, 0) : n("", !0);
|
|
644
646
|
}
|
|
645
647
|
}), $e = {
|
|
646
648
|
...V,
|
|
@@ -946,14 +948,14 @@ var ge = (e, t, n) => {
|
|
|
946
948
|
return e.onComplete?.(t, i), i;
|
|
947
949
|
}, () => e.configuration, t, bt, e.immediate), (e, t) => null;
|
|
948
950
|
}
|
|
949
|
-
}), St =
|
|
951
|
+
}), St = S.FileTypes.XMLFile, Ct = class extends St {
|
|
950
952
|
tilesetIndex;
|
|
951
953
|
constructor(e, ...t) {
|
|
952
954
|
super(...t), this.tilesetIndex = e;
|
|
953
955
|
}
|
|
954
|
-
}, $ = pe.Objects.GetFastValue, wt =
|
|
956
|
+
}, $ = pe.Objects.GetFastValue, wt = S.FileTypes.JSONFile, Tt = S.MultiFile, Et = class extends Tt {
|
|
955
957
|
constructor(e, t, n, r, i, a, o) {
|
|
956
|
-
if (
|
|
958
|
+
if (ie(t)) {
|
|
957
959
|
let e = t;
|
|
958
960
|
t = $(e, "key"), n = $(e, "url"), a = $(e, "xhrSettings"), r = $(e, "path"), i = $(e, "baseURL"), o = $(e, "tilesetXhrSettings");
|
|
959
961
|
}
|
|
@@ -968,11 +970,11 @@ var ge = (e, t, n) => {
|
|
|
968
970
|
this.complete = !0;
|
|
969
971
|
for (let e of t) {
|
|
970
972
|
let t = e.xhrLoader?.responseText;
|
|
971
|
-
if (!t) throw new y
|
|
972
|
-
let r =
|
|
973
|
-
Object.assign(n.tilesets[
|
|
974
|
-
imageheight:
|
|
975
|
-
imagewidth:
|
|
973
|
+
if (!t) throw new _(y.Read, this.addToCache.name, e.url.toString());
|
|
974
|
+
let r = await ge(t), i = he(r.tileset), a = e.tilesetIndex;
|
|
975
|
+
Object.assign(n.tilesets[a], i, {
|
|
976
|
+
imageheight: i.image.height,
|
|
977
|
+
imagewidth: i.image.width,
|
|
976
978
|
source: void 0
|
|
977
979
|
});
|
|
978
980
|
}
|
|
@@ -988,13 +990,13 @@ var ge = (e, t, n) => {
|
|
|
988
990
|
r.setBaseURL(s), r.setPath(c), r.setPrefix(l);
|
|
989
991
|
for (let [n, i] of t.entries()) {
|
|
990
992
|
let t = i.source.indexOf("public");
|
|
991
|
-
if (t === -1) throw new
|
|
992
|
-
let a = i.source.slice(t + 6), o = new Ct(n, r, `${e.key}${
|
|
993
|
+
if (t === -1) throw new re(this.onFileComplete.name, i.source);
|
|
994
|
+
let a = i.source.slice(t + 6), o = new Ct(n, r, `${e.key}${ne}Tileset${ne}${a}`, a, u);
|
|
993
995
|
this.addToMultiFile(o), r.addFile(o);
|
|
994
996
|
}
|
|
995
997
|
r.setBaseURL(i), r.setPath(a), r.setPrefix(o);
|
|
996
998
|
}
|
|
997
|
-
}, Dt = "tilemapTiledJSONExternal", Ot =
|
|
999
|
+
}, Dt = "tilemapTiledJSONExternal", Ot = S.FileTypesManager, kt = () => {
|
|
998
1000
|
Ot.register(Dt, function(...[e, t, n, r, i, a]) {
|
|
999
1001
|
if (Array.isArray(e)) for (let t of e) {
|
|
1000
1002
|
let e = new Et(this, t);
|
|
@@ -1010,21 +1012,21 @@ var ge = (e, t, n) => {
|
|
|
1010
1012
|
__name: "Game",
|
|
1011
1013
|
props: { configuration: {} },
|
|
1012
1014
|
setup(t) {
|
|
1013
|
-
let { game:
|
|
1014
|
-
|
|
1015
|
+
let a = j(), { game: o } = C(a), s = g("canvasRoot"), c = p(!1), f = () => {
|
|
1016
|
+
c.value = !0;
|
|
1015
1017
|
};
|
|
1016
1018
|
return l(() => {
|
|
1017
|
-
kt(),
|
|
1019
|
+
kt(), o.value = new ce({
|
|
1018
1020
|
...t.configuration,
|
|
1019
|
-
parent:
|
|
1020
|
-
}),
|
|
1021
|
+
parent: s.value
|
|
1022
|
+
}), o.value.events.on("ready", f);
|
|
1021
1023
|
}), u(() => {
|
|
1022
1024
|
let e = M();
|
|
1023
|
-
e.events.off("ready",
|
|
1025
|
+
e.events.off("ready", f), e.destroy(!0), o.value = void 0;
|
|
1024
1026
|
}), (t, a) => (d(), r(e, null, [i("div", {
|
|
1025
1027
|
ref_key: "canvasRoot",
|
|
1026
|
-
ref:
|
|
1027
|
-
}, null, 512), ee(
|
|
1028
|
+
ref: s
|
|
1029
|
+
}, null, 512), ee(c) ? m(t.$slots, "default", {}, void 0, void 0, 0) : n("", !0)], 64));
|
|
1028
1030
|
}
|
|
1029
1031
|
}), jt = {
|
|
1030
1032
|
height: Y.height,
|
|
@@ -1086,7 +1088,7 @@ var ge = (e, t, n) => {
|
|
|
1086
1088
|
return P((t) => {
|
|
1087
1089
|
let { children: n, x: i, y: a } = e.configuration;
|
|
1088
1090
|
return r.value = t.add.container(i, a, n), e.onComplete?.(t, r.value), r.value;
|
|
1089
|
-
}, () => e.configuration, n, Ft), f(
|
|
1091
|
+
}, () => e.configuration, n, Ft), f(w.ParentContainer, r), (e, t) => m(e.$slots, "default");
|
|
1090
1092
|
}
|
|
1091
1093
|
}), Lt = {
|
|
1092
1094
|
closePath: (e) => (t) => {
|
|
@@ -1182,10 +1184,10 @@ var ge = (e, t, n) => {
|
|
|
1182
1184
|
}, () => e.configuration, t, Lt, e.immediate), (e, t) => null;
|
|
1183
1185
|
}
|
|
1184
1186
|
}), Ht = (...e) => {
|
|
1185
|
-
|
|
1187
|
+
O(E.Shutdown, ...e);
|
|
1186
1188
|
}, Ut = (e, t) => {
|
|
1187
1189
|
let n = p([]);
|
|
1188
|
-
return t ? n.value = e(N(
|
|
1190
|
+
return t ? n.value = e(N(T())) : k((t) => {
|
|
1189
1191
|
n.value = e(t);
|
|
1190
1192
|
}), Ht((e) => {
|
|
1191
1193
|
for (let { key: t } of n.value) t && e.anims.remove(t);
|
|
@@ -1198,15 +1200,15 @@ var ge = (e, t, n) => {
|
|
|
1198
1200
|
}
|
|
1199
1201
|
};
|
|
1200
1202
|
}, Gt = (...e) => {
|
|
1201
|
-
|
|
1203
|
+
O(E.Init, ...e);
|
|
1202
1204
|
}, Kt = (...e) => {
|
|
1203
|
-
|
|
1205
|
+
O(E.Preload, ...e);
|
|
1204
1206
|
}, qt = (...e) => {
|
|
1205
|
-
|
|
1207
|
+
O(E.Update, ...e);
|
|
1206
1208
|
}, Jt = (e, t) => new Promise((n) => {
|
|
1207
1209
|
e.time.delayedCall(t, () => {
|
|
1208
1210
|
n();
|
|
1209
1211
|
});
|
|
1210
|
-
}), Yt =
|
|
1212
|
+
}), Yt = S.FileTypes.JSONFile, Xt = class extends Yt {};
|
|
1211
1213
|
//#endregion
|
|
1212
|
-
export { V as AlphaSetterMap, q as AlphaSingleSetterMap, Ge as AnimationSetterMap, Vt as Arc, Lt as ArcSetterMap, Ae as BaseTextureSetterMap, Bt as BitmapText, zt as BitmapTextSetterMap, H as BlendModeSetterMap, Rt as Circle, Y as ComputedSizeSetterMap, It as Container, Ft as ContainerSetterMap, Pt as Curve, Nt as CurveSetterMap, F as DepthSetterMap, Pe as DisplaySizeSetterMap, Mt as Ellipse, jt as EllipseSetterMap,
|
|
1214
|
+
export { V as AlphaSetterMap, q as AlphaSingleSetterMap, Ge as AnimationSetterMap, Vt as Arc, Lt as ArcSetterMap, Ae as BaseTextureSetterMap, Bt as BitmapText, zt as BitmapTextSetterMap, H as BlendModeSetterMap, Rt as Circle, Y as ComputedSizeSetterMap, It as Container, Ft as ContainerSetterMap, Pt as Curve, Nt as CurveSetterMap, F as DepthSetterMap, Pe as DisplaySizeSetterMap, Mt as Ellipse, jt as EllipseSetterMap, D as ExternalSceneStore, U as FlipSetterMap, At as Game, ve as GameObjectEventMap, Ee as GameObjectSetterMap, B as GlobalSetterMap, xt as Graphics, bt as GraphicsSetterMap, yt as Image, vt as ImageSetterMap, w as InjectionKeyMap, _t as IsoBox, gt as IsoBoxSetterMap, ht as IsoTriangle, mt as IsoTriangleSetterMap, E as Lifecycle, pt as Line, ft as LineSetterMap, W as MaskSetterMap, dt as Nineslice, ut as NinesliceSetterMap, I as OriginSetterMap, lt as Particles, ct as ParticlesSetterMap, st as PathFollower, at as PathFollowerComponentSetterMap, ot as PathFollowerSetterMap, it as Polygon, rt as PolygonSetterMap, nt as Rectangle, tt as RectangleSetterMap, G as RenderNodesSetterMap, et as RenderTexture, $e as RenderTextureSetterMap, Qe as Scene, L as ScrollFactorSetterMap, J as ShapeSetterMap, Z as SizeSetterMap, qe as Sprite, Ke as SpriteSetterMap, We as Star, Ue as StarSetterMap, Dt as TILEMAP_TILED_JSON_EXTERNAL_KEY, He as Text, Ve as TextSetterMap, je as TextureCropSetterMap, X as TextureSetterMap, Re as TileSprite, Le as TileSpriteSetterMap, Et as TiledJSONExternalFile, ze as Tilemap, Xt as TilemapFile, Ct as TilesetFile, K as TintSetterMap, R as TransformSetterMap, Ie as Triangle, Fe as TriangleSetterMap, De as TweenSetterMap, Ne as Video, Me as VideoSetterMap, z as VisibleSetterMap, ke as Zone, Oe as ZoneSetterMap, Ze as createSceneClass, be as getEventName, Te as getInitializeGameObjectLifecycleHook, N as getScene, A as getUpdateEvent, xe as isEvent, we as onCreate, Gt as onInit, k as onNextTick, Kt as onPreload, Ht as onShutdown, qt as onUpdate, _e as pushGameObject, O as pushListener, kt as registerTiledJSONExternalLoader, Xe as resetLifecycleListeners, Q as runLifecycleListeners, Jt as sleep, Ut as useAnimations, Je as useCameraStore, M as useGame, P as useInitializeGameObject, Se as useInitializeGameObjectEvents, Ce as useInitializeGameObjectSetters, T as useInjectSceneKey, Ye as useInputStore, j as usePhaserStore, Be as useTextStore, Wt as useTween };
|
package/dist/store/camera.d.ts
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { SceneWithPlugins } from '../models/scene/SceneWithPlugins';
|
|
2
|
-
export declare const useCameraStore: import('pinia').
|
|
2
|
+
export declare const useCameraStore: import('pinia').SetupStoreDefinition<"phaser/camera", {
|
|
3
3
|
fadeIn: (scene: SceneWithPlugins, duration?: number | undefined, red?: number | undefined, green?: number | undefined, blue?: number | undefined, callback?: Function | undefined, context?: any) => void;
|
|
4
4
|
fadeOut: (scene: SceneWithPlugins, duration?: number | undefined, red?: number | undefined, green?: number | undefined, blue?: number | undefined, callback?: Function | undefined, context?: any) => void;
|
|
5
5
|
isFading: globalThis.Ref<boolean, boolean>;
|
|
6
|
-
}
|
|
7
|
-
fadeIn: (scene: SceneWithPlugins, duration?: number | undefined, red?: number | undefined, green?: number | undefined, blue?: number | undefined, callback?: Function | undefined, context?: any) => void;
|
|
8
|
-
fadeOut: (scene: SceneWithPlugins, duration?: number | undefined, red?: number | undefined, green?: number | undefined, blue?: number | undefined, callback?: Function | undefined, context?: any) => void;
|
|
9
|
-
isFading: globalThis.Ref<boolean, boolean>;
|
|
10
|
-
}, never>, Pick<{
|
|
11
|
-
fadeIn: (scene: SceneWithPlugins, duration?: number | undefined, red?: number | undefined, green?: number | undefined, blue?: number | undefined, callback?: Function | undefined, context?: any) => void;
|
|
12
|
-
fadeOut: (scene: SceneWithPlugins, duration?: number | undefined, red?: number | undefined, green?: number | undefined, blue?: number | undefined, callback?: Function | undefined, context?: any) => void;
|
|
13
|
-
isFading: globalThis.Ref<boolean, boolean>;
|
|
14
|
-
}, "fadeIn" | "fadeOut">>;
|
|
6
|
+
}>;
|
package/dist/store/index.d.ts
CHANGED
|
@@ -1,30 +1,12 @@
|
|
|
1
1
|
import { SceneWithPlugins } from '../models/scene/SceneWithPlugins';
|
|
2
2
|
import { Game } from 'phaser';
|
|
3
|
-
export declare const usePhaserStore: import('pinia').
|
|
3
|
+
export declare const usePhaserStore: import('pinia').SetupStoreDefinition<"phaser", {
|
|
4
4
|
game: globalThis.WritableComputedRef<Game | undefined, Game | undefined>;
|
|
5
5
|
isSameScene: (newSceneKey: SceneWithPlugins["scene"]["key"]) => boolean;
|
|
6
|
-
launchParallelScene: (scene: SceneWithPlugins,
|
|
6
|
+
launchParallelScene: (scene: SceneWithPlugins, targetSceneKey: SceneWithPlugins["scene"]["key"]) => void;
|
|
7
7
|
parallelSceneKeys: globalThis.Ref<string[], string[]>;
|
|
8
8
|
prioritizedParallelSceneKeys: globalThis.Ref<string[], string[]>;
|
|
9
|
-
removeParallelScene: (scene: SceneWithPlugins,
|
|
9
|
+
removeParallelScene: (scene: SceneWithPlugins, targetSceneKey: SceneWithPlugins["scene"]["key"]) => void;
|
|
10
10
|
rootSceneKey: Ref<SceneWithPlugins["scene"]["key"]>;
|
|
11
11
|
switchToScene: (newSceneKey: SceneWithPlugins["scene"]["key"]) => Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
game: globalThis.WritableComputedRef<Game | undefined, Game | undefined>;
|
|
14
|
-
isSameScene: (newSceneKey: SceneWithPlugins["scene"]["key"]) => boolean;
|
|
15
|
-
launchParallelScene: (scene: SceneWithPlugins, sceneKey: SceneWithPlugins["scene"]["key"]) => void;
|
|
16
|
-
parallelSceneKeys: globalThis.Ref<string[], string[]>;
|
|
17
|
-
prioritizedParallelSceneKeys: globalThis.Ref<string[], string[]>;
|
|
18
|
-
removeParallelScene: (scene: SceneWithPlugins, sceneKey: SceneWithPlugins["scene"]["key"]) => void;
|
|
19
|
-
rootSceneKey: Ref<SceneWithPlugins["scene"]["key"]>;
|
|
20
|
-
switchToScene: (newSceneKey: SceneWithPlugins["scene"]["key"]) => Promise<void>;
|
|
21
|
-
}, "game">, Pick<{
|
|
22
|
-
game: globalThis.WritableComputedRef<Game | undefined, Game | undefined>;
|
|
23
|
-
isSameScene: (newSceneKey: SceneWithPlugins["scene"]["key"]) => boolean;
|
|
24
|
-
launchParallelScene: (scene: SceneWithPlugins, sceneKey: SceneWithPlugins["scene"]["key"]) => void;
|
|
25
|
-
parallelSceneKeys: globalThis.Ref<string[], string[]>;
|
|
26
|
-
prioritizedParallelSceneKeys: globalThis.Ref<string[], string[]>;
|
|
27
|
-
removeParallelScene: (scene: SceneWithPlugins, sceneKey: SceneWithPlugins["scene"]["key"]) => void;
|
|
28
|
-
rootSceneKey: Ref<SceneWithPlugins["scene"]["key"]>;
|
|
29
|
-
switchToScene: (newSceneKey: SceneWithPlugins["scene"]["key"]) => Promise<void>;
|
|
30
|
-
}, "isSameScene" | "launchParallelScene" | "removeParallelScene" | "switchToScene">>;
|
|
12
|
+
}>;
|
package/dist/store/input.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
export declare const useInputStore: import('pinia').
|
|
1
|
+
export declare const useInputStore: import('pinia').SetupStoreDefinition<"phaser/input", {
|
|
2
2
|
isInputActive: globalThis.Ref<boolean, boolean>;
|
|
3
|
-
}
|
|
4
|
-
isInputActive: globalThis.Ref<boolean, boolean>;
|
|
5
|
-
}, never>, Pick<{
|
|
6
|
-
isInputActive: globalThis.Ref<boolean, boolean>;
|
|
7
|
-
}, never>>;
|
|
3
|
+
}>;
|
package/dist/store/text.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { Types } from 'phaser';
|
|
2
|
-
export declare const useTextStore: import('pinia').
|
|
2
|
+
export declare const useTextStore: import('pinia').SetupStoreDefinition<"phaser/text", {
|
|
3
3
|
defaultTextStyle: globalThis.Ref<Types.GameObjects.Text.TextStyle | undefined, Types.GameObjects.Text.TextStyle | undefined>;
|
|
4
|
-
}
|
|
5
|
-
defaultTextStyle: globalThis.Ref<Types.GameObjects.Text.TextStyle | undefined, Types.GameObjects.Text.TextStyle | undefined>;
|
|
6
|
-
}, never>, Pick<{
|
|
7
|
-
defaultTextStyle: globalThis.Ref<Types.GameObjects.Text.TextStyle | undefined, Types.GameObjects.Text.TextStyle | undefined>;
|
|
8
|
-
}, never>>;
|
|
4
|
+
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-phaserjs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.36.0",
|
|
4
4
|
"description": "A component library to integrate Phaser Framework with Vue.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"component-library",
|
|
@@ -46,24 +46,24 @@
|
|
|
46
46
|
"typecheck": "vue-tsc"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@esposter/configuration": "2.
|
|
50
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
49
|
+
"@esposter/configuration": "2.36.0",
|
|
50
|
+
"@vitejs/plugin-vue": "^6.0.8",
|
|
51
51
|
"@vue/test-utils": "^2.4.11",
|
|
52
|
-
"ctix": "^2.8.
|
|
52
|
+
"ctix": "^2.8.2",
|
|
53
53
|
"type-fest": "^5.8.0",
|
|
54
|
-
"typedoc": "^0.28.
|
|
54
|
+
"typedoc": "^0.28.20",
|
|
55
55
|
"unplugin-auto-import": "^21.0.0",
|
|
56
|
-
"vite": "^8.
|
|
57
|
-
"vitest": "^4.1.
|
|
58
|
-
"vue-tsc": "3.3.
|
|
56
|
+
"vite": "^8.2.0",
|
|
57
|
+
"vitest": "^4.1.10",
|
|
58
|
+
"vue-tsc": "^3.3.8"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@esposter/shared": "2.
|
|
62
|
-
"parse-tmx": "2.
|
|
63
|
-
"phaser": "^4.2.
|
|
61
|
+
"@esposter/shared": "2.35.0",
|
|
62
|
+
"parse-tmx": "2.35.0",
|
|
63
|
+
"phaser": "^4.2.1",
|
|
64
64
|
"phaser4-rex-plugins": "^4.2.0",
|
|
65
|
-
"pinia": "^
|
|
66
|
-
"vue": "^3.5.
|
|
65
|
+
"pinia": "^4.0.2",
|
|
66
|
+
"vue": "^3.5.40"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "786902aca40292b2883de2ad1eb876ca32f6ac75"
|
|
69
69
|
}
|