@rpgjs/client 5.0.0-alpha.10 → 5.0.0-alpha.12
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/Map.d.ts +4 -0
- package/dist/Gui/Gui.d.ts +128 -5
- package/dist/RpgClient.d.ts +35 -5
- package/dist/RpgClientEngine.d.ts +3 -0
- package/dist/components/gui/index.d.ts +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/index10.js +150 -4
- package/dist/index10.js.map +1 -1
- package/dist/index11.js +20 -7
- package/dist/index11.js.map +1 -1
- package/dist/index12.js +6 -8
- 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 -100
- package/dist/index14.js.map +1 -1
- package/dist/index15.js +141 -35
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +42 -0
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +48 -7
- package/dist/index17.js.map +1 -1
- package/dist/index18.js +5 -383
- package/dist/index18.js.map +1 -1
- package/dist/index19.js +384 -28
- package/dist/index19.js.map +1 -1
- package/dist/index2.js +32 -13
- package/dist/index2.js.map +1 -1
- package/dist/index20.js +31 -17
- package/dist/index20.js.map +1 -1
- package/dist/index21.js +17 -2413
- package/dist/index21.js.map +1 -1
- package/dist/index22.js +2587 -88
- package/dist/index22.js.map +1 -1
- package/dist/index23.js +108 -103
- package/dist/index23.js.map +1 -1
- package/dist/index29.js +22 -3
- package/dist/index29.js.map +1 -1
- package/dist/index3.js +2 -2
- package/dist/index30.js +1 -318
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +332 -24
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +24 -8
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +4 -4
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +8 -9
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +9 -4400
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +4394 -307
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +307 -165
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +162 -489
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +496 -56
- package/dist/index39.js.map +1 -1
- package/dist/index4.js +2 -2
- package/dist/index40.js +67 -10
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +16 -78
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +96 -0
- package/dist/index42.js.map +1 -0
- package/dist/index9.js +228 -14
- package/dist/index9.js.map +1 -1
- package/dist/presets/faceset.d.ts +30 -0
- package/dist/presets/index.d.ts +1 -0
- package/dist/services/mmorpg.d.ts +1 -1
- package/dist/services/standalone.d.ts +1 -1
- package/package.json +7 -5
- package/src/Game/AnimationManager.ts +1 -0
- package/src/Game/Map.ts +9 -1
- package/src/Game/Object.ts +28 -6
- package/src/Gui/Gui.ts +300 -17
- package/src/RpgClient.ts +36 -5
- package/src/RpgClientEngine.ts +32 -9
- package/src/components/character.ce +11 -9
- package/src/components/gui/box.ce +17 -0
- package/src/components/gui/dialogbox/index.ce +74 -35
- package/src/components/gui/dialogbox/selection.ce +16 -1
- package/src/components/gui/index.ts +3 -4
- package/src/components/scenes/event-layer.ce +6 -0
- package/src/index.ts +3 -1
- package/src/presets/faceset.ts +60 -0
- package/src/presets/index.ts +3 -1
package/dist/Game/Map.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { RpgCommonMap } from '@rpgjs/common';
|
|
2
2
|
import { RpgClientPlayer } from './Player';
|
|
3
3
|
import { RpgClientEvent } from './Event';
|
|
4
|
+
import { RpgClientEngine } from '../RpgClientEngine';
|
|
4
5
|
export declare class RpgClientMap extends RpgCommonMap<RpgClientPlayer> {
|
|
6
|
+
engine: RpgClientEngine;
|
|
5
7
|
players: import('canvasengine').WritableObjectSignal<Record<string, RpgClientPlayer>>;
|
|
6
8
|
events: import('canvasengine').WritableObjectSignal<Record<string, RpgClientEvent>>;
|
|
9
|
+
currentPlayer: import('canvasengine').ComputedSignal<RpgClientPlayer>;
|
|
10
|
+
getCurrentPlayer(): RpgClientPlayer;
|
|
7
11
|
}
|
package/dist/Gui/Gui.d.ts
CHANGED
|
@@ -1,23 +1,146 @@
|
|
|
1
1
|
import { Context } from '@signe/di';
|
|
2
|
+
import { Signal, WritableSignal } from 'canvasengine';
|
|
3
|
+
import { Subscription } from 'rxjs';
|
|
2
4
|
interface GuiOptions {
|
|
3
|
-
name
|
|
5
|
+
name?: string;
|
|
6
|
+
id?: string;
|
|
4
7
|
component: any;
|
|
5
8
|
display?: boolean;
|
|
6
9
|
data?: any;
|
|
10
|
+
/**
|
|
11
|
+
* Auto display the GUI when added to the system
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
autoDisplay?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Function that returns an array of Signal dependencies
|
|
17
|
+
* The GUI will only display when all dependencies are resolved (!= undefined)
|
|
18
|
+
* @returns Array of Signal dependencies
|
|
19
|
+
*/
|
|
20
|
+
dependencies?: () => Signal[];
|
|
21
|
+
}
|
|
22
|
+
interface GuiInstance {
|
|
23
|
+
name: string;
|
|
24
|
+
component: any;
|
|
25
|
+
display: WritableSignal<boolean>;
|
|
26
|
+
data: WritableSignal<any>;
|
|
27
|
+
autoDisplay: boolean;
|
|
28
|
+
dependencies?: () => Signal[];
|
|
29
|
+
subscription?: Subscription;
|
|
7
30
|
}
|
|
8
31
|
export declare class RpgGui {
|
|
9
32
|
private context;
|
|
10
33
|
private webSocket;
|
|
11
|
-
gui: import('canvasengine').
|
|
34
|
+
gui: import('canvasengine').WritableObjectSignal<Record<string, GuiInstance>>;
|
|
35
|
+
extraGuis: GuiInstance[];
|
|
36
|
+
private vueGuiInstance;
|
|
12
37
|
constructor(context: Context);
|
|
13
38
|
_initialize(): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Set the VueGui instance reference for Vue component management
|
|
41
|
+
* This is called by VueGui when it's initialized
|
|
42
|
+
*
|
|
43
|
+
* @param vueGuiInstance - The VueGui instance
|
|
44
|
+
*/
|
|
45
|
+
_setVueGuiInstance(vueGuiInstance: any): void;
|
|
46
|
+
/**
|
|
47
|
+
* Notify VueGui about GUI state changes
|
|
48
|
+
* This synchronizes the Vue component display state
|
|
49
|
+
*
|
|
50
|
+
* @param guiId - The GUI component ID
|
|
51
|
+
* @param display - Display state
|
|
52
|
+
* @param data - Component data
|
|
53
|
+
*/
|
|
54
|
+
private _notifyVueGui;
|
|
55
|
+
/**
|
|
56
|
+
* Initialize Vue components in the VueGui instance
|
|
57
|
+
* This should be called after VueGui is mounted
|
|
58
|
+
*/
|
|
59
|
+
_initializeVueComponents(): void;
|
|
14
60
|
guiInteraction(guiId: string, name: string, data: any): void;
|
|
15
61
|
guiClose(guiId: string, data?: any): void;
|
|
62
|
+
/**
|
|
63
|
+
* Add a GUI component to the system
|
|
64
|
+
*
|
|
65
|
+
* By default, only CanvasEngine components (.ce files) are accepted.
|
|
66
|
+
* Vue components should be handled by the @rpgjs/vue package.
|
|
67
|
+
*
|
|
68
|
+
* @param gui - GUI configuration options
|
|
69
|
+
* @param gui.name - Name or ID of the GUI component
|
|
70
|
+
* @param gui.id - Alternative ID if name is not provided
|
|
71
|
+
* @param gui.component - The component to render (must be a CanvasEngine component)
|
|
72
|
+
* @param gui.display - Initial display state (default: false)
|
|
73
|
+
* @param gui.data - Initial data for the component
|
|
74
|
+
* @param gui.autoDisplay - Auto display when added (default: false)
|
|
75
|
+
* @param gui.dependencies - Function returning Signal dependencies
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* gui.add({
|
|
80
|
+
* name: 'inventory',
|
|
81
|
+
* component: InventoryComponent, // Must be a .ce component
|
|
82
|
+
* autoDisplay: true,
|
|
83
|
+
* dependencies: () => [playerSignal, inventorySignal]
|
|
84
|
+
* });
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
16
87
|
add(gui: GuiOptions): void;
|
|
17
|
-
get(id: string |
|
|
88
|
+
get(id: string): GuiInstance | undefined;
|
|
18
89
|
exists(id: string): boolean;
|
|
19
|
-
getAll():
|
|
20
|
-
|
|
90
|
+
getAll(): Record<string, GuiInstance>;
|
|
91
|
+
/**
|
|
92
|
+
* Display a GUI component
|
|
93
|
+
*
|
|
94
|
+
* Displays the GUI immediately if no dependencies are configured,
|
|
95
|
+
* or waits for all dependencies to be resolved if dependencies are present.
|
|
96
|
+
* Automatically manages subscriptions to prevent memory leaks.
|
|
97
|
+
* Works with both CanvasEngine components and Vue components.
|
|
98
|
+
*
|
|
99
|
+
* @param id - The GUI component ID
|
|
100
|
+
* @param data - Data to pass to the component
|
|
101
|
+
* @param dependencies - Optional runtime dependencies (overrides config dependencies)
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* // Display immediately
|
|
106
|
+
* gui.display('inventory', { items: [] });
|
|
107
|
+
*
|
|
108
|
+
* // Display with runtime dependencies
|
|
109
|
+
* gui.display('shop', { shopId: 1 }, [playerSignal, shopSignal]);
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
display(id: string, data?: {}, dependencies?: Signal[]): void;
|
|
113
|
+
/**
|
|
114
|
+
* Handle Vue component display logic
|
|
115
|
+
*
|
|
116
|
+
* @param id - GUI component ID
|
|
117
|
+
* @param data - Component data
|
|
118
|
+
* @param dependencies - Runtime dependencies
|
|
119
|
+
* @param guiInstance - GUI instance
|
|
120
|
+
*/
|
|
121
|
+
private _handleVueComponentDisplay;
|
|
122
|
+
/**
|
|
123
|
+
* Handle CanvasEngine component display logic
|
|
124
|
+
*
|
|
125
|
+
* @param id - GUI component ID
|
|
126
|
+
* @param data - Component data
|
|
127
|
+
* @param dependencies - Runtime dependencies
|
|
128
|
+
* @param guiInstance - GUI instance
|
|
129
|
+
*/
|
|
130
|
+
private _handleCanvasComponentDisplay;
|
|
131
|
+
/**
|
|
132
|
+
* Hide a GUI component
|
|
133
|
+
*
|
|
134
|
+
* Hides the GUI and cleans up any active subscriptions.
|
|
135
|
+
* Works with both CanvasEngine components and Vue components.
|
|
136
|
+
*
|
|
137
|
+
* @param id - The GUI component ID
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* gui.hide('inventory');
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
21
144
|
hide(id: string): void;
|
|
22
145
|
}
|
|
23
146
|
export {};
|
package/dist/RpgClient.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ComponentFunction } from 'canvasengine';
|
|
1
|
+
import { ComponentFunction, Signal } from 'canvasengine';
|
|
2
2
|
import { RpgClientEngine } from './RpgClientEngine';
|
|
3
3
|
import { Loader, Container } from 'pixi.js';
|
|
4
|
-
|
|
4
|
+
import { RpgClientObject } from './Game/Object';
|
|
5
|
+
type RpgComponent = RpgClientObject;
|
|
5
6
|
type SceneMap = Container;
|
|
6
7
|
export interface RpgClientEngineHooks {
|
|
7
8
|
/**
|
|
@@ -283,15 +284,43 @@ export interface RpgClient {
|
|
|
283
284
|
* */
|
|
284
285
|
spritesheets?: any[];
|
|
285
286
|
/**
|
|
286
|
-
* Array containing the list of
|
|
287
|
+
* Array containing the list of GUI components
|
|
287
288
|
*
|
|
289
|
+
* ```ts
|
|
290
|
+
* import { defineModule, RpgClient } from '@rpgjs/client'
|
|
291
|
+
* import InventoryComponent from './inventory.ce'
|
|
292
|
+
*
|
|
293
|
+
* defineModule<RpgClient>({
|
|
294
|
+
* gui: [
|
|
295
|
+
* {
|
|
296
|
+
* id: 'inventory',
|
|
297
|
+
* component: InventoryComponent,
|
|
298
|
+
* autoDisplay: true,
|
|
299
|
+
* dependencies: () => [playerSignal, inventorySignal]
|
|
300
|
+
* }
|
|
301
|
+
* ]
|
|
302
|
+
* })
|
|
303
|
+
* ```
|
|
288
304
|
*
|
|
289
305
|
* [Guide: Create GUI](/guide/create-gui.html)
|
|
290
306
|
*
|
|
291
|
-
* @prop {Array<
|
|
307
|
+
* @prop {Array<GuiOptions>} [gui]
|
|
292
308
|
* @memberof RpgClient
|
|
293
309
|
* */
|
|
294
|
-
gui?:
|
|
310
|
+
gui?: ({
|
|
311
|
+
id: string;
|
|
312
|
+
component: ComponentFunction;
|
|
313
|
+
/**
|
|
314
|
+
* Auto display the GUI when added to the system
|
|
315
|
+
* @default false
|
|
316
|
+
*/
|
|
317
|
+
autoDisplay?: boolean;
|
|
318
|
+
/**
|
|
319
|
+
* Function that returns an array of Signal dependencies
|
|
320
|
+
* The GUI will only display when all dependencies are resolved (!= undefined)
|
|
321
|
+
*/
|
|
322
|
+
dependencies?: () => Signal[];
|
|
323
|
+
} | any)[];
|
|
295
324
|
/**
|
|
296
325
|
* Array containing the list of sounds
|
|
297
326
|
* Each element is a simple object containing sound definitions
|
|
@@ -356,6 +385,7 @@ export interface RpgClient {
|
|
|
356
385
|
scenes?: {
|
|
357
386
|
map: RpgSceneMapHooks;
|
|
358
387
|
};
|
|
388
|
+
sceneMap?: RpgSceneMapHooks;
|
|
359
389
|
/**
|
|
360
390
|
* Array containing the list of component animations
|
|
361
391
|
* Each element defines a temporary component to display for animations like hits, effects, etc.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Context } from '@signe/di';
|
|
2
2
|
import { AbstractWebsocket } from './services/AbstractSocket';
|
|
3
|
+
import { RpgClientMap } from './Game/Map';
|
|
3
4
|
import { AnimationManager } from './Game/AnimationManager';
|
|
4
5
|
import { Observable } from 'rxjs';
|
|
5
6
|
import * as PIXI from "pixi.js";
|
|
@@ -122,4 +123,6 @@ export declare class RpgClientEngine<T = any> {
|
|
|
122
123
|
get PIXI(): typeof PIXI;
|
|
123
124
|
get socket(): AbstractWebsocket;
|
|
124
125
|
get playerId(): string | null;
|
|
126
|
+
get scene(): RpgClientMap;
|
|
127
|
+
getCurrentPlayer(): import('./Game/Player').RpgClientPlayer;
|
|
125
128
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
};
|
|
1
|
+
import { default as DialogboxComponent } from './dialogbox/index.ce';
|
|
2
|
+
import { default as BoxComponent } from './box.ce';
|
|
3
|
+
export { DialogboxComponent, BoxComponent };
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -6,9 +6,11 @@ export { clearInject, context, inject, setInject } from './index6.js';
|
|
|
6
6
|
export { LoadMapService, LoadMapToken, provideLoadMap } from './index7.js';
|
|
7
7
|
export { GlobalConfigToken, provideClientGlobalConfig, provideClientModules, provideGlobalConfig } from './index8.js';
|
|
8
8
|
export { RpgGui } from './index9.js';
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export { default as
|
|
9
|
+
export { default as DialogboxComponent } from './index10.js';
|
|
10
|
+
export { default as BoxComponent } from './index11.js';
|
|
11
|
+
export { PrebuiltComponentAnimations } from './index12.js';
|
|
12
|
+
export { Presets } from './index13.js';
|
|
13
|
+
export { default as EventLayerComponent } from './index14.js';
|
|
14
|
+
export { default as CharacterComponent } from './index15.js';
|
|
15
|
+
export { Context } from './index16.js';
|
|
14
16
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
|
package/dist/index10.js
CHANGED
|
@@ -1,8 +1,154 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useProps, useDefineProps, signal, animatedSignal, computed, trigger, mount, effect, h, Container, Rect, cond, Text, Sprite } from 'canvasengine';
|
|
2
|
+
import component$1 from './index40.js';
|
|
3
|
+
import { inject } from './index6.js';
|
|
4
|
+
import { RpgClientEngine } from './index2.js';
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
6
|
+
function component($$props) {
|
|
7
|
+
useProps($$props);
|
|
8
|
+
const defineProps = useDefineProps($$props);
|
|
9
|
+
var __assign = (this && this.__assign) || function () {
|
|
10
|
+
__assign = Object.assign || function(t) {
|
|
11
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
12
|
+
s = arguments[i];
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
}
|
|
16
|
+
return t;
|
|
17
|
+
};
|
|
18
|
+
return __assign.apply(this, arguments);
|
|
5
19
|
};
|
|
20
|
+
var _a, _b, _c, _d, _e;
|
|
21
|
+
var _f = defineProps(), message = _f.message, _choices = _f.choices, onFinish = _f.onFinish; _f.onInteraction; var face = _f.face, position = _f.position, typewriterEffect = _f.typewriterEffect, autoClose = _f.autoClose;
|
|
22
|
+
var client = inject(RpgClientEngine);
|
|
23
|
+
var keyboardControls = client.globalConfig.keyboardControls;
|
|
24
|
+
var dialogboxStyles = (_a = client.globalConfig.box.styles) !== null && _a !== void 0 ? _a : {
|
|
25
|
+
backgroundColor: "#1a1a2e",
|
|
26
|
+
backgroundOpacity: 0.9,
|
|
27
|
+
};
|
|
28
|
+
var dialogBoxTypewriterSound = (_d = (_c = (_b = client.globalConfig) === null || _b === void 0 ? void 0 : _b.box) === null || _c === void 0 ? void 0 : _c.sounds) === null || _d === void 0 ? void 0 : _d.typewriter;
|
|
29
|
+
var spritesheets = client.spritesheets;
|
|
30
|
+
var sounds = client.sounds;
|
|
31
|
+
client.stopProcessingInput = true;
|
|
32
|
+
var isDestroyed = false;
|
|
33
|
+
var texts = [message()];
|
|
34
|
+
var height = signal(256);
|
|
35
|
+
var margin = signal(40);
|
|
36
|
+
var isTextCompleted = signal(false);
|
|
37
|
+
signal({ width: 5, color: "#595971" });
|
|
38
|
+
signal({ color: "#000", blur: 10, offsetX: 10, offsetY: 10 });
|
|
39
|
+
var contentOpacity = animatedSignal(0, {
|
|
40
|
+
duration: 1000,
|
|
41
|
+
});
|
|
42
|
+
var scaleX = animatedSignal(0, {
|
|
43
|
+
duration: 500,
|
|
44
|
+
});
|
|
45
|
+
var positionBox = computed(function () {
|
|
46
|
+
if (position() === 'bottom') {
|
|
47
|
+
return { positionType: 'absolute', bottom: 10 };
|
|
48
|
+
}
|
|
49
|
+
else if (position() === 'top') {
|
|
50
|
+
return { positionType: 'absolute', top: 10 };
|
|
51
|
+
}
|
|
52
|
+
return {};
|
|
53
|
+
});
|
|
54
|
+
var widthBox = computed(function () {
|
|
55
|
+
return 700;
|
|
56
|
+
});
|
|
57
|
+
scaleX.set(1);
|
|
58
|
+
contentOpacity.set(1);
|
|
59
|
+
var currentTextIndex = signal(0);
|
|
60
|
+
var currentText = computed(function () { var _a; return (_a = texts === null || texts === void 0 ? void 0 : texts[currentTextIndex()]) !== null && _a !== void 0 ? _a : ''; });
|
|
61
|
+
var isChoiceDisplayed = signal(false);
|
|
62
|
+
var text = computed(function () {
|
|
63
|
+
var current = currentText();
|
|
64
|
+
return typeof current === "string" ? current : current.text;
|
|
65
|
+
});
|
|
66
|
+
var faceSheet = function (graphicId, animationName) {
|
|
67
|
+
return {
|
|
68
|
+
definition: spritesheets.get(graphicId),
|
|
69
|
+
playing: animationName,
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
var choices = computed(function () {
|
|
73
|
+
//const current = currentText();
|
|
74
|
+
//return typeof current === "string" ? null : current.choices;
|
|
75
|
+
return _choices;
|
|
76
|
+
});
|
|
77
|
+
var visibleSelection = computed(function () { return isChoiceDisplayed() && choices().length != 0; });
|
|
78
|
+
var triggerSkip = trigger();
|
|
79
|
+
var typewriter = typewriterEffect() ? {
|
|
80
|
+
speed: 0.3,
|
|
81
|
+
skip: triggerSkip,
|
|
82
|
+
sound: {
|
|
83
|
+
src: (_e = sounds.get(dialogBoxTypewriterSound)) === null || _e === void 0 ? void 0 : _e.src
|
|
84
|
+
},
|
|
85
|
+
onComplete: function () {
|
|
86
|
+
isTextCompleted.set(true);
|
|
87
|
+
if (autoClose()) {
|
|
88
|
+
setTimeout(function () {
|
|
89
|
+
onFinish();
|
|
90
|
+
}, 1000);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
} : null;
|
|
94
|
+
var textStyle = {
|
|
95
|
+
wordWrap: true,
|
|
96
|
+
wordWrapWidth: widthBox() - margin() * 2 - (face ? 256 : 0)
|
|
97
|
+
};
|
|
98
|
+
mount(function (element) {
|
|
99
|
+
var dialogbox = element.props.children[0];
|
|
100
|
+
return function () {
|
|
101
|
+
dialogbox.directives.controls.onDestroy();
|
|
102
|
+
isDestroyed = true;
|
|
103
|
+
// Wait destroy is finished before start processing input
|
|
104
|
+
setTimeout(function () {
|
|
105
|
+
client.stopProcessingInput = false;
|
|
106
|
+
}, 500);
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
var controls = signal({
|
|
110
|
+
next: {
|
|
111
|
+
bind: keyboardControls.action,
|
|
112
|
+
keyDown: function (e) {
|
|
113
|
+
if (isDestroyed)
|
|
114
|
+
return;
|
|
115
|
+
if (isChoiceDisplayed()) {
|
|
116
|
+
// If choices are displayed, do nothing (wait for selection)
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
// If text is still typing, just skip (fast forward) the animation
|
|
120
|
+
if (!isTextCompleted()) {
|
|
121
|
+
triggerSkip.start();
|
|
122
|
+
isTextCompleted.set(true);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
var isFinished = currentTextIndex() === texts.length - 1;
|
|
126
|
+
currentTextIndex.update(function (index) {
|
|
127
|
+
if (index < texts.length - 1) {
|
|
128
|
+
return index + 1;
|
|
129
|
+
}
|
|
130
|
+
return index;
|
|
131
|
+
});
|
|
132
|
+
isChoiceDisplayed.set(false);
|
|
133
|
+
isTextCompleted.set(false);
|
|
134
|
+
if (isFinished && onFinish) {
|
|
135
|
+
onFinish();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
var onSelect = function (index) {
|
|
142
|
+
onFinish(index);
|
|
143
|
+
};
|
|
144
|
+
effect(function () {
|
|
145
|
+
if (choices().length != 0) {
|
|
146
|
+
isChoiceDisplayed.set(true);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
let $this = h(Container, { justifyContent: 'center', alignItems: 'center', width: '100%', height: '100%' }, h(Container, { ref: 'dialogbox', scale: { x: scaleX }, anchor: [0.5, 0.5], width: widthBox, height, controls, ...positionBox() }, [h(Rect, { width: widthBox, height, color: dialogboxStyles.backgroundColor, alpha: dialogboxStyles.backgroundOpacity }), h(Container, { flexDirection: 'row', width: widthBox, height, alpha: contentOpacity }, h(Container, { flexDirection: 'row' }, [h(Container, { flexDirection: 'column' }, [h(Text, { text, color: '#fff', fontSize: 18, margin, typewriter, style: textStyle }), cond(visibleSelection, () => h(component$1, { selectedIndex: 0, items: choices, onSelect }))]), cond(face, () => h(Sprite, { sheet: faceSheet(face.id, face.expression) }))]))]));
|
|
150
|
+
return $this
|
|
151
|
+
}
|
|
6
152
|
|
|
7
|
-
export {
|
|
153
|
+
export { component as default };
|
|
8
154
|
//# sourceMappingURL=index10.js.map
|
package/dist/index10.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index10.js","sources":["../src/components/gui/index.ts"],"sourcesContent":["import Dialogbox from \"./dialogbox/index.ce\";\n\nexport const PrebuiltGui = {\n Dialogbox\n}"],"names":["Dialogbox"],"mappings":";;AAEO,MAAM,WAAc,GAAA;AAAA,aACvBA;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"index10.js","sources":["../src/components/gui/dialogbox/index.ce"],"sourcesContent":["<Container justifyContent=\"center\" alignItems=\"center\" width=\"100%\" height=\"100%\">\n <Container\n ref=\"dialogbox\"\n scale={{ x: scaleX }}\n anchor={[0.5, 0.5]}\n width={widthBox}\n height\n controls\n ...positionBox()\n >\n <Rect \n width={widthBox} \n height \n color={@dialogboxStyles.@backgroundColor} \n alpha={@dialogboxStyles.@backgroundOpacity} />\n <Container\n flexDirection=\"row\"\n width={widthBox}\n height\n alpha={contentOpacity}\n >\n <Container flexDirection=\"row\">\n <Container flexDirection=\"column\">\n <Text\n text\n color=\"#fff\"\n fontSize={18}\n margin\n typewriter\n style={textStyle}\n />\n @if (visibleSelection) {\n <Selection selectedIndex={0} items={choices} onSelect />\n }\n </Container>\n @if (face) {\n <Sprite sheet={@faceSheet(@face.@id, @face.@expression)} />\n }\n </Container>\n </Container>\n</Container> \n\n \n</Container>\n<script>\n import Selection from './selection.ce'\n\n import {\n animatedSignal,\n computed,\n effect,\n signal,\n trigger,\n mount\n } from \"canvasengine\";\n\n import { inject } from \"../../../core/inject\";\n import { RpgClientEngine } from \"../../../RpgClientEngine\";\n import BoxComponent from \"../box.ce\";\n\n const {\n message,\n choices: _choices,\n onFinish,\n onInteraction,\n face,\n position,\n typewriterEffect,\n autoClose\n } = defineProps();\n \n const client = inject(RpgClientEngine);\n const keyboardControls = client.globalConfig.keyboardControls;\n\n const dialogboxStyles = client.globalConfig.box.styles ?? {\n backgroundColor: \"#1a1a2e\",\n backgroundOpacity: 0.9,\n }\n const dialogBoxTypewriterSound = client.globalConfig?.box?.sounds?.typewriter\n\n const spritesheets = client.spritesheets;\n const sounds = client.sounds;\n\n client.stopProcessingInput = true;\n let isDestroyed = false;\n\n const texts = [message()]\n const height = signal(256);\n const margin = signal(40);\n const isTextCompleted = signal(false);\n\n const drawSpeaker = (g) => {\n g.beginFill(0xffa500); // Orange color\n g.lineStyle(2, 0x000000); // Black border\n g.moveTo(0, 0);\n g.lineTo(70, 0);\n g.lineTo(80, 15);\n g.lineTo(70, 30);\n g.lineTo(0, 30);\n g.lineTo(0, 0);\n g.endFill();\n };\n\n const border = signal({ width: 5, color: \"#595971\" });\n const shadow = signal({ color: \"#000\", blur: 10, offsetX: 10, offsetY: 10 });\n\n const contentOpacity = animatedSignal(0, {\n duration: 1000,\n });\n\n const scaleX = animatedSignal(0, {\n duration: 500,\n });\n\n const positionBox = computed(() => {\n if (position() === 'bottom') {\n return { positionType: 'absolute', bottom: 10 };\n }\n else if (position() === 'top') {\n return { positionType: 'absolute', top: 10 };\n }\n return {};\n });\n\n const widthBox = computed(() => {\n return 700;\n });\n\n scaleX.set(1);\n contentOpacity.set(1);\n\n const currentTextIndex = signal(0);\n const currentText = computed(() => texts?.[currentTextIndex()] ?? '');\n const isChoiceDisplayed = signal(false);\n\n const text = computed(() => {\n const current = currentText();\n return typeof current === \"string\" ? current : current.text;\n });\n\n const faceSheet = (graphicId, animationName) => {\n return {\n definition: spritesheets.get(graphicId),\n playing: animationName,\n };\n }\n\n const choices = computed(() => {\n //const current = currentText();\n //return typeof current === \"string\" ? null : current.choices;\n return _choices;\n });\n\n const visibleSelection = computed(() => isChoiceDisplayed() && choices().length != 0)\n\n const triggerSkip = trigger();\n\n const typewriter = typewriterEffect() ? {\n speed: 0.3,\n skip: triggerSkip,\n sound: {\n src: sounds.get(dialogBoxTypewriterSound)?.src\n },\n onComplete: () => {\n isTextCompleted.set(true);\n if (autoClose()) {\n setTimeout(() => {\n onFinish();\n }, 1000);\n }\n }\n } : null;\n\n const textStyle = {\n wordWrap: true,\n wordWrapWidth: widthBox() - margin() * 2 - (face ? 256 : 0)\n }\n\n mount((element) => {\n const [dialogbox] = element.props.children\n return () => {\n dialogbox.directives.controls.onDestroy()\n isDestroyed = true;\n // Wait destroy is finished before start processing input\n setTimeout(() => {\n client.stopProcessingInput = false;\n }, 500)\n }\n })\n\n const controls = signal({\n next: {\n bind: keyboardControls.action,\n keyDown(e) {\n if (isDestroyed) return;\n if (isChoiceDisplayed()) {\n // If choices are displayed, do nothing (wait for selection)\n return;\n }\n\n // If text is still typing, just skip (fast forward) the animation\n if (!isTextCompleted()) {\n triggerSkip.start();\n isTextCompleted.set(true);\n }\n else {\n const isFinished = currentTextIndex() === texts.length - 1;\n currentTextIndex.update((index) => {\n if (index < texts.length - 1) {\n return index + 1;\n }\n return index;\n });\n isChoiceDisplayed.set(false);\n isTextCompleted.set(false);\n if (isFinished && onFinish) {\n onFinish();\n } \n }\n },\n },\n });\n\n const onSelect = (index) => {\n onFinish(index);\n }\n \n effect(() => {\n if (choices().length != 0) {\n isChoiceDisplayed.set(true);\n }\n });\n</script>"],"names":["Selection"],"mappings":";;;;;AAYqB,SAAS,SAAS,CAAC,OAAO,EAAE;AACjD,QAAuB,QAAQ,CAAC,OAAO;AACvC,QAAQ,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO;AAClD,QAAQ,IAAI,QAAQ,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,KAAK,YAAY;AAC9D,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,SAAS,CAAC,EAAE;AAC5C,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;AAC7D,YAAY,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;AAC5B,YAAY,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;AAC3E,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC3B;AACA,QAAQ,OAAO,CAAC;AAChB,KAAK;AACL,IAAI,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC;AAC1C,CAAC;AACD,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;AACnB,IAAC,EAAE,GAAG,WAAW,EAAE,CAAC,CAAC,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,QAAQ,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,QAAQ,GAAG,EAAE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E,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAACA,WAAS,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7xB,QAAQ,OAAO;AACf;;;;"}
|
package/dist/index11.js
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { useProps, useDefineProps, computed, h, Container, Rect } from 'canvasengine';
|
|
2
|
+
import { RpgClientEngine } from './index2.js';
|
|
3
|
+
import './index22.js';
|
|
4
|
+
import '@rpgjs/common';
|
|
5
|
+
import './index16.js';
|
|
6
|
+
import { inject } from './index6.js';
|
|
7
|
+
import 'rxjs';
|
|
8
|
+
import './index23.js';
|
|
9
|
+
import '@canvasengine/presets';
|
|
3
10
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
11
|
+
function component($$props) {
|
|
12
|
+
useProps($$props);
|
|
13
|
+
const defineProps = useDefineProps($$props);
|
|
14
|
+
var _a = defineProps(), width = _a.width, height = _a.height, children = _a.children, color = _a.color, top = _a.top, left = _a.left;
|
|
15
|
+
var engine = inject(RpgClientEngine);
|
|
16
|
+
var child = children[0];
|
|
17
|
+
var _color = computed(function () { var _a; return ((_a = engine.globalConfig.gui) === null || _a === void 0 ? void 0 : _a.windowColor) || (color === null || color === void 0 ? void 0 : color()) || "#1a1a2e"; });
|
|
18
|
+
let $this = h(Container, { positionType: 'absolute', top: top, left: left }, h(Container, { anchor: [0.5, 0.5] }, [h(Rect, { width, height, color: _color }), h(Container, { attach: child })]));
|
|
19
|
+
return $this
|
|
20
|
+
}
|
|
8
21
|
|
|
9
|
-
export {
|
|
22
|
+
export { component as default };
|
|
10
23
|
//# sourceMappingURL=index11.js.map
|
package/dist/index11.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index11.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index11.js","sources":["../src/components/gui/box.ce"],"sourcesContent":["<Container positionType=\"absolute\" top={top} left={left}>\n <Container\n anchor={[0.5, 0.5]}\n >\n <Rect width height color={_color} />\n <Container attach={child}></Container>\n </Container> \n</Container>\n\n<script>\n import { RpgClientEngine, inject } from \"../../index\";\n\n const { width, height, children, color, top, left } = defineProps();\n const engine = inject(RpgClientEngine)\n const child = children[0]\n const _color = computed(() => engine.globalConfig.gui?.windowColor || color?.() || \"#1a1a2e\")\n</script>"],"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,EAAE,EAAE,KAAK,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,EAAE,CAAC,MAAM,EAAE,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,KAAK,GAAG,EAAE,CAAC,KAAK,EAAE,GAAG,GAAG,EAAE,CAAC,GAAG,EAAE,IAAI,GAAG,EAAE,CAAC,IAAI;AAC5I,IAAI,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC;AACpC,IAAI,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC;AACvB,IAAI,MAAM,GAAG,QAAQ,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,MAAM,GAAG,EAAE,CAAC,WAAW,MAAM,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,MAAM,GAAG,MAAM,GAAG,KAAK,EAAE,CAAC,IAAI,SAAS,CAAC,EAAE;AAClN,QAAQ,IAAI,KAAK,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AACvM,QAAQ,OAAO;AACf;;;;"}
|
package/dist/index12.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { RMSpritesheet } from './index28.js';
|
|
1
|
+
import component$1 from './index24.js';
|
|
2
|
+
import component from './index25.js';
|
|
4
3
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
AnimationSpritesheetPreset
|
|
4
|
+
const PrebuiltComponentAnimations = {
|
|
5
|
+
Hit: component$1,
|
|
6
|
+
Animation: component
|
|
9
7
|
};
|
|
10
8
|
|
|
11
|
-
export {
|
|
9
|
+
export { PrebuiltComponentAnimations };
|
|
12
10
|
//# sourceMappingURL=index12.js.map
|
package/dist/index12.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index12.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"index12.js","sources":["../src/components/animations/index.ts"],"sourcesContent":["import Hit from \"./hit.ce\";\nimport Animation from \"./animation.ce\";\n\nexport const PrebuiltComponentAnimations = {\n Hit,\n Animation\n}"],"names":["Hit","Animation"],"mappings":";;;AAGO,MAAM,2BAA8B,GAAA;AAAA,OACvCA,WAAA;AAAA,aACAC;AACJ;;;;"}
|
package/dist/index13.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { AnimationSpritesheetPreset } from './index26.js';
|
|
2
|
+
import { LPCSpritesheetPreset } from './index27.js';
|
|
3
|
+
import { RMSpritesheet } from './index28.js';
|
|
4
|
+
import { FacesetPreset } from './index29.js';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
let $this = h(Container, { sortableChildren: true }, [loop(events, (event, id) => h(component$1, { id: id, object: event })), loop(players, (player, id) => h(component$1, { id: id, object: player }))]);
|
|
13
|
-
return $this
|
|
14
|
-
}
|
|
6
|
+
const Presets = {
|
|
7
|
+
RMSpritesheet,
|
|
8
|
+
LPCSpritesheetPreset,
|
|
9
|
+
AnimationSpritesheetPreset,
|
|
10
|
+
FacesetPreset
|
|
11
|
+
};
|
|
15
12
|
|
|
16
|
-
export {
|
|
13
|
+
export { Presets };
|
|
17
14
|
//# sourceMappingURL=index13.js.map
|
package/dist/index13.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index13.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"index13.js","sources":["../src/presets/index.ts"],"sourcesContent":["import { AnimationSpritesheetPreset } from \"./animation\";\nimport { LPCSpritesheetPreset } from \"./lpc\";\nimport { RMSpritesheet } from \"./rmspritesheet\";\nimport { FacesetPreset } from \"./faceset\";\n\nexport const Presets = {\n RMSpritesheet,\n LPCSpritesheetPreset,\n AnimationSpritesheetPreset,\n FacesetPreset\n}"],"names":[],"mappings":";;;;;AAKO,MAAM,OAAU,GAAA;AAAA,EACnB,aAAA;AAAA,EACA,oBAAA;AAAA,EACA,0BAAA;AAAA,EACA;AACJ;;;;"}
|