create-pixi-vn 1.2.2 → 1.2.3
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/package.json +1 -1
- package/template-game-engine/package.json +1 -1
- package/template-game-engine/src/classes/Label.ts +2 -27
- package/template-game-engine/src/index.ts +2 -1
- package/template-react-vite-muijoy/package.json +1 -1
- package/template-react-vite-muijoy-ink/package.json +1 -1
- package/template-react-vite-muijoy-ink-tauri/package.json +1 -1
- package/template-react-vite-muijoy-tauri/package.json +1 -1
package/package.json
CHANGED
|
@@ -1,31 +1,6 @@
|
|
|
1
1
|
import { LabelAbstract, LabelProps, StepLabelType } from "@drincs/pixi-vn";
|
|
2
|
-
import { AdditionalShaSpetsEnum } from "@drincs/pixi-vn/dist/narration/interfaces/HistoryStep";
|
|
3
2
|
import sha1 from "crypto-js/sha1";
|
|
4
3
|
|
|
5
|
-
/**
|
|
6
|
-
* Label is a class that contains a list of steps, which will be performed as the game continues.
|
|
7
|
-
* For Ren'py this is the equivalent of a label.
|
|
8
|
-
* @example
|
|
9
|
-
* ```typescript
|
|
10
|
-
* const START_LABEL_ID = "StartLabel"
|
|
11
|
-
*
|
|
12
|
-
* export const startLabel = newLabel(START_LABEL_ID,
|
|
13
|
-
* [
|
|
14
|
-
* (props) => {
|
|
15
|
-
* canvas.clear()
|
|
16
|
-
* narration.dialogue = { character: liam, text: "Which test do you want to perform?" }
|
|
17
|
-
* narration.choiceMenuOptions = [
|
|
18
|
-
* new ChoiceMenuOption("Events Test", eventsTestLabel),
|
|
19
|
-
* new ChoiceMenuOption("Show Image Test", showImageTest),
|
|
20
|
-
* ]
|
|
21
|
-
* },
|
|
22
|
-
* (props) => narration.jumpLabel(START_LABEL_ID, props),
|
|
23
|
-
* ]
|
|
24
|
-
* )
|
|
25
|
-
*
|
|
26
|
-
* narration.callLabel(StartLabel)
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
4
|
export default class Label<T extends {} = {}> extends LabelAbstract<Label<T>, T> {
|
|
30
5
|
public get stepCount(): number {
|
|
31
6
|
return this.steps.length;
|
|
@@ -57,7 +32,7 @@ export default class Label<T extends {} = {}> extends LabelAbstract<Label<T>, T>
|
|
|
57
32
|
public getStepSha(index: number): string {
|
|
58
33
|
if (index < 0 || index >= this.steps.length) {
|
|
59
34
|
console.warn("stepSha not found, setting to ERROR");
|
|
60
|
-
return
|
|
35
|
+
return "error";
|
|
61
36
|
}
|
|
62
37
|
try {
|
|
63
38
|
let step = this.steps[index];
|
|
@@ -65,7 +40,7 @@ export default class Label<T extends {} = {}> extends LabelAbstract<Label<T>, T>
|
|
|
65
40
|
return sha1String.toString();
|
|
66
41
|
} catch (e) {
|
|
67
42
|
console.warn("stepSha not found, setting to ERROR", e);
|
|
68
|
-
return
|
|
43
|
+
return "error";
|
|
69
44
|
}
|
|
70
45
|
}
|
|
71
46
|
}
|
|
@@ -129,6 +129,7 @@ export namespace Game {
|
|
|
129
129
|
* @param navigate The function to navigate to a path
|
|
130
130
|
*/
|
|
131
131
|
export async function restoreGameState(data: GameState, navigate: (path: string) => void) {
|
|
132
|
+
stepHistory.restore(data.historyData);
|
|
132
133
|
await narration.restore(data.stepData, HistoryManagerStatic.lastHistoryStep);
|
|
133
134
|
storage.restore(data.storageData);
|
|
134
135
|
await canvas.restore(data.canvasData);
|
|
@@ -147,4 +148,4 @@ export namespace Game {
|
|
|
147
148
|
}
|
|
148
149
|
|
|
149
150
|
export { Container, ImageContainer, ImageSprite, Sprite, Text, VideoSprite } from "@drincs/pixi-vn";
|
|
150
|
-
export { canvas, GameUnifier, narration, PIXIVN, sound, storage };
|
|
151
|
+
export { canvas, GameUnifier, narration, PIXIVN, sound, stepHistory, storage };
|