@rpgjs/client 5.0.0-alpha.22 → 5.0.0-alpha.24
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/Object.d.ts +2 -0
- package/dist/RpgClientEngine.d.ts +115 -9
- package/dist/components/gui/mobile/index.d.ts +8 -0
- package/dist/components/prebuilt/index.d.ts +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +13 -8
- package/dist/index.js.map +1 -1
- package/dist/index10.js +1 -1
- package/dist/index11.js +6 -5
- package/dist/index11.js.map +1 -1
- package/dist/index12.js +2 -2
- package/dist/index13.js +102 -10
- package/dist/index13.js.map +1 -1
- package/dist/index14.js +67 -9
- package/dist/index14.js.map +1 -1
- package/dist/index15.js +10 -263
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +9 -97
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +300 -89
- package/dist/index17.js.map +1 -1
- package/dist/index18.js +63 -80
- package/dist/index18.js.map +1 -1
- package/dist/index19.js +96 -348
- package/dist/index19.js.map +1 -1
- package/dist/index2.js +176 -24
- package/dist/index2.js.map +1 -1
- package/dist/index20.js +360 -17
- package/dist/index20.js.map +1 -1
- package/dist/index21.js +19 -50
- package/dist/index21.js.map +1 -1
- package/dist/index22.js +212 -5
- package/dist/index22.js.map +1 -1
- package/dist/index23.js +6 -395
- package/dist/index23.js.map +1 -1
- package/dist/index24.js +4 -39
- package/dist/index24.js.map +1 -1
- package/dist/index25.js +19 -20
- package/dist/index25.js.map +1 -1
- package/dist/index26.js +43 -2624
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +5 -110
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +394 -65
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +40 -15
- package/dist/index29.js.map +1 -1
- package/dist/index3.js +3 -3
- package/dist/index30.js +21 -23
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +2624 -86
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +107 -34
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +69 -22
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +19 -3
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +21 -329
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +91 -30
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +37 -7
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +22 -9
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +139 -10
- package/dist/index39.js.map +1 -1
- package/dist/index4.js +3 -3
- package/dist/index40.js +16 -6
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +1 -325
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +530 -3680
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +24 -67
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +9 -184
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +6 -503
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +325 -2
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +3687 -17
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +69 -202
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +182 -7
- package/dist/index49.js.map +1 -1
- package/dist/index5.js +1 -1
- package/dist/index50.js +497 -106
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +48 -130
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +17 -134
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +3 -109
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +9 -138
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +111 -7
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +130 -48
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +137 -0
- package/dist/index57.js.map +1 -0
- package/dist/index58.js +112 -0
- package/dist/index58.js.map +1 -0
- package/dist/index59.js +9 -0
- package/dist/index59.js.map +1 -0
- package/dist/index6.js +1 -1
- package/dist/index7.js +1 -1
- package/dist/index8.js +17 -2
- package/dist/index8.js.map +1 -1
- package/dist/index9.js +10 -27
- package/dist/index9.js.map +1 -1
- package/dist/services/keyboardControls.d.ts +1 -2
- package/dist/services/mmorpg.d.ts +1 -1
- package/dist/services/standalone.d.ts +1 -1
- package/package.json +9 -9
- package/src/Game/Object.ts +8 -0
- package/src/Gui/Gui.ts +4 -31
- package/src/RpgClientEngine.ts +193 -20
- package/src/components/character.ce +146 -9
- package/src/components/gui/mobile/index.ts +24 -0
- package/src/components/gui/mobile/mobile.ce +80 -0
- package/src/components/prebuilt/index.ts +1 -0
- package/src/components/prebuilt/light-halo.ce +148 -0
- package/src/components/scenes/canvas.ce +2 -2
- package/src/components/scenes/event-layer.ce +1 -0
- package/src/components/scenes/transition.ce +60 -0
- package/src/index.ts +6 -1
- package/src/module.ts +15 -0
- package/src/services/keyboardControls.ts +1 -1
package/dist/index28.js
CHANGED
|
@@ -1,71 +1,400 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { __name } from './index41.js';
|
|
2
|
+
import { isSignal, isComputed, isObjectSubject, isArraySubject } from './index42.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
4
|
+
// src/utils.ts
|
|
5
|
+
function isFunction(val) {
|
|
6
|
+
return {}.toString.call(val) === "[object Function]";
|
|
7
|
+
}
|
|
8
|
+
__name(isFunction, "isFunction");
|
|
9
|
+
function isClass(obj) {
|
|
10
|
+
return typeof obj === "function" && obj.prototype && obj.prototype.constructor === obj;
|
|
11
|
+
}
|
|
12
|
+
__name(isClass, "isClass");
|
|
13
|
+
var isObject = /* @__PURE__ */ __name((item) => item && typeof item === "object" && !Array.isArray(item) && item !== null, "isObject");
|
|
14
|
+
function isInstanceOfClass(value) {
|
|
15
|
+
if (value === null || typeof value !== "object" || value === void 0 || Array.isArray(value)) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return Object.getPrototypeOf(value) !== Object.prototype;
|
|
19
|
+
}
|
|
20
|
+
__name(isInstanceOfClass, "isInstanceOfClass");
|
|
21
|
+
function generateShortUUID() {
|
|
22
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
23
|
+
let uuid = "";
|
|
24
|
+
for (let i = 0; i < 8; i++) {
|
|
25
|
+
const randomIndex = Math.floor(Math.random() * chars.length);
|
|
26
|
+
uuid += chars[randomIndex];
|
|
27
|
+
}
|
|
28
|
+
return uuid;
|
|
29
|
+
}
|
|
30
|
+
__name(generateShortUUID, "generateShortUUID");
|
|
31
|
+
|
|
32
|
+
// src/core.ts
|
|
33
|
+
var DELETE_TOKEN = "$delete";
|
|
34
|
+
var syncClass = /* @__PURE__ */ __name((instance, options = {}) => {
|
|
35
|
+
const cacheSync = /* @__PURE__ */ new Map();
|
|
36
|
+
const cachePersist = /* @__PURE__ */ new Map();
|
|
37
|
+
instance.$valuesChanges = {
|
|
38
|
+
set: /* @__PURE__ */ __name((path, value) => {
|
|
39
|
+
cacheSync.set(path, value);
|
|
40
|
+
options.onSync?.(cacheSync);
|
|
41
|
+
}, "set"),
|
|
42
|
+
setPersist: /* @__PURE__ */ __name((path, value) => {
|
|
43
|
+
if (path == "") path = ".";
|
|
44
|
+
cachePersist.set(path, value);
|
|
45
|
+
options.onPersist?.(cachePersist);
|
|
46
|
+
}, "setPersist"),
|
|
47
|
+
has: /* @__PURE__ */ __name((path) => {
|
|
48
|
+
return cacheSync.has(path);
|
|
49
|
+
}, "has"),
|
|
50
|
+
get: /* @__PURE__ */ __name((path) => {
|
|
51
|
+
return cacheSync.get(path);
|
|
52
|
+
}, "get")
|
|
53
|
+
};
|
|
54
|
+
createSyncClass(instance);
|
|
55
|
+
}, "syncClass");
|
|
56
|
+
function createStatesSnapshot(instance) {
|
|
57
|
+
let persistObject = {};
|
|
58
|
+
if (instance?.$snapshot) {
|
|
59
|
+
for (const key of instance.$snapshot.keys()) {
|
|
60
|
+
const signal = instance.$snapshot.get(key);
|
|
61
|
+
const persist2 = signal.options.persist ?? true;
|
|
62
|
+
let value = signal();
|
|
63
|
+
if (isObject(value) || Array.isArray(value)) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (persist2) {
|
|
67
|
+
persistObject[key] = value;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return persistObject;
|
|
72
|
+
}
|
|
73
|
+
__name(createStatesSnapshot, "createStatesSnapshot");
|
|
74
|
+
function setMetadata(target, key, value) {
|
|
75
|
+
const meta = target.constructor._propertyMetadata;
|
|
76
|
+
const propId = meta?.get(key);
|
|
77
|
+
if (propId) {
|
|
78
|
+
if (isSignal(target[propId])) {
|
|
79
|
+
target[propId].set(value);
|
|
80
|
+
} else {
|
|
81
|
+
target[propId] = value;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
__name(setMetadata, "setMetadata");
|
|
86
|
+
var createSyncClass = /* @__PURE__ */ __name((currentClass, parentKey = null, parentClass = null, path = "") => {
|
|
87
|
+
currentClass.$path = path;
|
|
88
|
+
if (parentClass) {
|
|
89
|
+
currentClass.$valuesChanges = parentClass.$valuesChanges;
|
|
90
|
+
}
|
|
91
|
+
if (parentKey) {
|
|
92
|
+
setMetadata(currentClass, "id", parentKey);
|
|
93
|
+
}
|
|
94
|
+
if (currentClass.$snapshot) {
|
|
95
|
+
for (const key of currentClass.$snapshot.keys()) {
|
|
96
|
+
const signal = currentClass.$snapshot.get(key);
|
|
97
|
+
const syncToClient = signal.options?.syncToClient ?? true;
|
|
98
|
+
const persist2 = signal.options?.persist ?? true;
|
|
99
|
+
const transform = signal.options?.transform;
|
|
100
|
+
let signalValue = signal();
|
|
101
|
+
if (transform) {
|
|
102
|
+
signalValue = transform(signalValue);
|
|
103
|
+
}
|
|
104
|
+
if (isObject(signalValue) || Array.isArray(signalValue)) {
|
|
105
|
+
signalValue = {
|
|
106
|
+
...signalValue
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
const transformedValue = signalValue;
|
|
110
|
+
const newPath = (path ? path + "." : "") + key;
|
|
111
|
+
if (syncToClient) {
|
|
112
|
+
currentClass.$valuesChanges.set(newPath, transformedValue);
|
|
113
|
+
}
|
|
114
|
+
if (persist2) {
|
|
115
|
+
if (parentClass) currentClass.$valuesChanges.setPersist(path, transformedValue);
|
|
116
|
+
}
|
|
117
|
+
if (isComputed(signal)) {
|
|
118
|
+
signal.observable.subscribe((newValue) => {
|
|
119
|
+
if (syncToClient) {
|
|
120
|
+
const transformedNewValue = transform ? transform(newValue) : newValue;
|
|
121
|
+
currentClass.$valuesChanges.set(newPath, transformedNewValue);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}, "createSyncClass");
|
|
128
|
+
var type = /* @__PURE__ */ __name((_signal, path, options = {}, currentInstance) => {
|
|
129
|
+
const { syncToClient = true, persist: persist2 = true, transform } = options;
|
|
130
|
+
let init = true;
|
|
131
|
+
const handleObjectSubject = /* @__PURE__ */ __name((value, propPath) => {
|
|
132
|
+
const newPath = `${propPath}${value.key ? `.${value.key}` : ""}`;
|
|
133
|
+
if ([
|
|
134
|
+
"add",
|
|
135
|
+
"reset",
|
|
136
|
+
"update"
|
|
137
|
+
].includes(value.type)) {
|
|
138
|
+
if (isInstanceOfClass(value.value)) {
|
|
139
|
+
createSyncClass(value.value, value.key, currentInstance, newPath);
|
|
140
|
+
} else if (value.type === "update" && (isObject(value.value) || Array.isArray(value.value))) {
|
|
141
|
+
createSyncClass(value.value, value.key, currentInstance, newPath);
|
|
142
|
+
} else {
|
|
143
|
+
savePath(newPath, value.value);
|
|
144
|
+
}
|
|
145
|
+
} else if (value.type === "remove") {
|
|
146
|
+
savePath(newPath, DELETE_TOKEN);
|
|
147
|
+
}
|
|
148
|
+
}, "handleObjectSubject");
|
|
149
|
+
const handleArraySubject = /* @__PURE__ */ __name((value, propPath) => {
|
|
150
|
+
if (value.type === "reset" && Array.isArray(value.items)) {
|
|
151
|
+
value.items.forEach((item, index) => {
|
|
152
|
+
const newPath2 = `${propPath}.${index}`;
|
|
153
|
+
if (isInstanceOfClass(item)) {
|
|
154
|
+
createSyncClass(item, value.key, currentInstance, newPath2);
|
|
155
|
+
} else {
|
|
156
|
+
savePath(newPath2, item);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const newPath = `${propPath}.${value.index}`;
|
|
162
|
+
const firstItem = value.items?.[0];
|
|
163
|
+
if ([
|
|
164
|
+
"add",
|
|
165
|
+
"update"
|
|
166
|
+
].includes(value.type) && firstItem !== void 0) {
|
|
167
|
+
if (isInstanceOfClass(firstItem)) {
|
|
168
|
+
createSyncClass(firstItem, value.key, currentInstance, newPath);
|
|
169
|
+
} else if (value.type === "update" && (isObject(firstItem) || Array.isArray(firstItem))) {
|
|
170
|
+
createSyncClass(firstItem, value.key, currentInstance, newPath);
|
|
171
|
+
} else {
|
|
172
|
+
savePath(newPath, firstItem);
|
|
173
|
+
}
|
|
174
|
+
} else if (value.type === "remove") {
|
|
175
|
+
savePath(newPath, DELETE_TOKEN);
|
|
176
|
+
}
|
|
177
|
+
}, "handleArraySubject");
|
|
178
|
+
const savePath = /* @__PURE__ */ __name((propPath, value) => {
|
|
179
|
+
const transformedValue = transform && value !== DELETE_TOKEN ? transform(value) : value;
|
|
180
|
+
if (syncToClient) {
|
|
181
|
+
currentInstance.$valuesChanges.set(propPath, transformedValue);
|
|
182
|
+
}
|
|
183
|
+
if (persist2 && currentInstance.$path !== void 0) {
|
|
184
|
+
currentInstance.$valuesChanges.setPersist(transformedValue == DELETE_TOKEN ? propPath : currentInstance.$path, transformedValue);
|
|
185
|
+
}
|
|
186
|
+
}, "savePath");
|
|
187
|
+
const setupSubscription = /* @__PURE__ */ __name((signal, signalPath) => {
|
|
188
|
+
if (!isSignal(signal)) return;
|
|
189
|
+
if (syncToClient && currentInstance.$valuesChanges) {
|
|
190
|
+
const initialValue = signal();
|
|
191
|
+
const transformedInitialValue = transform ? transform(initialValue) : initialValue;
|
|
192
|
+
currentInstance.$valuesChanges.set(signalPath, transformedInitialValue);
|
|
193
|
+
}
|
|
194
|
+
signal.options = options;
|
|
195
|
+
signal.observable.subscribe((value) => {
|
|
196
|
+
if (init) return;
|
|
197
|
+
if (currentInstance.$path !== void 0) {
|
|
198
|
+
const fullPath = `${currentInstance.$path ? currentInstance.$path + "." : ""}${signalPath}`;
|
|
199
|
+
if (isComputed(signal)) {
|
|
200
|
+
savePath(fullPath, value);
|
|
201
|
+
} else if (isObjectSubject(signal._subject)) {
|
|
202
|
+
handleObjectSubject(value, fullPath);
|
|
203
|
+
} else if (isArraySubject(signal._subject)) {
|
|
204
|
+
handleArraySubject(value, fullPath);
|
|
205
|
+
} else {
|
|
206
|
+
savePath(fullPath, value);
|
|
63
207
|
}
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
if (!currentInstance.$snapshot) {
|
|
211
|
+
currentInstance.$snapshot = /* @__PURE__ */ new Map();
|
|
64
212
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
213
|
+
currentInstance.$snapshot.set(path, signal);
|
|
214
|
+
}, "setupSubscription");
|
|
215
|
+
if (!isSignal(_signal)) {
|
|
216
|
+
if (_signal && typeof _signal === "object" && !Array.isArray(_signal)) {
|
|
217
|
+
for (const key in _signal) {
|
|
218
|
+
if (Object.prototype.hasOwnProperty.call(_signal, key)) {
|
|
219
|
+
const value = _signal[key];
|
|
220
|
+
const propertyPath = `${path}.${key}`;
|
|
221
|
+
if (isSignal(value)) {
|
|
222
|
+
setupSubscription(value, propertyPath);
|
|
223
|
+
} else if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
224
|
+
type(value, propertyPath, options, currentInstance);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
68
227
|
}
|
|
228
|
+
init = false;
|
|
229
|
+
}
|
|
230
|
+
return _signal;
|
|
231
|
+
}
|
|
232
|
+
setupSubscription(_signal, path);
|
|
233
|
+
init = false;
|
|
234
|
+
return _signal;
|
|
235
|
+
}, "type");
|
|
236
|
+
|
|
237
|
+
// src/decorators.ts
|
|
238
|
+
function sync(options) {
|
|
239
|
+
let classType;
|
|
240
|
+
let persist2 = true;
|
|
241
|
+
let syncToClient = true;
|
|
242
|
+
let transform;
|
|
243
|
+
if (typeof options === "function") {
|
|
244
|
+
classType = options;
|
|
245
|
+
} else if (typeof options === "object") {
|
|
246
|
+
classType = options.classType;
|
|
247
|
+
if (options.hasOwnProperty("persist")) {
|
|
248
|
+
persist2 = options.persist;
|
|
249
|
+
}
|
|
250
|
+
if (options.hasOwnProperty("syncToClient")) {
|
|
251
|
+
syncToClient = options.syncToClient;
|
|
252
|
+
}
|
|
253
|
+
if (options.hasOwnProperty("transform")) {
|
|
254
|
+
transform = options.transform;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return function(target, propertyKey) {
|
|
258
|
+
const privatePropertyKey = `__${propertyKey}`;
|
|
259
|
+
const getter = /* @__PURE__ */ __name(function() {
|
|
260
|
+
return this[privatePropertyKey];
|
|
261
|
+
}, "getter");
|
|
262
|
+
const setter = /* @__PURE__ */ __name(function(newVal) {
|
|
263
|
+
this[privatePropertyKey] = type(newVal, propertyKey, {
|
|
264
|
+
classType,
|
|
265
|
+
persist: persist2,
|
|
266
|
+
syncToClient,
|
|
267
|
+
transform
|
|
268
|
+
}, this);
|
|
269
|
+
}, "setter");
|
|
270
|
+
Object.defineProperty(target, propertyKey, {
|
|
271
|
+
get: getter,
|
|
272
|
+
set: setter,
|
|
273
|
+
enumerable: true,
|
|
274
|
+
configurable: true
|
|
275
|
+
});
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
__name(sync, "sync");
|
|
279
|
+
function id() {
|
|
280
|
+
return function(target, propertyKey) {
|
|
281
|
+
if (!target.constructor._propertyMetadata) {
|
|
282
|
+
target.constructor._propertyMetadata = /* @__PURE__ */ new Map();
|
|
283
|
+
}
|
|
284
|
+
target.constructor._propertyMetadata.set("id", propertyKey);
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
__name(id, "id");
|
|
288
|
+
function users(options) {
|
|
289
|
+
return function(target, propertyKey) {
|
|
290
|
+
if (!target.constructor._propertyMetadata) {
|
|
291
|
+
target.constructor._propertyMetadata = /* @__PURE__ */ new Map();
|
|
292
|
+
}
|
|
293
|
+
target.constructor._propertyMetadata.set("users", propertyKey);
|
|
294
|
+
sync(options)(target, propertyKey);
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
__name(users, "users");
|
|
298
|
+
function persist() {
|
|
299
|
+
return sync({
|
|
300
|
+
persist: true,
|
|
301
|
+
syncToClient: false
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
__name(persist, "persist");
|
|
305
|
+
function connected() {
|
|
306
|
+
return function(target, propertyKey) {
|
|
307
|
+
if (!target.constructor._propertyMetadata) {
|
|
308
|
+
target.constructor._propertyMetadata = /* @__PURE__ */ new Map();
|
|
309
|
+
}
|
|
310
|
+
target.constructor._propertyMetadata.set("connected", propertyKey);
|
|
311
|
+
sync({
|
|
312
|
+
persist: false
|
|
313
|
+
})(target, propertyKey);
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
__name(connected, "connected");
|
|
317
|
+
function load(rootInstance, values, valueIsObject) {
|
|
318
|
+
if (valueIsObject) {
|
|
319
|
+
loadFromObject(rootInstance, values);
|
|
320
|
+
} else {
|
|
321
|
+
loadFromPaths(rootInstance, values);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
__name(load, "load");
|
|
325
|
+
function loadFromPaths(rootInstance, values) {
|
|
326
|
+
for (const [path, value] of Object.entries(values)) {
|
|
327
|
+
const parts = path.split(".");
|
|
328
|
+
loadValue(rootInstance, parts, value);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
__name(loadFromPaths, "loadFromPaths");
|
|
332
|
+
function loadFromObject(rootInstance, values, currentPath = "") {
|
|
333
|
+
for (let key in values) {
|
|
334
|
+
const value = values[key];
|
|
335
|
+
const newPath = currentPath ? `${currentPath}.${key}` : key;
|
|
336
|
+
if (typeof value === "object" && !Array.isArray(value) && value !== null) {
|
|
337
|
+
loadFromObject(rootInstance, value, newPath);
|
|
338
|
+
} else {
|
|
339
|
+
const parts = newPath.split(".");
|
|
340
|
+
loadValue(rootInstance, parts, value);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
__name(loadFromObject, "loadFromObject");
|
|
345
|
+
function loadValue(rootInstance, parts, value) {
|
|
346
|
+
let current = rootInstance;
|
|
347
|
+
for (let i = 0; i < parts.length; i++) {
|
|
348
|
+
const part = parts[i];
|
|
349
|
+
if (i === parts.length - 1) {
|
|
350
|
+
if (value == DELETE_TOKEN) {
|
|
351
|
+
if (isSignal(current)) {
|
|
352
|
+
current = current();
|
|
353
|
+
}
|
|
354
|
+
Reflect.deleteProperty(current, part);
|
|
355
|
+
} else if (current[part]?._subject) {
|
|
356
|
+
current[part].set(value);
|
|
357
|
+
} else if (isSignal(current) && Array.isArray(current()) && !isNaN(Number(part))) {
|
|
358
|
+
current()[Number(part)] = value;
|
|
359
|
+
} else {
|
|
360
|
+
current[part] = value;
|
|
361
|
+
}
|
|
362
|
+
} else {
|
|
363
|
+
if (isSignal(current)) {
|
|
364
|
+
current = current();
|
|
365
|
+
}
|
|
366
|
+
const currentValue = current[part];
|
|
367
|
+
if (currentValue === void 0) {
|
|
368
|
+
const parentInstance = getByPath(rootInstance, parts.slice(0, i).join("."));
|
|
369
|
+
const classType = parentInstance?.options?.classType;
|
|
370
|
+
if (classType) {
|
|
371
|
+
current[part] = !isClass(classType) ? classType(part) : new classType();
|
|
372
|
+
setMetadata(current[part], "id", part);
|
|
373
|
+
} else {
|
|
374
|
+
current[part] = {};
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
current = current[part];
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
__name(loadValue, "loadValue");
|
|
382
|
+
function getByPath(root, path) {
|
|
383
|
+
const parts = path.split(".");
|
|
384
|
+
let current = root;
|
|
385
|
+
for (const part of parts) {
|
|
386
|
+
if (isSignal(current)) {
|
|
387
|
+
current = current();
|
|
388
|
+
}
|
|
389
|
+
if (current[part]) {
|
|
390
|
+
current = current[part];
|
|
391
|
+
} else {
|
|
392
|
+
return void 0;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
return current;
|
|
396
|
+
}
|
|
397
|
+
__name(getByPath, "getByPath");
|
|
69
398
|
|
|
70
|
-
export {
|
|
399
|
+
export { DELETE_TOKEN, connected, createStatesSnapshot, createSyncClass, generateShortUUID, getByPath, id, isClass, isFunction, isInstanceOfClass, isObject, load, persist, setMetadata, sync, syncClass, type, users };
|
|
71
400
|
//# sourceMappingURL=index28.js.map
|
package/dist/index28.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index28.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,IAA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jF,QAAQ,OAAO;AACf,MAAM;;;;"}
|
|
1
|
+
{"version":3,"file":"index28.js","sources":["../../../node_modules/.pnpm/@signe+sync@2.6.0/node_modules/@signe/sync/dist/index.js"],"sourcesContent":["import {\n __name\n} from \"./chunk-7QVYU63E.js\";\n\n// src/core.ts\nimport { isArraySubject, isObjectSubject, isSignal, isComputed } from \"@signe/reactive\";\n\n// src/utils.ts\nfunction isFunction(val) {\n return {}.toString.call(val) === \"[object Function]\";\n}\n__name(isFunction, \"isFunction\");\nfunction isClass(obj) {\n return typeof obj === \"function\" && obj.prototype && obj.prototype.constructor === obj;\n}\n__name(isClass, \"isClass\");\nvar isObject = /* @__PURE__ */ __name((item) => item && typeof item === \"object\" && !Array.isArray(item) && item !== null, \"isObject\");\nfunction isInstanceOfClass(value) {\n if (value === null || typeof value !== \"object\" || value === void 0 || Array.isArray(value)) {\n return false;\n }\n return Object.getPrototypeOf(value) !== Object.prototype;\n}\n__name(isInstanceOfClass, \"isInstanceOfClass\");\nfunction generateShortUUID() {\n const chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n let uuid = \"\";\n for (let i = 0; i < 8; i++) {\n const randomIndex = Math.floor(Math.random() * chars.length);\n uuid += chars[randomIndex];\n }\n return uuid;\n}\n__name(generateShortUUID, \"generateShortUUID\");\n\n// src/core.ts\nvar DELETE_TOKEN = \"$delete\";\nvar syncClass = /* @__PURE__ */ __name((instance, options = {}) => {\n const cacheSync = /* @__PURE__ */ new Map();\n const cachePersist = /* @__PURE__ */ new Map();\n instance.$valuesChanges = {\n set: /* @__PURE__ */ __name((path, value) => {\n cacheSync.set(path, value);\n options.onSync?.(cacheSync);\n }, \"set\"),\n setPersist: /* @__PURE__ */ __name((path, value) => {\n if (path == \"\") path = \".\";\n cachePersist.set(path, value);\n options.onPersist?.(cachePersist);\n }, \"setPersist\"),\n has: /* @__PURE__ */ __name((path) => {\n return cacheSync.has(path);\n }, \"has\"),\n get: /* @__PURE__ */ __name((path) => {\n return cacheSync.get(path);\n }, \"get\")\n };\n createSyncClass(instance);\n}, \"syncClass\");\nfunction createStatesSnapshot(instance) {\n let persistObject = {};\n if (instance?.$snapshot) {\n for (const key of instance.$snapshot.keys()) {\n const signal = instance.$snapshot.get(key);\n const persist2 = signal.options.persist ?? true;\n let value = signal();\n if (isObject(value) || Array.isArray(value)) {\n continue;\n }\n if (persist2) {\n persistObject[key] = value;\n }\n }\n }\n return persistObject;\n}\n__name(createStatesSnapshot, \"createStatesSnapshot\");\nfunction setMetadata(target, key, value) {\n const meta = target.constructor._propertyMetadata;\n const propId = meta?.get(key);\n if (propId) {\n if (isSignal(target[propId])) {\n target[propId].set(value);\n } else {\n target[propId] = value;\n }\n }\n}\n__name(setMetadata, \"setMetadata\");\nvar createSyncClass = /* @__PURE__ */ __name((currentClass, parentKey = null, parentClass = null, path = \"\") => {\n currentClass.$path = path;\n if (parentClass) {\n currentClass.$valuesChanges = parentClass.$valuesChanges;\n }\n if (parentKey) {\n setMetadata(currentClass, \"id\", parentKey);\n }\n if (currentClass.$snapshot) {\n for (const key of currentClass.$snapshot.keys()) {\n const signal = currentClass.$snapshot.get(key);\n const syncToClient = signal.options?.syncToClient ?? true;\n const persist2 = signal.options?.persist ?? true;\n const transform = signal.options?.transform;\n let signalValue = signal();\n if (transform) {\n signalValue = transform(signalValue);\n }\n if (isObject(signalValue) || Array.isArray(signalValue)) {\n signalValue = {\n ...signalValue\n };\n }\n const transformedValue = signalValue;\n const newPath = (path ? path + \".\" : \"\") + key;\n if (syncToClient) {\n currentClass.$valuesChanges.set(newPath, transformedValue);\n }\n if (persist2) {\n if (parentClass) currentClass.$valuesChanges.setPersist(path, transformedValue);\n }\n if (isComputed(signal)) {\n signal.observable.subscribe((newValue) => {\n if (syncToClient) {\n const transformedNewValue = transform ? transform(newValue) : newValue;\n currentClass.$valuesChanges.set(newPath, transformedNewValue);\n }\n });\n }\n }\n }\n}, \"createSyncClass\");\nvar type = /* @__PURE__ */ __name((_signal, path, options = {}, currentInstance) => {\n const { syncToClient = true, persist: persist2 = true, transform } = options;\n let init = true;\n const handleObjectSubject = /* @__PURE__ */ __name((value, propPath) => {\n const newPath = `${propPath}${value.key ? `.${value.key}` : \"\"}`;\n if ([\n \"add\",\n \"reset\",\n \"update\"\n ].includes(value.type)) {\n if (isInstanceOfClass(value.value)) {\n createSyncClass(value.value, value.key, currentInstance, newPath);\n } else if (value.type === \"update\" && (isObject(value.value) || Array.isArray(value.value))) {\n createSyncClass(value.value, value.key, currentInstance, newPath);\n } else {\n savePath(newPath, value.value);\n }\n } else if (value.type === \"remove\") {\n savePath(newPath, DELETE_TOKEN);\n }\n }, \"handleObjectSubject\");\n const handleArraySubject = /* @__PURE__ */ __name((value, propPath) => {\n if (value.type === \"reset\" && Array.isArray(value.items)) {\n value.items.forEach((item, index) => {\n const newPath2 = `${propPath}.${index}`;\n if (isInstanceOfClass(item)) {\n createSyncClass(item, value.key, currentInstance, newPath2);\n } else {\n savePath(newPath2, item);\n }\n });\n return;\n }\n const newPath = `${propPath}.${value.index}`;\n const firstItem = value.items?.[0];\n if ([\n \"add\",\n \"update\"\n ].includes(value.type) && firstItem !== void 0) {\n if (isInstanceOfClass(firstItem)) {\n createSyncClass(firstItem, value.key, currentInstance, newPath);\n } else if (value.type === \"update\" && (isObject(firstItem) || Array.isArray(firstItem))) {\n createSyncClass(firstItem, value.key, currentInstance, newPath);\n } else {\n savePath(newPath, firstItem);\n }\n } else if (value.type === \"remove\") {\n savePath(newPath, DELETE_TOKEN);\n }\n }, \"handleArraySubject\");\n const savePath = /* @__PURE__ */ __name((propPath, value) => {\n const transformedValue = transform && value !== DELETE_TOKEN ? transform(value) : value;\n if (syncToClient) {\n currentInstance.$valuesChanges.set(propPath, transformedValue);\n }\n if (persist2 && currentInstance.$path !== void 0) {\n currentInstance.$valuesChanges.setPersist(transformedValue == DELETE_TOKEN ? propPath : currentInstance.$path, transformedValue);\n }\n }, \"savePath\");\n const setupSubscription = /* @__PURE__ */ __name((signal, signalPath) => {\n if (!isSignal(signal)) return;\n if (syncToClient && currentInstance.$valuesChanges) {\n const initialValue = signal();\n const transformedInitialValue = transform ? transform(initialValue) : initialValue;\n currentInstance.$valuesChanges.set(signalPath, transformedInitialValue);\n }\n signal.options = options;\n signal.observable.subscribe((value) => {\n if (init) return;\n if (currentInstance.$path !== void 0) {\n const fullPath = `${currentInstance.$path ? currentInstance.$path + \".\" : \"\"}${signalPath}`;\n if (isComputed(signal)) {\n savePath(fullPath, value);\n } else if (isObjectSubject(signal._subject)) {\n handleObjectSubject(value, fullPath);\n } else if (isArraySubject(signal._subject)) {\n handleArraySubject(value, fullPath);\n } else {\n savePath(fullPath, value);\n }\n }\n });\n if (!currentInstance.$snapshot) {\n currentInstance.$snapshot = /* @__PURE__ */ new Map();\n }\n currentInstance.$snapshot.set(path, signal);\n }, \"setupSubscription\");\n if (!isSignal(_signal)) {\n if (_signal && typeof _signal === \"object\" && !Array.isArray(_signal)) {\n for (const key in _signal) {\n if (Object.prototype.hasOwnProperty.call(_signal, key)) {\n const value = _signal[key];\n const propertyPath = `${path}.${key}`;\n if (isSignal(value)) {\n setupSubscription(value, propertyPath);\n } else if (value && typeof value === \"object\" && !Array.isArray(value)) {\n type(value, propertyPath, options, currentInstance);\n }\n }\n }\n init = false;\n }\n return _signal;\n }\n setupSubscription(_signal, path);\n init = false;\n return _signal;\n}, \"type\");\n\n// src/decorators.ts\nfunction sync(options) {\n let classType;\n let persist2 = true;\n let syncToClient = true;\n let transform;\n if (typeof options === \"function\") {\n classType = options;\n } else if (typeof options === \"object\") {\n classType = options.classType;\n if (options.hasOwnProperty(\"persist\")) {\n persist2 = options.persist;\n }\n if (options.hasOwnProperty(\"syncToClient\")) {\n syncToClient = options.syncToClient;\n }\n if (options.hasOwnProperty(\"transform\")) {\n transform = options.transform;\n }\n }\n return function(target, propertyKey) {\n const privatePropertyKey = `__${propertyKey}`;\n const getter = /* @__PURE__ */ __name(function() {\n return this[privatePropertyKey];\n }, \"getter\");\n const setter = /* @__PURE__ */ __name(function(newVal) {\n this[privatePropertyKey] = type(newVal, propertyKey, {\n classType,\n persist: persist2,\n syncToClient,\n transform\n }, this);\n }, \"setter\");\n Object.defineProperty(target, propertyKey, {\n get: getter,\n set: setter,\n enumerable: true,\n configurable: true\n });\n };\n}\n__name(sync, \"sync\");\nfunction id() {\n return function(target, propertyKey) {\n if (!target.constructor._propertyMetadata) {\n target.constructor._propertyMetadata = /* @__PURE__ */ new Map();\n }\n target.constructor._propertyMetadata.set(\"id\", propertyKey);\n };\n}\n__name(id, \"id\");\nfunction users(options) {\n return function(target, propertyKey) {\n if (!target.constructor._propertyMetadata) {\n target.constructor._propertyMetadata = /* @__PURE__ */ new Map();\n }\n target.constructor._propertyMetadata.set(\"users\", propertyKey);\n sync(options)(target, propertyKey);\n };\n}\n__name(users, \"users\");\nfunction persist() {\n return sync({\n persist: true,\n syncToClient: false\n });\n}\n__name(persist, \"persist\");\nfunction connected() {\n return function(target, propertyKey) {\n if (!target.constructor._propertyMetadata) {\n target.constructor._propertyMetadata = /* @__PURE__ */ new Map();\n }\n target.constructor._propertyMetadata.set(\"connected\", propertyKey);\n sync({\n persist: false\n })(target, propertyKey);\n };\n}\n__name(connected, \"connected\");\n\n// src/load.ts\nimport { isSignal as isSignal2 } from \"@signe/reactive\";\nfunction load(rootInstance, values, valueIsObject) {\n if (valueIsObject) {\n loadFromObject(rootInstance, values);\n } else {\n loadFromPaths(rootInstance, values);\n }\n}\n__name(load, \"load\");\nfunction loadFromPaths(rootInstance, values) {\n for (const [path, value] of Object.entries(values)) {\n const parts = path.split(\".\");\n loadValue(rootInstance, parts, value);\n }\n}\n__name(loadFromPaths, \"loadFromPaths\");\nfunction loadFromObject(rootInstance, values, currentPath = \"\") {\n for (let key in values) {\n const value = values[key];\n const newPath = currentPath ? `${currentPath}.${key}` : key;\n if (typeof value === \"object\" && !Array.isArray(value) && value !== null) {\n loadFromObject(rootInstance, value, newPath);\n } else {\n const parts = newPath.split(\".\");\n loadValue(rootInstance, parts, value);\n }\n }\n}\n__name(loadFromObject, \"loadFromObject\");\nfunction loadValue(rootInstance, parts, value) {\n let current = rootInstance;\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i];\n if (i === parts.length - 1) {\n if (value == DELETE_TOKEN) {\n if (isSignal2(current)) {\n current = current();\n }\n Reflect.deleteProperty(current, part);\n } else if (current[part]?._subject) {\n current[part].set(value);\n } else if (isSignal2(current) && Array.isArray(current()) && !isNaN(Number(part))) {\n current()[Number(part)] = value;\n } else {\n current[part] = value;\n }\n } else {\n if (isSignal2(current)) {\n current = current();\n }\n const currentValue = current[part];\n if (currentValue === void 0) {\n const parentInstance = getByPath(rootInstance, parts.slice(0, i).join(\".\"));\n const classType = parentInstance?.options?.classType;\n if (classType) {\n current[part] = !isClass(classType) ? classType(part) : new classType();\n setMetadata(current[part], \"id\", part);\n } else {\n current[part] = {};\n }\n }\n current = current[part];\n }\n }\n}\n__name(loadValue, \"loadValue\");\nfunction getByPath(root, path) {\n const parts = path.split(\".\");\n let current = root;\n for (const part of parts) {\n if (isSignal2(current)) {\n current = current();\n }\n if (current[part]) {\n current = current[part];\n } else {\n return void 0;\n }\n }\n return current;\n}\n__name(getByPath, \"getByPath\");\nexport {\n DELETE_TOKEN,\n connected,\n createStatesSnapshot,\n createSyncClass,\n generateShortUUID,\n getByPath,\n id,\n isClass,\n isFunction,\n isInstanceOfClass,\n isObject,\n load,\n persist,\n setMetadata,\n sync,\n syncClass,\n type,\n users\n};\n//# sourceMappingURL=index.js.map"],"names":["isSignal2"],"mappings":";;;AAOA;AACA,SAAS,UAAU,CAAC,GAAG,EAAE;AACzB,EAAE,OAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,mBAAmB;AACtD;AACA,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC;AAChC,SAAS,OAAO,CAAC,GAAG,EAAE;AACtB,EAAE,OAAO,OAAO,GAAG,KAAK,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AAI,CAAC,KAAK,CAAC,GAAG,CAAC;AAC/B,EAAE,IAAI,OAAO,GAAG,IAAI;AACpB,EAAE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;AAC5B,IAAI,IAAIA,QAAS,CAAC,OAAO,CAAC,EAAE;AAC5B,MAAM,OAAO,GAAG,OAAO,EAAE;AACzB,IAAI;AACJ,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE;AACvB,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;AAC7B,IAAI,CAAC,MAAM;AACX,MAAM,OAAO,MAAM;AACnB,IAAI;AACJ,EAAE;AACF,EAAE,OAAO,OAAO;AAChB;AACA,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC;;;;","x_google_ignoreList":[0]}
|
package/dist/index29.js
CHANGED
|
@@ -1,21 +1,46 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RpgCommonMap } from '@rpgjs/common';
|
|
2
|
+
import { sync, users } from './index28.js';
|
|
3
|
+
import { RpgClientPlayer } from './index23.js';
|
|
4
|
+
import { signal, computed } from 'canvasengine';
|
|
5
|
+
import { RpgClientEvent } from './index24.js';
|
|
2
6
|
import { RpgClientEngine } from './index2.js';
|
|
3
7
|
import { inject } from './index6.js';
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
playing: (_a = animationName()) !== null && _a !== void 0 ? _a : 'default',
|
|
14
|
-
onFinish: onFinish
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
11
|
+
var result = void 0 ;
|
|
12
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
13
|
+
if (decorator = decorators[i])
|
|
14
|
+
result = (decorator(target, key, result) ) || result;
|
|
15
|
+
if (result) __defProp(target, key, result);
|
|
16
|
+
return result;
|
|
15
17
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
class RpgClientMap extends RpgCommonMap {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.engine = inject(RpgClientEngine);
|
|
22
|
+
this.players = signal({});
|
|
23
|
+
this.events = signal({});
|
|
24
|
+
this.currentPlayer = computed(() => this.players()[this.engine.playerIdSignal()]);
|
|
25
|
+
}
|
|
26
|
+
getCurrentPlayer() {
|
|
27
|
+
return this.currentPlayer();
|
|
28
|
+
}
|
|
29
|
+
reset() {
|
|
30
|
+
this.players.set({});
|
|
31
|
+
this.events.set({});
|
|
32
|
+
this.clearPhysic();
|
|
33
|
+
}
|
|
34
|
+
stepPredictionTick() {
|
|
35
|
+
this.forceSingleTick();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
__decorateClass([
|
|
39
|
+
users(RpgClientPlayer)
|
|
40
|
+
], RpgClientMap.prototype, "players");
|
|
41
|
+
__decorateClass([
|
|
42
|
+
sync(RpgClientEvent)
|
|
43
|
+
], RpgClientMap.prototype, "events");
|
|
19
44
|
|
|
20
|
-
export {
|
|
45
|
+
export { RpgClientMap };
|
|
21
46
|
//# sourceMappingURL=index29.js.map
|
package/dist/index29.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index29.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"index29.js","sources":["../src/Game/Map.ts"],"sourcesContent":["import { RpgCommonMap } from \"@rpgjs/common\";\nimport { sync, users } from \"@signe/sync\";\nimport { RpgClientPlayer } from \"./Player\";\nimport { Signal, signal, computed } from \"canvasengine\";\nimport { RpgClientEvent } from \"./Event\";\nimport { RpgClientEngine } from \"../RpgClientEngine\";\nimport { inject } from \"../core/inject\";\n\nexport class RpgClientMap extends RpgCommonMap<any> {\n engine: RpgClientEngine = inject(RpgClientEngine)\n @users(RpgClientPlayer) players = signal<Record<string, RpgClientPlayer>>({});\n @sync(RpgClientEvent) events = signal<Record<string, RpgClientEvent>>({});\n currentPlayer = computed(() => this.players()[this.engine.playerIdSignal()!])\n\n getCurrentPlayer() {\n return this.currentPlayer()\n }\n\n reset() {\n this.players.set({})\n this.events.set({})\n this.clearPhysic()\n }\n\n stepPredictionTick(): void {\n this.forceSingleTick();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAQO,MAAM,qBAAqB,YAAA,CAAkB;AAAA,EAA7C,WAAA,GAAA;AAAA,IAAA,KAAA,CAAA,GAAA,SAAA,CAAA;AACL,IAAA,IAAA,CAAA,MAAA,GAA0B,OAAO,eAAe,CAAA;AACxB,IAAA,IAAA,CAAA,OAAA,GAAU,MAAA,CAAwC,EAAE,CAAA;AACtD,IAAA,IAAA,CAAA,MAAA,GAAS,MAAA,CAAuC,EAAE,CAAA;AACxE,IAAA,IAAA,CAAA,aAAA,GAAgB,QAAA,CAAS,MAAM,IAAA,CAAK,OAAA,GAAU,IAAA,CAAK,MAAA,CAAO,cAAA,EAAiB,CAAC,CAAA;AAAA,EAAA;AAAA,EAE5E,gBAAA,GAAmB;AACjB,IAAA,OAAO,KAAK,aAAA,EAAc;AAAA,EAC5B;AAAA,EAEA,KAAA,GAAQ;AACN,IAAA,IAAA,CAAK,OAAA,CAAQ,GAAA,CAAI,EAAE,CAAA;AACnB,IAAA,IAAA,CAAK,MAAA,CAAO,GAAA,CAAI,EAAE,CAAA;AAClB,IAAA,IAAA,CAAK,WAAA,EAAY;AAAA,EACnB;AAAA,EAEA,kBAAA,GAA2B;AACzB,IAAA,IAAA,CAAK,eAAA,EAAgB;AAAA,EACvB;AACF;AAjB0B,eAAA,CAAA;AAAA,EAAvB,MAAM,eAAe;AAAA,CAAA,EAFX,YAAA,CAEa,SAAA,EAAA,SAAA,CAAA;AACF,eAAA,CAAA;AAAA,EAArB,KAAK,cAAc;AAAA,CAAA,EAHT,YAAA,CAGW,SAAA,EAAA,QAAA,CAAA;;;;"}
|
package/dist/index3.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { WebSocketToken, AbstractWebsocket } from './
|
|
2
|
-
import { ServerIo, ClientIo } from './
|
|
1
|
+
import { WebSocketToken, AbstractWebsocket } from './index27.js';
|
|
2
|
+
import { ServerIo, ClientIo } from './index31.js';
|
|
3
3
|
import { RpgClientEngine } from './index2.js';
|
|
4
4
|
import { UpdateMapToken, UpdateMapService } from '@rpgjs/common';
|
|
5
5
|
import { RpgGui } from './index9.js';
|
|
6
|
-
import { provideKeyboardControls } from './
|
|
6
|
+
import { provideKeyboardControls } from './index21.js';
|
|
7
7
|
|
|
8
8
|
class BridgeWebsocket extends AbstractWebsocket {
|
|
9
9
|
constructor(context, server) {
|