@rpgjs/client 5.0.0-alpha.2 → 5.0.0-alpha.20
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/Game/AnimationManager.d.ts +8 -0
- package/dist/Game/Map.d.ts +7 -1
- package/dist/Gui/Gui.d.ts +128 -5
- package/dist/RpgClient.d.ts +217 -59
- package/dist/RpgClientEngine.d.ts +345 -6
- package/dist/Sound.d.ts +199 -0
- package/dist/components/animations/index.d.ts +4 -0
- package/dist/components/dynamics/parse-value.d.ts +1 -0
- package/dist/components/gui/index.d.ts +3 -3
- package/dist/components/index.d.ts +3 -1
- package/dist/components/prebuilt/index.d.ts +18 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/index10.js +149 -4
- package/dist/index10.js.map +1 -1
- package/dist/index11.js +21 -7
- package/dist/index11.js.map +1 -1
- package/dist/index12.js +6 -4
- package/dist/index12.js.map +1 -1
- package/dist/index13.js +11 -14
- package/dist/index13.js.map +1 -1
- package/dist/index14.js +8 -40
- package/dist/index14.js.map +1 -1
- package/dist/index15.js +187 -180
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +104 -7
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +82 -372
- package/dist/index17.js.map +1 -1
- package/dist/index18.js +361 -26
- package/dist/index18.js.map +1 -1
- package/dist/index19.js +46 -20
- package/dist/index19.js.map +1 -1
- package/dist/index2.js +683 -32
- package/dist/index2.js.map +1 -1
- package/dist/index20.js +5 -2417
- package/dist/index20.js.map +1 -1
- package/dist/index21.js +383 -97
- package/dist/index21.js.map +1 -1
- package/dist/index22.js +41 -104
- package/dist/index22.js.map +1 -1
- package/dist/index23.js +21 -67
- package/dist/index23.js.map +1 -1
- package/dist/index24.js +2632 -20
- package/dist/index24.js.map +1 -1
- package/dist/index25.js +107 -34
- package/dist/index25.js.map +1 -1
- package/dist/index26.js +69 -3
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +17 -318
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +24 -22
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +92 -8
- package/dist/index29.js.map +1 -1
- package/dist/index3.js +68 -8
- package/dist/index3.js.map +1 -1
- package/dist/index30.js +37 -7
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +18 -168
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +3 -499
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +332 -9
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +24 -4400
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +6 -311
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +8 -88
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +182 -56
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +500 -16
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +10 -18
- package/dist/index39.js.map +1 -1
- package/dist/index4.js +23 -5
- package/dist/index4.js.map +1 -1
- package/dist/index40.js +7 -0
- package/dist/index40.js.map +1 -0
- package/dist/index41.js +3690 -0
- package/dist/index41.js.map +1 -0
- package/dist/index42.js +77 -0
- package/dist/index42.js.map +1 -0
- package/dist/index43.js +6 -0
- package/dist/index43.js.map +1 -0
- package/dist/index44.js +20 -0
- package/dist/index44.js.map +1 -0
- package/dist/index45.js +146 -0
- package/dist/index45.js.map +1 -0
- package/dist/index46.js +12 -0
- package/dist/index46.js.map +1 -0
- package/dist/index47.js +113 -0
- package/dist/index47.js.map +1 -0
- package/dist/index48.js +136 -0
- package/dist/index48.js.map +1 -0
- package/dist/index49.js +137 -0
- package/dist/index49.js.map +1 -0
- package/dist/index5.js +2 -1
- package/dist/index5.js.map +1 -1
- package/dist/index50.js +112 -0
- package/dist/index50.js.map +1 -0
- package/dist/index51.js +141 -0
- package/dist/index51.js.map +1 -0
- package/dist/index52.js +9 -0
- package/dist/index52.js.map +1 -0
- package/dist/index53.js +54 -0
- package/dist/index53.js.map +1 -0
- package/dist/index6.js +1 -1
- package/dist/index6.js.map +1 -1
- package/dist/index7.js +11 -3
- package/dist/index7.js.map +1 -1
- package/dist/index8.js +68 -7
- package/dist/index8.js.map +1 -1
- package/dist/index9.js +230 -15
- package/dist/index9.js.map +1 -1
- package/dist/presets/animation.d.ts +31 -0
- package/dist/presets/faceset.d.ts +30 -0
- package/dist/presets/index.d.ts +103 -0
- package/dist/presets/lpc.d.ts +89 -0
- package/dist/services/loadMap.d.ts +123 -2
- package/dist/services/mmorpg.d.ts +9 -4
- package/dist/services/standalone.d.ts +51 -2
- package/package.json +22 -18
- package/src/Game/{EffectManager.ts → AnimationManager.ts} +3 -2
- package/src/Game/Map.ts +20 -2
- package/src/Game/Object.ts +163 -9
- package/src/Gui/Gui.ts +300 -17
- package/src/RpgClient.ts +222 -58
- package/src/RpgClientEngine.ts +804 -36
- package/src/Sound.ts +253 -0
- package/src/components/{effects → animations}/animation.ce +3 -6
- package/src/components/{effects → animations}/index.ts +1 -1
- package/src/components/character.ce +165 -37
- package/src/components/dynamics/parse-value.ts +80 -0
- package/src/components/dynamics/text.ce +183 -0
- package/src/components/gui/box.ce +17 -0
- package/src/components/gui/dialogbox/index.ce +73 -35
- package/src/components/gui/dialogbox/selection.ce +16 -1
- package/src/components/gui/index.ts +3 -4
- package/src/components/index.ts +5 -1
- package/src/components/prebuilt/hp-bar.ce +255 -0
- package/src/components/prebuilt/index.ts +21 -0
- package/src/components/scenes/draw-map.ce +6 -23
- package/src/components/scenes/event-layer.ce +9 -3
- package/src/core/setup.ts +2 -0
- package/src/index.ts +5 -2
- package/src/module.ts +72 -6
- package/src/presets/animation.ts +46 -0
- package/src/presets/faceset.ts +60 -0
- package/src/presets/index.ts +7 -1
- package/src/presets/lpc.ts +108 -0
- package/src/services/loadMap.ts +132 -3
- package/src/services/mmorpg.ts +27 -5
- package/src/services/standalone.ts +68 -6
- package/tsconfig.json +1 -1
- package/vite.config.ts +1 -1
- package/dist/Game/EffectManager.d.ts +0 -5
- package/dist/components/effects/index.d.ts +0 -4
- package/src/components/scenes/element-map.ce +0 -23
- /package/src/components/{effects → animations}/hit.ce +0 -0
package/dist/index26.js
CHANGED
|
@@ -1,5 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { useProps, useDefineProps, animatedSignal, signal, mount, tick, h, Text } from 'canvasengine';
|
|
2
|
+
import { Direction } from '@rpgjs/common';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
function component($$props) {
|
|
5
|
+
useProps($$props);
|
|
6
|
+
const defineProps = useDefineProps($$props);
|
|
7
|
+
var _a = defineProps({
|
|
8
|
+
duration: {
|
|
9
|
+
default: 1000
|
|
10
|
+
},
|
|
11
|
+
color: {
|
|
12
|
+
default: 'black'
|
|
13
|
+
}
|
|
14
|
+
}), text = _a.text, direction = _a.direction, onFinish = _a.onFinish, duration = _a.duration, color = _a.color, positionX = _a.x, positionY = _a.y;
|
|
15
|
+
var scale = animatedSignal(1, {
|
|
16
|
+
duration: duration(),
|
|
17
|
+
});
|
|
18
|
+
var randomPosition = function () { return Math.floor(Math.random() * 60); };
|
|
19
|
+
var initialY = randomPosition();
|
|
20
|
+
var x = signal(positionX());
|
|
21
|
+
var y = signal(positionY() - initialY);
|
|
22
|
+
var velocityX = 0;
|
|
23
|
+
var velocityY = 0;
|
|
24
|
+
var speed = 200;
|
|
25
|
+
switch (direction()) {
|
|
26
|
+
case Direction.Left:
|
|
27
|
+
velocityX = speed;
|
|
28
|
+
break;
|
|
29
|
+
case Direction.Right:
|
|
30
|
+
velocityX = -speed;
|
|
31
|
+
break;
|
|
32
|
+
case Direction.Up:
|
|
33
|
+
velocityY = speed;
|
|
34
|
+
break;
|
|
35
|
+
case Direction.Down:
|
|
36
|
+
velocityY = -speed;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
velocityX += (Math.random() - 0.5) * 100;
|
|
40
|
+
velocityY += (Math.random() - 0.5) * 100;
|
|
41
|
+
var gravity = 500;
|
|
42
|
+
var deceleration = 0.98;
|
|
43
|
+
mount(function () {
|
|
44
|
+
scale.set(0.1);
|
|
45
|
+
});
|
|
46
|
+
var elapsedTime = 0;
|
|
47
|
+
tick(function (_a) {
|
|
48
|
+
var deltaTime = _a.deltaTime;
|
|
49
|
+
elapsedTime += deltaTime;
|
|
50
|
+
if (elapsedTime < duration()) {
|
|
51
|
+
// Update position
|
|
52
|
+
x.update(function (x) { return x + (velocityX * deltaTime) / 1000; });
|
|
53
|
+
y.update(function (y) { return y + (velocityY * deltaTime) / 1000; });
|
|
54
|
+
// Apply gravity
|
|
55
|
+
velocityY += (gravity * deltaTime) / 1000;
|
|
56
|
+
// Apply deceleration
|
|
57
|
+
velocityX *= deceleration;
|
|
58
|
+
velocityY *= deceleration;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
if (onFinish) {
|
|
62
|
+
onFinish();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
let $this = h(Text, { x, y, zIndex: 10000, color, scale, size: 30, text });
|
|
67
|
+
return $this
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { component as default };
|
|
5
71
|
//# sourceMappingURL=index26.js.map
|
package/dist/index26.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index26.js","sources":["
|
|
1
|
+
{"version":3,"file":"index26.js","sources":["../src/components/animations/hit.ce"],"sourcesContent":["<Text x y zIndex={10000} color scale size={30} text />\n\n<script>\n import { animatedSignal, mount, signal, tick } from \"canvasengine\";\n import { Direction } from \"@rpgjs/common\";\n const {\n text,\n direction,\n onFinish,\n duration,\n color,\n x: positionX,\n y: positionY\n } = defineProps({\n duration: {\n default: 1000\n },\n color: {\n default: 'black'\n }\n });\n\n const scale = animatedSignal(1, {\n duration: duration(),\n });\n\n // Generate random initial position\n const randomPosition = () => Math.floor(Math.random() * 60);\n const initialY = randomPosition();\n const x = signal(positionX());\n const y = signal(positionY() - initialY);\n\n // Initial velocity\n let velocityX = 0;\n let velocityY = 0;\n\n // Set initial velocity based on direction\n const speed = 200;\n switch (direction()) {\n case Direction.Left:\n velocityX = speed;\n break;\n case Direction.Right:\n velocityX = -speed;\n break;\n case Direction.Up:\n velocityY = speed;\n break;\n case Direction.Down:\n velocityY = -speed;\n break;\n }\n\n // Add some randomness to the velocity\n velocityX += (Math.random() - 0.5) * 100;\n velocityY += (Math.random() - 0.5) * 100;\n\n const gravity = 500; // Gravity effect\n const deceleration = 0.98; // Deceleration factor\n\n mount(() => {\n scale.set(0.1);\n });\n\n let elapsedTime = 0;\n\n tick(({ deltaTime }) => {\n elapsedTime += deltaTime;\n \n if (elapsedTime < duration()) {\n // Update position\n x.update((x) => x + (velocityX * deltaTime) / 1000);\n y.update((y) => y + (velocityY * deltaTime) / 1000);\n\n // Apply gravity\n velocityY += (gravity * deltaTime) / 1000;\n\n // Apply deceleration\n velocityX *= deceleration;\n velocityY *= deceleration;\n } else {\n if (onFinish) {\n onFinish();\n }\n }\n });\n</script>\n"],"names":[],"mappings":";;;AAOqB,SAAS,SAAS,CAAC,OAAO,EAAE;AACjD,QAAuB,QAAQ,CAAC,OAAO;AACvC,QAAQ,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO;AAClD,QAAQ,IAAI,EAAE,GAAG,WAAW,CAAC;AAC7B,IAAI,QAAQ,EAAE;AACd,QAAQ,OAAO,EAAE;AACjB,KAAK;AACL,IAAI,KAAK,EAAE;AACX,QAAQ,OAAO,EAAE;AACjB;AACA,CAAC,CAAC,EAAE,IAAI,GAAG,EAAE,CAAC,IAAI,EAAE,SAAS,GAAG,EAAE,CAAC,SAAS,EAAE,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,KAAK,GAAG,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,EAAE,CAAC,CAAC,EAAE,SAAS,GAAG,EAAE,CAAC,CAAC;AAClJ,IAAI,KAAK,GAAG,cAAc,CAAC,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W,IAAI,SAAS;AAC5B,IAAI,IAAI,WAAW,GAAG,QAAQ,EAAE,EAAE;AAClC;AACA,QAAQ,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;AAC7E,QAAQ,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;AAC7E;AACA,QAAQ,SAAS,IAAI,CAAC,OAAO,GAAG,SAAS,IAAI,IAAI;AACjD;AACA,QAAQ,SAAS,IAAI,YAAY;AACjC,QAAQ,SAAS,IAAI,YAAY;AACjC,IAAI;AACJ,SAAS;AACT,QAAQ,IAAI,QAAQ,EAAE;AACtB,YAAY,QAAQ,EAAE;AACtB,QAAQ;AACR,IAAI;AACJ,CAAC,CAAC;AACF,QAAQ,IAAI,KAAK,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE;AACjF,QAAQ,OAAO;AACf,MAAM;;;;"}
|
package/dist/index27.js
CHANGED
|
@@ -1,322 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useProps, useDefineProps, h, Sprite } from 'canvasengine';
|
|
2
|
+
import { RpgClientEngine } from './index2.js';
|
|
3
|
+
import { inject } from './index6.js';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
items
|
|
14
|
-
});
|
|
15
|
-
this.createProxy(items);
|
|
16
|
-
}
|
|
17
|
-
createProxy(items) {
|
|
18
|
-
this._items = new Proxy(items, {
|
|
19
|
-
get: /* @__PURE__ */ __name((target, prop, receiver) => {
|
|
20
|
-
const origMethod = target[prop];
|
|
21
|
-
if (typeof origMethod === "function") {
|
|
22
|
-
return (...args) => {
|
|
23
|
-
let changeType = "update";
|
|
24
|
-
let index = void 0;
|
|
25
|
-
let isMutateFn = false;
|
|
26
|
-
let itemsToEmit = [];
|
|
27
|
-
let changeSplice = true;
|
|
28
|
-
switch (prop) {
|
|
29
|
-
case "push":
|
|
30
|
-
index = target.length;
|
|
31
|
-
changeType = "add";
|
|
32
|
-
isMutateFn = true;
|
|
33
|
-
break;
|
|
34
|
-
case "pop":
|
|
35
|
-
index = target.length - 1;
|
|
36
|
-
changeType = "remove";
|
|
37
|
-
isMutateFn = true;
|
|
38
|
-
break;
|
|
39
|
-
case "unshift":
|
|
40
|
-
index = 0;
|
|
41
|
-
changeType = "add";
|
|
42
|
-
isMutateFn = true;
|
|
43
|
-
break;
|
|
44
|
-
case "shift":
|
|
45
|
-
index = 0;
|
|
46
|
-
changeType = "remove";
|
|
47
|
-
isMutateFn = true;
|
|
48
|
-
break;
|
|
49
|
-
case "splice":
|
|
50
|
-
index = args[0];
|
|
51
|
-
const deleteCount = args[1];
|
|
52
|
-
const newItems = args.slice(2);
|
|
53
|
-
itemsToEmit = newItems;
|
|
54
|
-
if (deleteCount > 0 && newItems.length === 0) {
|
|
55
|
-
changeType = "remove";
|
|
56
|
-
} else if (deleteCount === 0 && newItems.length > 0) {
|
|
57
|
-
changeType = "add";
|
|
58
|
-
} else if (deleteCount === 0 && newItems.length === 0) {
|
|
59
|
-
changeSplice = false;
|
|
60
|
-
} else {
|
|
61
|
-
changeType = "update";
|
|
62
|
-
}
|
|
63
|
-
isMutateFn = true;
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
const result = origMethod.apply(target, args);
|
|
67
|
-
if (isMutateFn && changeSplice) {
|
|
68
|
-
if (prop === "splice") {
|
|
69
|
-
this.next({
|
|
70
|
-
type: changeType,
|
|
71
|
-
index,
|
|
72
|
-
items: itemsToEmit
|
|
73
|
-
});
|
|
74
|
-
} else {
|
|
75
|
-
this.next({
|
|
76
|
-
type: changeType,
|
|
77
|
-
index,
|
|
78
|
-
items: args
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return result;
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
return Reflect.get(target, prop, receiver);
|
|
86
|
-
}, "get"),
|
|
87
|
-
set: /* @__PURE__ */ __name((target, prop, value) => {
|
|
88
|
-
const index = !isNaN(Number(prop)) ? Number(prop) : void 0;
|
|
89
|
-
target[prop] = value;
|
|
90
|
-
this.next({
|
|
91
|
-
type: "update",
|
|
92
|
-
index,
|
|
93
|
-
items: [
|
|
94
|
-
value
|
|
95
|
-
]
|
|
96
|
-
});
|
|
97
|
-
return true;
|
|
98
|
-
}, "set")
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
get items() {
|
|
102
|
-
return this._items;
|
|
103
|
-
}
|
|
104
|
-
set items(newItems) {
|
|
105
|
-
this.createProxy(newItems);
|
|
106
|
-
this.next({
|
|
107
|
-
type: "reset",
|
|
108
|
-
items: newItems
|
|
109
|
-
});
|
|
110
|
-
}
|
|
5
|
+
function component($$props) {
|
|
6
|
+
useProps($$props);
|
|
7
|
+
const defineProps = useDefineProps($$props);
|
|
8
|
+
var _a;
|
|
9
|
+
var _b = defineProps(), x = _b.x, y = _b.y, animationName = _b.animationName, graphic = _b.graphic, onFinish = _b.onFinish;
|
|
10
|
+
var client = inject(RpgClientEngine);
|
|
11
|
+
var sheet = {
|
|
12
|
+
definition: client.getSpriteSheet(graphic()),
|
|
13
|
+
playing: (_a = animationName()) !== null && _a !== void 0 ? _a : 'default',
|
|
14
|
+
onFinish: onFinish
|
|
111
15
|
};
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
var ObjectSubject = class extends BehaviorSubject {
|
|
116
|
-
static {
|
|
117
|
-
__name(this, "ObjectSubject");
|
|
118
|
-
}
|
|
119
|
-
_obj;
|
|
120
|
-
constructor(obj = {}) {
|
|
121
|
-
super({
|
|
122
|
-
type: "init",
|
|
123
|
-
value: obj
|
|
124
|
-
});
|
|
125
|
-
this.createProxy(obj);
|
|
126
|
-
}
|
|
127
|
-
createProxy(obj) {
|
|
128
|
-
this._obj = new Proxy(obj, {
|
|
129
|
-
get: /* @__PURE__ */ __name((target, prop, receiver) => {
|
|
130
|
-
return Reflect.get(target, prop, receiver);
|
|
131
|
-
}, "get"),
|
|
132
|
-
set: /* @__PURE__ */ __name((target, prop, value, receiver) => {
|
|
133
|
-
const key = prop;
|
|
134
|
-
const changeType = key in target ? "update" : "add";
|
|
135
|
-
target[key] = value;
|
|
136
|
-
this.next({
|
|
137
|
-
type: changeType,
|
|
138
|
-
key,
|
|
139
|
-
value
|
|
140
|
-
});
|
|
141
|
-
return true;
|
|
142
|
-
}, "set"),
|
|
143
|
-
deleteProperty: /* @__PURE__ */ __name((target, prop) => {
|
|
144
|
-
const key = prop;
|
|
145
|
-
if (key in target) {
|
|
146
|
-
const value = target[key];
|
|
147
|
-
delete target[key];
|
|
148
|
-
this.next({
|
|
149
|
-
type: "remove",
|
|
150
|
-
key,
|
|
151
|
-
value
|
|
152
|
-
});
|
|
153
|
-
return true;
|
|
154
|
-
}
|
|
155
|
-
return false;
|
|
156
|
-
}, "deleteProperty")
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
get obj() {
|
|
160
|
-
return this._obj;
|
|
161
|
-
}
|
|
162
|
-
set obj(newObj) {
|
|
163
|
-
this.createProxy(newObj);
|
|
164
|
-
this.next({
|
|
165
|
-
type: "reset",
|
|
166
|
-
value: newObj
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
var isObjectSubject = /* @__PURE__ */ __name((value) => {
|
|
171
|
-
return "_obj" in value;
|
|
172
|
-
}, "isObjectSubject");
|
|
173
|
-
var getGlobalReactiveStore = /* @__PURE__ */ __name(() => {
|
|
174
|
-
const globalKey = "__REACTIVE_STORE__";
|
|
175
|
-
if (typeof globalThis !== "undefined") {
|
|
176
|
-
if (!globalThis[globalKey]) {
|
|
177
|
-
globalThis[globalKey] = {
|
|
178
|
-
currentDependencyTracker: null,
|
|
179
|
-
currentSubscriptionsTracker: null
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
return globalThis[globalKey];
|
|
183
|
-
}
|
|
184
|
-
let globalObj;
|
|
185
|
-
if (typeof window !== "undefined") {
|
|
186
|
-
globalObj = window;
|
|
187
|
-
} else if (typeof process !== "undefined" && process.versions && process.versions.node) {
|
|
188
|
-
globalObj = Function("return this")();
|
|
189
|
-
} else if (typeof self !== "undefined") {
|
|
190
|
-
globalObj = self;
|
|
191
|
-
} else {
|
|
192
|
-
console.warn("Unable to find global object, using local instance");
|
|
193
|
-
return {
|
|
194
|
-
currentDependencyTracker: null,
|
|
195
|
-
currentSubscriptionsTracker: null
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
if (!globalObj[globalKey]) {
|
|
199
|
-
globalObj[globalKey] = {
|
|
200
|
-
currentDependencyTracker: null,
|
|
201
|
-
currentSubscriptionsTracker: null
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
return globalObj[globalKey];
|
|
205
|
-
}, "getGlobalReactiveStore");
|
|
206
|
-
var reactiveStore = getGlobalReactiveStore();
|
|
207
|
-
var trackDependency = /* @__PURE__ */ __name((signal2) => {
|
|
208
|
-
if (reactiveStore.currentDependencyTracker) {
|
|
209
|
-
reactiveStore.currentDependencyTracker(signal2);
|
|
210
|
-
}
|
|
211
|
-
}, "trackDependency");
|
|
212
|
-
function signal(defaultValue) {
|
|
213
|
-
let subject;
|
|
214
|
-
if (Array.isArray(defaultValue)) {
|
|
215
|
-
subject = new ArraySubject(defaultValue);
|
|
216
|
-
} else if (typeof defaultValue === "object" && defaultValue !== null) {
|
|
217
|
-
subject = new ObjectSubject(defaultValue);
|
|
218
|
-
} else {
|
|
219
|
-
subject = new BehaviorSubject(defaultValue);
|
|
220
|
-
}
|
|
221
|
-
const getValue = /* @__PURE__ */ __name(() => {
|
|
222
|
-
if (subject instanceof ArraySubject) {
|
|
223
|
-
return subject.items;
|
|
224
|
-
} else if (subject instanceof ObjectSubject) {
|
|
225
|
-
return subject.obj;
|
|
226
|
-
}
|
|
227
|
-
return subject.value;
|
|
228
|
-
}, "getValue");
|
|
229
|
-
const fn = /* @__PURE__ */ __name(function() {
|
|
230
|
-
trackDependency(fn);
|
|
231
|
-
return getValue();
|
|
232
|
-
}, "fn");
|
|
233
|
-
fn.set = (value) => {
|
|
234
|
-
if (subject instanceof ArraySubject) {
|
|
235
|
-
subject.items = value;
|
|
236
|
-
} else if (subject instanceof ObjectSubject) {
|
|
237
|
-
subject.obj = value;
|
|
238
|
-
} else {
|
|
239
|
-
subject.next(value);
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
fn._isFrozen = false;
|
|
243
|
-
fn.freeze = () => {
|
|
244
|
-
fn._isFrozen = true;
|
|
245
|
-
};
|
|
246
|
-
fn.unfreeze = () => {
|
|
247
|
-
fn._isFrozen = false;
|
|
248
|
-
if (subject instanceof ArraySubject) {
|
|
249
|
-
subject.next({
|
|
250
|
-
type: "init",
|
|
251
|
-
items: subject.items
|
|
252
|
-
});
|
|
253
|
-
} else if (subject instanceof ObjectSubject) {
|
|
254
|
-
subject.next({
|
|
255
|
-
type: "init",
|
|
256
|
-
value: subject.obj
|
|
257
|
-
});
|
|
258
|
-
} else {
|
|
259
|
-
subject.next(subject.value);
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
fn.mutate = (mutateFn) => {
|
|
263
|
-
const value = getValue();
|
|
264
|
-
mutateFn(value);
|
|
265
|
-
};
|
|
266
|
-
fn.update = (updateFn) => {
|
|
267
|
-
const updatedValue = updateFn(getValue());
|
|
268
|
-
fn.set(updatedValue);
|
|
269
|
-
};
|
|
270
|
-
fn.observable = subject.asObservable().pipe(filter(() => !fn._isFrozen));
|
|
271
|
-
fn._subject = subject;
|
|
272
|
-
return fn;
|
|
273
|
-
}
|
|
274
|
-
__name(signal, "signal");
|
|
275
|
-
function isSignal(value) {
|
|
276
|
-
return !!(value && value.observable);
|
|
277
|
-
}
|
|
278
|
-
__name(isSignal, "isSignal");
|
|
279
|
-
function isComputed(value) {
|
|
280
|
-
return isSignal(value) && !!value.dependencies;
|
|
281
|
-
}
|
|
282
|
-
__name(isComputed, "isComputed");
|
|
283
|
-
function computed(computeFunction, disposableFn) {
|
|
284
|
-
const dependencies = /* @__PURE__ */ new Set();
|
|
285
|
-
let init = true;
|
|
286
|
-
let lastComputedValue;
|
|
287
|
-
const previousTracker = reactiveStore.currentDependencyTracker;
|
|
288
|
-
reactiveStore.currentDependencyTracker = (signal2) => {
|
|
289
|
-
dependencies.add(signal2);
|
|
290
|
-
};
|
|
291
|
-
lastComputedValue = computeFunction();
|
|
292
|
-
if (computeFunction["isEffect"]) {
|
|
293
|
-
disposableFn = lastComputedValue;
|
|
294
|
-
}
|
|
295
|
-
reactiveStore.currentDependencyTracker = previousTracker;
|
|
296
|
-
const computedObservable = combineLatest([
|
|
297
|
-
...dependencies
|
|
298
|
-
].map((signal2) => signal2.observable)).pipe(filter(() => !init), map(() => computeFunction()), finalize(() => disposableFn?.()));
|
|
299
|
-
const fn = /* @__PURE__ */ __name(function() {
|
|
300
|
-
trackDependency(fn);
|
|
301
|
-
return lastComputedValue;
|
|
302
|
-
}, "fn");
|
|
303
|
-
fn.observable = computedObservable;
|
|
304
|
-
fn.subscription = computedObservable.subscribe((value) => {
|
|
305
|
-
lastComputedValue = value;
|
|
306
|
-
});
|
|
307
|
-
fn.dependencies = dependencies;
|
|
308
|
-
reactiveStore.currentSubscriptionsTracker?.(fn.subscription);
|
|
309
|
-
init = false;
|
|
310
|
-
return fn;
|
|
311
|
-
}
|
|
312
|
-
__name(computed, "computed");
|
|
313
|
-
|
|
314
|
-
// src/effect.ts
|
|
315
|
-
function effect(fn) {
|
|
316
|
-
fn["isEffect"] = true;
|
|
317
|
-
return computed(fn);
|
|
318
|
-
}
|
|
319
|
-
__name(effect, "effect");
|
|
16
|
+
let $this = h(Sprite, { sheet, x, y, anchor: 0.5 });
|
|
17
|
+
return $this
|
|
18
|
+
}
|
|
320
19
|
|
|
321
|
-
export {
|
|
20
|
+
export { component as default };
|
|
322
21
|
//# sourceMappingURL=index27.js.map
|
package/dist/index27.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index27.js","sources":["../../../node_modules/.pnpm/@signe+reactive@2.3.3/node_modules/@signe/reactive/dist/index.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/ArraySubject.ts\nimport { BehaviorSubject } from \"rxjs\";\nvar ArraySubject = class extends BehaviorSubject {\n static {\n __name(this, \"ArraySubject\");\n }\n _items = [];\n constructor(items = []) {\n super({\n type: \"init\",\n items\n });\n this.createProxy(items);\n }\n createProxy(items) {\n this._items = new Proxy(items, {\n get: /* @__PURE__ */ __name((target, prop, receiver) => {\n const origMethod = target[prop];\n if (typeof origMethod === \"function\") {\n return (...args) => {\n let changeType = \"update\";\n let index = void 0;\n let isMutateFn = false;\n let itemsToEmit = [];\n let changeSplice = true;\n switch (prop) {\n case \"push\":\n index = target.length;\n changeType = \"add\";\n isMutateFn = true;\n break;\n case \"pop\":\n index = target.length - 1;\n changeType = \"remove\";\n isMutateFn = true;\n break;\n case \"unshift\":\n index = 0;\n changeType = \"add\";\n isMutateFn = true;\n break;\n case \"shift\":\n index = 0;\n changeType = \"remove\";\n isMutateFn = true;\n break;\n case \"splice\":\n index = args[0];\n const deleteCount = args[1];\n const newItems = args.slice(2);\n itemsToEmit = newItems;\n if (deleteCount > 0 && newItems.length === 0) {\n changeType = \"remove\";\n } else if (deleteCount === 0 && newItems.length > 0) {\n changeType = \"add\";\n } else if (deleteCount === 0 && newItems.length === 0) {\n changeSplice = false;\n } else {\n changeType = \"update\";\n }\n isMutateFn = true;\n break;\n }\n const result = origMethod.apply(target, args);\n if (isMutateFn && changeSplice) {\n if (prop === \"splice\") {\n this.next({\n type: changeType,\n index,\n items: itemsToEmit\n });\n } else {\n this.next({\n type: changeType,\n index,\n items: args\n });\n }\n }\n return result;\n };\n }\n return Reflect.get(target, prop, receiver);\n }, \"get\"),\n set: /* @__PURE__ */ __name((target, prop, value) => {\n const index = !isNaN(Number(prop)) ? Number(prop) : void 0;\n target[prop] = value;\n this.next({\n type: \"update\",\n index,\n items: [\n value\n ]\n });\n return true;\n }, \"set\")\n });\n }\n get items() {\n return this._items;\n }\n set items(newItems) {\n this.createProxy(newItems);\n this.next({\n type: \"reset\",\n items: newItems\n });\n }\n};\nvar isArraySubject = /* @__PURE__ */ __name((value) => {\n return \"_items\" in value;\n}, \"isArraySubject\");\n\n// src/ObjectSubject.ts\nimport { BehaviorSubject as BehaviorSubject2 } from \"rxjs\";\nvar ObjectSubject = class extends BehaviorSubject2 {\n static {\n __name(this, \"ObjectSubject\");\n }\n _obj;\n constructor(obj = {}) {\n super({\n type: \"init\",\n value: obj\n });\n this.createProxy(obj);\n }\n createProxy(obj) {\n this._obj = new Proxy(obj, {\n get: /* @__PURE__ */ __name((target, prop, receiver) => {\n return Reflect.get(target, prop, receiver);\n }, \"get\"),\n set: /* @__PURE__ */ __name((target, prop, value, receiver) => {\n const key = prop;\n const changeType = key in target ? \"update\" : \"add\";\n target[key] = value;\n this.next({\n type: changeType,\n key,\n value\n });\n return true;\n }, \"set\"),\n deleteProperty: /* @__PURE__ */ __name((target, prop) => {\n const key = prop;\n if (key in target) {\n const value = target[key];\n delete target[key];\n this.next({\n type: \"remove\",\n key,\n value\n });\n return true;\n }\n return false;\n }, \"deleteProperty\")\n });\n }\n get obj() {\n return this._obj;\n }\n set obj(newObj) {\n this.createProxy(newObj);\n this.next({\n type: \"reset\",\n value: newObj\n });\n }\n};\nvar isObjectSubject = /* @__PURE__ */ __name((value) => {\n return \"_obj\" in value;\n}, \"isObjectSubject\");\n\n// src/signal.ts\nimport { BehaviorSubject as BehaviorSubject3, combineLatest, filter, finalize, map } from \"rxjs\";\nvar getGlobalReactiveStore = /* @__PURE__ */ __name(() => {\n const globalKey = \"__REACTIVE_STORE__\";\n if (typeof globalThis !== \"undefined\") {\n if (!globalThis[globalKey]) {\n globalThis[globalKey] = {\n currentDependencyTracker: null,\n currentSubscriptionsTracker: null\n };\n }\n return globalThis[globalKey];\n }\n let globalObj;\n if (typeof window !== \"undefined\") {\n globalObj = window;\n } else if (typeof process !== \"undefined\" && process.versions && process.versions.node) {\n globalObj = Function(\"return this\")();\n } else if (typeof self !== \"undefined\") {\n globalObj = self;\n } else {\n console.warn(\"Unable to find global object, using local instance\");\n return {\n currentDependencyTracker: null,\n currentSubscriptionsTracker: null\n };\n }\n if (!globalObj[globalKey]) {\n globalObj[globalKey] = {\n currentDependencyTracker: null,\n currentSubscriptionsTracker: null\n };\n }\n return globalObj[globalKey];\n}, \"getGlobalReactiveStore\");\nvar reactiveStore = getGlobalReactiveStore();\nvar trackDependency = /* @__PURE__ */ __name((signal2) => {\n if (reactiveStore.currentDependencyTracker) {\n reactiveStore.currentDependencyTracker(signal2);\n }\n}, \"trackDependency\");\nfunction signal(defaultValue) {\n let subject;\n if (Array.isArray(defaultValue)) {\n subject = new ArraySubject(defaultValue);\n } else if (typeof defaultValue === \"object\" && defaultValue !== null) {\n subject = new ObjectSubject(defaultValue);\n } else {\n subject = new BehaviorSubject3(defaultValue);\n }\n const getValue = /* @__PURE__ */ __name(() => {\n if (subject instanceof ArraySubject) {\n return subject.items;\n } else if (subject instanceof ObjectSubject) {\n return subject.obj;\n }\n return subject.value;\n }, \"getValue\");\n const fn = /* @__PURE__ */ __name(function() {\n trackDependency(fn);\n return getValue();\n }, \"fn\");\n fn.set = (value) => {\n if (subject instanceof ArraySubject) {\n subject.items = value;\n } else if (subject instanceof ObjectSubject) {\n subject.obj = value;\n } else {\n subject.next(value);\n }\n };\n fn._isFrozen = false;\n fn.freeze = () => {\n fn._isFrozen = true;\n };\n fn.unfreeze = () => {\n fn._isFrozen = false;\n if (subject instanceof ArraySubject) {\n subject.next({\n type: \"init\",\n items: subject.items\n });\n } else if (subject instanceof ObjectSubject) {\n subject.next({\n type: \"init\",\n value: subject.obj\n });\n } else {\n subject.next(subject.value);\n }\n };\n fn.mutate = (mutateFn) => {\n const value = getValue();\n mutateFn(value);\n };\n fn.update = (updateFn) => {\n const updatedValue = updateFn(getValue());\n fn.set(updatedValue);\n };\n fn.observable = subject.asObservable().pipe(filter(() => !fn._isFrozen));\n fn._subject = subject;\n return fn;\n}\n__name(signal, \"signal\");\nfunction isSignal(value) {\n return !!(value && value.observable);\n}\n__name(isSignal, \"isSignal\");\nfunction isComputed(value) {\n return isSignal(value) && !!value.dependencies;\n}\n__name(isComputed, \"isComputed\");\nfunction computed(computeFunction, disposableFn) {\n const dependencies = /* @__PURE__ */ new Set();\n let init = true;\n let lastComputedValue;\n const previousTracker = reactiveStore.currentDependencyTracker;\n reactiveStore.currentDependencyTracker = (signal2) => {\n dependencies.add(signal2);\n };\n lastComputedValue = computeFunction();\n if (computeFunction[\"isEffect\"]) {\n disposableFn = lastComputedValue;\n }\n reactiveStore.currentDependencyTracker = previousTracker;\n const computedObservable = combineLatest([\n ...dependencies\n ].map((signal2) => signal2.observable)).pipe(filter(() => !init), map(() => computeFunction()), finalize(() => disposableFn?.()));\n const fn = /* @__PURE__ */ __name(function() {\n trackDependency(fn);\n return lastComputedValue;\n }, \"fn\");\n fn.observable = computedObservable;\n fn.subscription = computedObservable.subscribe((value) => {\n lastComputedValue = value;\n });\n fn.dependencies = dependencies;\n reactiveStore.currentSubscriptionsTracker?.(fn.subscription);\n init = false;\n return fn;\n}\n__name(computed, \"computed\");\n\n// src/effect.ts\nfunction effect(fn) {\n fn[\"isEffect\"] = true;\n return computed(fn);\n}\n__name(effect, \"effect\");\nexport {\n ArraySubject,\n ObjectSubject,\n computed,\n effect,\n isAr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E,IAAI,GAAG,KAAK;AACd,EAAE,OAAO,EAAE;AACX;AACA,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC;;AAE5B;AACA,SAAS,MAAM,CAAC,EAAE,EAAE;AACpB,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,IAAI;AACvB,EAAE,OAAO,QAAQ,CAAC,EAAE,CAAC;AACrB;AACA,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index27.js","sources":["../src/components/animations/animation.ce"],"sourcesContent":["<Sprite sheet x y anchor={0.5} />\n\n<script>\n import { RpgClientEngine } from \"../../RpgClientEngine\";\n import { inject } from \"../../core/inject\";\n\n const { x, y, animationName, graphic, onFinish } = defineProps();\n\n const client = inject(RpgClientEngine);\n\n const sheet = {\n definition: client.getSpriteSheet(graphic()),\n playing: animationName() ?? 'default',\n onFinish\n };\n</script>\n"],"names":[],"mappings":";;;;AAOqB,SAAS,SAAS,CAAC,OAAO,EAAE;AACjD,QAAuB,QAAQ,CAAC,OAAO;AACvC,QAAQ,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO;AAClD,QAAQ,IAAI,EAAE;AACd,IAAI,EAAE,GAAG,WAAW,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,aAAa,GAAG,EAAE,CAAC,aAAa,EAAE,OAAO,GAAG,EAAE,CAAC,OAAO,EAAE,QAAQ,GAAG,EAAE,CAAC,QAAQ;AAC1H,IAAI,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC;AACpC,IAAI,KAAK,GAAG;AACZ,IAAI,UAAU,EAAE,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;AAChD,IAAI,OAAO,EAAE,CAAC,EAAE,GAAG,aAAa,EAAE,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,EAAE,GAAG,SAAS;AAC9E,IAAI,QAAQ,EAAE;AACd,CAAC;AACD,QAAQ,IAAI,KAAK,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE;AAC1D,QAAQ,OAAO;AACf,MAAM;;;;"}
|
package/dist/index28.js
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return $this
|
|
1
|
+
const AnimationSpritesheetPreset = (framesWidth, framesHeight) => {
|
|
2
|
+
const animations = [];
|
|
3
|
+
for (let y = 0; y < framesHeight; y++) {
|
|
4
|
+
for (let x = 0; x < framesWidth; x++) {
|
|
5
|
+
const frameIndex = y * framesWidth + x;
|
|
6
|
+
animations.push({
|
|
7
|
+
time: frameIndex * 10,
|
|
8
|
+
frameX: x,
|
|
9
|
+
frameY: y
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
framesWidth,
|
|
15
|
+
framesHeight,
|
|
16
|
+
textures: {
|
|
17
|
+
default: {
|
|
18
|
+
animations: () => [
|
|
19
|
+
animations
|
|
20
|
+
]
|
|
22
21
|
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
};
|
|
23
25
|
|
|
24
|
-
export {
|
|
26
|
+
export { AnimationSpritesheetPreset };
|
|
25
27
|
//# sourceMappingURL=index28.js.map
|
package/dist/index28.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index28.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"index28.js","sources":["../src/presets/animation.ts"],"sourcesContent":["/**\n * Creates an animation spritesheet preset with automatic frame generation\n * \n * This function generates animation frames based on the provided width and height dimensions.\n * It creates a sequence of frames that progresses through the spritesheet from left to right,\n * top to bottom, with each frame having a 10ms time increment.\n * \n * @param {number} framesWidth - The number of frames horizontally in the spritesheet\n * @param {number} framesHeight - The number of frames vertically in the spritesheet\n * @returns {Object} Animation preset configuration object\n * \n * @example\n * ```javascript\n * // For a 4x4 spritesheet\n * const preset = AnimationSpritesheetPreset(4, 4);\n * // This will generate 16 frames with coordinates from (0,0) to (3,3)\n * ```\n */\nexport const AnimationSpritesheetPreset = (framesWidth: number, framesHeight: number) => {\n \n const animations: Array<{ time: number; frameX: number; frameY: number }> = [];\n\n for (let y = 0; y < framesHeight; y++) {\n for (let x = 0; x < framesWidth; x++) {\n const frameIndex = y * framesWidth + x;\n animations.push({ \n time: frameIndex * 10, \n frameX: x, \n frameY: y \n });\n }\n }\n \n return {\n framesWidth,\n framesHeight,\n textures: {\n default: {\n animations: () => [\n animations\n ],\n }\n }\n };\n};\n "],"names":[],"mappings":"AAkBO,MAAM,0BAAA,GAA6B,CAAC,WAAA,EAAqB,YAAA,KAAyB;AAErF,EAAA,MAAM,aAAsE,EAAC;AAE7E,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,YAAA,EAAc,CAAA,EAAA,EAAK;AACnC,IAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,WAAA,EAAa,CAAA,EAAA,EAAK;AAClC,MAAA,MAAM,UAAA,GAAa,IAAI,WAAA,GAAc,CAAA;AACrC,MAAA,UAAA,CAAW,IAAA,CAAK;AAAA,QACZ,MAAM,UAAA,GAAa,EAAA;AAAA,QACnB,MAAA,EAAQ,CAAA;AAAA,QACR,MAAA,EAAQ;AAAA,OACX,CAAA;AAAA,IACL;AAAA,EACJ;AAEA,EAAA,OAAO;AAAA,IACH,WAAA;AAAA,IACA,YAAA;AAAA,IACA,QAAA,EAAU;AAAA,MACN,OAAA,EAAS;AAAA,QACL,YAAY,MAAM;AAAA,UACd;AAAA;AACJ;AACJ;AACJ,GACJ;AACJ;;;;"}
|
package/dist/index29.js
CHANGED
|
@@ -1,11 +1,95 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Animation, Direction } from '@rpgjs/common';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
const LPCSpritesheetPreset = (options) => {
|
|
4
|
+
const ratio = options.ratio ?? 1;
|
|
5
|
+
const frameY = (direction) => {
|
|
6
|
+
return {
|
|
7
|
+
[Direction.Down]: 2,
|
|
8
|
+
[Direction.Left]: 1,
|
|
9
|
+
[Direction.Right]: 3,
|
|
10
|
+
[Direction.Up]: 0
|
|
11
|
+
}[direction];
|
|
12
|
+
};
|
|
13
|
+
const stand = (direction) => [
|
|
14
|
+
{ time: 0, frameX: 0, frameY: frameY(direction) }
|
|
15
|
+
];
|
|
16
|
+
const anim = (direction, framesWidth, speed = 5) => {
|
|
17
|
+
const array = [];
|
|
18
|
+
for (let i = 0; i < framesWidth; i++) {
|
|
19
|
+
array.push({ time: i * speed, frameX: i, frameY: frameY(direction) });
|
|
20
|
+
}
|
|
21
|
+
return array;
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
id: options.id,
|
|
25
|
+
image: options.imageSource,
|
|
26
|
+
width: options.width,
|
|
27
|
+
height: options.height,
|
|
28
|
+
opacity: 1,
|
|
29
|
+
rectWidth: 64 * ratio,
|
|
30
|
+
rectHeight: 64 * ratio,
|
|
31
|
+
framesWidth: 6,
|
|
32
|
+
framesHeight: 4,
|
|
33
|
+
spriteRealSize: {
|
|
34
|
+
width: 48 * ratio,
|
|
35
|
+
height: 52 * ratio
|
|
36
|
+
},
|
|
37
|
+
textures: {
|
|
38
|
+
[Animation.Stand]: {
|
|
39
|
+
offset: {
|
|
40
|
+
x: 0,
|
|
41
|
+
y: 512 * ratio
|
|
42
|
+
},
|
|
43
|
+
animations: ({ direction }) => [stand(direction)]
|
|
44
|
+
},
|
|
45
|
+
[Animation.Walk]: {
|
|
46
|
+
offset: {
|
|
47
|
+
x: 0,
|
|
48
|
+
y: 512 * ratio
|
|
49
|
+
},
|
|
50
|
+
framesWidth: 9,
|
|
51
|
+
framesHeight: 4,
|
|
52
|
+
animations: ({ direction }) => [anim(direction, 9)]
|
|
53
|
+
},
|
|
54
|
+
[Animation.Attack]: {
|
|
55
|
+
offset: {
|
|
56
|
+
x: 0,
|
|
57
|
+
y: 768 * ratio
|
|
58
|
+
},
|
|
59
|
+
framesWidth: 6,
|
|
60
|
+
framesHeight: 4,
|
|
61
|
+
animations: ({ direction }) => [anim(direction, 6, 3)]
|
|
62
|
+
},
|
|
63
|
+
[Animation.Skill]: {
|
|
64
|
+
framesWidth: 7,
|
|
65
|
+
framesHeight: 4,
|
|
66
|
+
animations: ({ direction }) => [anim(direction, 7, 3)]
|
|
67
|
+
},
|
|
68
|
+
attack2: {
|
|
69
|
+
offset: {
|
|
70
|
+
x: 0,
|
|
71
|
+
y: 256 * ratio
|
|
72
|
+
},
|
|
73
|
+
framesWidth: 7,
|
|
74
|
+
framesHeight: 8,
|
|
75
|
+
animations: ({ direction }) => [anim(direction, 7, 3)]
|
|
76
|
+
},
|
|
77
|
+
...options.height > 3e3 ? {
|
|
78
|
+
attack3: {
|
|
79
|
+
offset: {
|
|
80
|
+
x: 0,
|
|
81
|
+
y: 5568 - 288 * 4
|
|
82
|
+
},
|
|
83
|
+
rectWidth: 288,
|
|
84
|
+
rectHeight: 288,
|
|
85
|
+
framesWidth: 6,
|
|
86
|
+
framesHeight: 4,
|
|
87
|
+
animations: ({ direction }) => [anim(direction, 6, 3)]
|
|
88
|
+
}
|
|
89
|
+
} : {}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
};
|
|
9
93
|
|
|
10
|
-
export {
|
|
94
|
+
export { LPCSpritesheetPreset };
|
|
11
95
|
//# sourceMappingURL=index29.js.map
|