@drincs/pixi-vn 0.5.2 → 0.5.4
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/classes/CharacterBaseModel.js +110 -112
- package/dist/classes/CharacterBaseModel.js.map +1 -1
- package/dist/classes/CharacterBaseModel.mjs +110 -112
- package/dist/classes/CharacterBaseModel.mjs.map +1 -1
- package/dist/classes/ChoiceMenuOption.d.mts +19 -7
- package/dist/classes/ChoiceMenuOption.d.ts +19 -7
- package/dist/classes/ChoiceMenuOption.js +1386 -7
- package/dist/classes/ChoiceMenuOption.js.map +1 -1
- package/dist/classes/ChoiceMenuOption.mjs +1386 -7
- package/dist/classes/ChoiceMenuOption.mjs.map +1 -1
- package/dist/classes/CloseLabel.d.mts +8 -3
- package/dist/classes/CloseLabel.d.ts +8 -3
- package/dist/classes/CloseLabel.js +44 -2
- package/dist/classes/CloseLabel.js.map +1 -1
- package/dist/classes/CloseLabel.mjs +41 -2
- package/dist/classes/CloseLabel.mjs.map +1 -1
- package/dist/classes/Label.d.mts +47 -21
- package/dist/classes/Label.d.ts +47 -21
- package/dist/classes/Label.js +36 -1
- package/dist/classes/Label.js.map +1 -1
- package/dist/classes/Label.mjs +36 -1
- package/dist/classes/Label.mjs.map +1 -1
- package/dist/classes/StoredClassModel.js +55 -57
- package/dist/classes/StoredClassModel.js.map +1 -1
- package/dist/classes/StoredClassModel.mjs +55 -57
- package/dist/classes/StoredClassModel.mjs.map +1 -1
- package/dist/classes/index.d.mts +2 -2
- package/dist/classes/index.d.ts +2 -2
- package/dist/classes/index.js +125 -73
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +125 -73
- package/dist/classes/index.mjs.map +1 -1
- package/dist/classes/ticker/TickerFadeAlpha.js +27 -27
- package/dist/classes/ticker/TickerFadeAlpha.js.map +1 -1
- package/dist/classes/ticker/TickerFadeAlpha.mjs +27 -27
- package/dist/classes/ticker/TickerFadeAlpha.mjs.map +1 -1
- package/dist/classes/ticker/TickerMove.js +57 -55
- package/dist/classes/ticker/TickerMove.js.map +1 -1
- package/dist/classes/ticker/TickerMove.mjs +57 -55
- package/dist/classes/ticker/TickerMove.mjs.map +1 -1
- package/dist/classes/ticker/TickerRotate.js +57 -55
- package/dist/classes/ticker/TickerRotate.js.map +1 -1
- package/dist/classes/ticker/TickerRotate.mjs +57 -55
- package/dist/classes/ticker/TickerRotate.mjs.map +1 -1
- package/dist/classes/ticker/index.js +17 -17
- package/dist/classes/ticker/index.js.map +1 -1
- package/dist/classes/ticker/index.mjs +17 -17
- package/dist/classes/ticker/index.mjs.map +1 -1
- package/dist/constants.d.mts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/constants.mjs.map +1 -1
- package/dist/decorators/LabelDecorator.d.mts +13 -20
- package/dist/decorators/LabelDecorator.d.ts +13 -20
- package/dist/decorators/LabelDecorator.js +1388 -28
- package/dist/decorators/LabelDecorator.js.map +1 -1
- package/dist/decorators/LabelDecorator.mjs +1388 -25
- package/dist/decorators/LabelDecorator.mjs.map +1 -1
- package/dist/decorators/index.d.mts +4 -4
- package/dist/decorators/index.d.ts +4 -4
- package/dist/decorators/index.js +1385 -13
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +1384 -13
- package/dist/decorators/index.mjs.map +1 -1
- package/dist/functions/DialogueUtility.d.mts +7 -7
- package/dist/functions/DialogueUtility.d.ts +7 -7
- package/dist/functions/DialogueUtility.js +97 -67
- package/dist/functions/DialogueUtility.js.map +1 -1
- package/dist/functions/DialogueUtility.mjs +97 -67
- package/dist/functions/DialogueUtility.mjs.map +1 -1
- package/dist/functions/FlagsUtility.js +55 -57
- package/dist/functions/FlagsUtility.js.map +1 -1
- package/dist/functions/FlagsUtility.mjs +55 -57
- package/dist/functions/FlagsUtility.mjs.map +1 -1
- package/dist/functions/GameUtility.js +55 -57
- package/dist/functions/GameUtility.js.map +1 -1
- package/dist/functions/GameUtility.mjs +55 -57
- package/dist/functions/GameUtility.mjs.map +1 -1
- package/dist/functions/ImageUtility.js +17 -17
- package/dist/functions/ImageUtility.js.map +1 -1
- package/dist/functions/ImageUtility.mjs +17 -17
- package/dist/functions/ImageUtility.mjs.map +1 -1
- package/dist/functions/SavesUtility.d.mts +2 -2
- package/dist/functions/SavesUtility.d.ts +2 -2
- package/dist/functions/SavesUtility.js +115 -143
- package/dist/functions/SavesUtility.js.map +1 -1
- package/dist/functions/SavesUtility.mjs +115 -143
- package/dist/functions/SavesUtility.mjs.map +1 -1
- package/dist/functions/StepLabelUtility.d.mts +0 -1
- package/dist/functions/StepLabelUtility.d.ts +0 -1
- package/dist/functions/index.d.mts +4 -4
- package/dist/functions/index.d.ts +4 -4
- package/dist/functions/index.js +98 -68
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs +98 -68
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +361 -327
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +360 -327
- package/dist/index.mjs.map +1 -1
- package/dist/interface/{IDialogueHistory.d.mts → DialogueHistory.d.mts} +5 -5
- package/dist/interface/{IDialogueHistory.d.ts → DialogueHistory.d.ts} +5 -5
- package/dist/interface/{IDialogueHistory.js → DialogueHistory.js} +1 -1
- package/dist/interface/DialogueHistory.mjs +3 -0
- package/dist/interface/IHistoryStep.d.mts +2 -2
- package/dist/interface/IHistoryStep.d.ts +2 -2
- package/dist/interface/ISaveData.d.mts +2 -2
- package/dist/interface/ISaveData.d.ts +2 -2
- package/dist/interface/export/ExportedStep.d.mts +2 -2
- package/dist/interface/export/ExportedStep.d.ts +2 -2
- package/dist/interface/export/index.d.mts +2 -2
- package/dist/interface/export/index.d.ts +2 -2
- package/dist/interface/index.d.mts +6 -6
- package/dist/interface/index.d.ts +6 -6
- package/dist/managers/StepManager.d.mts +12 -12
- package/dist/managers/StepManager.d.ts +12 -12
- package/dist/managers/StepManager.js +55 -81
- package/dist/managers/StepManager.js.map +1 -1
- package/dist/managers/StepManager.mjs +55 -81
- package/dist/managers/StepManager.mjs.map +1 -1
- package/dist/managers/WindowManager.d.mts +1 -1
- package/dist/managers/WindowManager.d.ts +1 -1
- package/dist/managers/index.d.mts +2 -2
- package/dist/managers/index.d.ts +2 -2
- package/dist/managers/index.js +114 -142
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/index.mjs +114 -142
- package/dist/managers/index.mjs.map +1 -1
- package/dist/types/ChoiceMenuOptionsType.d.mts +3 -3
- package/dist/types/ChoiceMenuOptionsType.d.ts +3 -3
- package/dist/types/StepLabelType.d.mts +2 -3
- package/dist/types/StepLabelType.d.ts +2 -3
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
- package/dist/interface/IDialogueHistory.mjs +0 -3
- /package/dist/interface/{IDialogueHistory.js.map → DialogueHistory.js.map} +0 -0
- /package/dist/interface/{IDialogueHistory.mjs.map → DialogueHistory.mjs.map} +0 -0
|
@@ -11,12 +11,12 @@ import '../interface/IHistoryStep.mjs';
|
|
|
11
11
|
import 'deep-diff';
|
|
12
12
|
import '../classes/ChoiceMenuOption.mjs';
|
|
13
13
|
import '../classes/Label.mjs';
|
|
14
|
+
import '../types/LabelIdType.mjs';
|
|
15
|
+
import '../types/StepHistoryDataType.mjs';
|
|
14
16
|
import '../types/StepLabelType.mjs';
|
|
15
17
|
import '@drincs/pixi-vn/dist/override';
|
|
16
|
-
import '../types/StepHistoryDataType.mjs';
|
|
17
18
|
import '../types/CloseType.mjs';
|
|
18
19
|
import '../types/LabelRunModeType.mjs';
|
|
19
|
-
import '../types/LabelIdType.mjs';
|
|
20
20
|
import '../classes/DialogueBaseModel.mjs';
|
|
21
21
|
import '../classes/CharacterBaseModel.mjs';
|
|
22
22
|
import '../classes/StoredClassModel.mjs';
|
|
@@ -11,12 +11,12 @@ import '../interface/IHistoryStep.js';
|
|
|
11
11
|
import 'deep-diff';
|
|
12
12
|
import '../classes/ChoiceMenuOption.js';
|
|
13
13
|
import '../classes/Label.js';
|
|
14
|
+
import '../types/LabelIdType.js';
|
|
15
|
+
import '../types/StepHistoryDataType.js';
|
|
14
16
|
import '../types/StepLabelType.js';
|
|
15
17
|
import '@drincs/pixi-vn/dist/override';
|
|
16
|
-
import '../types/StepHistoryDataType.js';
|
|
17
18
|
import '../types/CloseType.js';
|
|
18
19
|
import '../types/LabelRunModeType.js';
|
|
19
|
-
import '../types/LabelIdType.js';
|
|
20
20
|
import '../classes/DialogueBaseModel.js';
|
|
21
21
|
import '../classes/CharacterBaseModel.js';
|
|
22
22
|
import '../classes/StoredClassModel.js';
|
|
@@ -59,107 +59,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
// src/constants.ts
|
|
62
|
-
var PIXIVN_VERSION = "0.5.
|
|
63
|
-
|
|
64
|
-
// src/types/PauseType.ts
|
|
65
|
-
var PauseValueType = "pause";
|
|
66
|
-
|
|
67
|
-
// src/types/RepeatType.ts
|
|
68
|
-
var Repeat = "repeat";
|
|
62
|
+
var PIXIVN_VERSION = "0.5.4";
|
|
69
63
|
function getStepSha1(step) {
|
|
70
64
|
let sha1String = sha1__default.default(step.toString().toLocaleLowerCase());
|
|
71
65
|
return sha1String.toString();
|
|
72
66
|
}
|
|
73
|
-
function checkIfStepsIsEqual(step1, step2) {
|
|
74
|
-
return step1 === step2;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// src/classes/Label.ts
|
|
78
|
-
var Label = class {
|
|
79
|
-
/**
|
|
80
|
-
* Get the steps of the label.
|
|
81
|
-
* This class should be extended and the steps method should be overridden.
|
|
82
|
-
* Every time you update this list will also be updated when the other game versions load.
|
|
83
|
-
*/
|
|
84
|
-
get steps() {
|
|
85
|
-
throw new Error("[Pixi'VN] The method Label.steps must be overridden");
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Get the corresponding steps number
|
|
89
|
-
* @param externalSteps
|
|
90
|
-
* @returns Numer of corresponding steps, for example, if externalSteps is [ABC, DEF, GHI] and the steps of the label is [ABC, GHT], the result will be 1
|
|
91
|
-
*/
|
|
92
|
-
getCorrespondingStepsNumber(externalSteps) {
|
|
93
|
-
if (externalSteps.length === 0) {
|
|
94
|
-
return 0;
|
|
95
|
-
}
|
|
96
|
-
let res = 0;
|
|
97
|
-
externalSteps.forEach((step, index) => {
|
|
98
|
-
if (checkIfStepsIsEqual(step, this.steps[index])) {
|
|
99
|
-
res = index;
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
return res;
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
67
|
|
|
106
68
|
// src/classes/CloseLabel.ts
|
|
107
|
-
var
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
// src/decorators/LabelDecorator.ts
|
|
111
|
-
var registeredLabels = {};
|
|
112
|
-
function getLabelInstanceByClassName(labelName) {
|
|
113
|
-
try {
|
|
114
|
-
let labelType = registeredLabels[labelName];
|
|
115
|
-
if (!labelType) {
|
|
116
|
-
console.error(`[Pixi'VN] Label ${labelName} not found`);
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
let label = new labelType();
|
|
120
|
-
let step = label.steps;
|
|
121
|
-
if (step.length = 0) {
|
|
122
|
-
console.warn(`[Pixi'VN] Label ${labelName} has no steps`);
|
|
123
|
-
}
|
|
124
|
-
return label;
|
|
125
|
-
} catch (e) {
|
|
126
|
-
console.error(`[Pixi'VN] Error while getting Label ${labelName}`, e);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// src/functions/DialogueUtility.ts
|
|
132
|
-
function getDialogue() {
|
|
133
|
-
return GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// src/decorators/CanvasElementDecorator.ts
|
|
137
|
-
var registeredCanvasElement = {};
|
|
138
|
-
function getCanvasElementInstanceByClassName(canvasName) {
|
|
139
|
-
try {
|
|
140
|
-
let eventType = registeredCanvasElement[canvasName];
|
|
141
|
-
if (!eventType) {
|
|
142
|
-
if (canvasName === "CanvasContainer") {
|
|
143
|
-
eventType = CanvasContainer;
|
|
144
|
-
} else if (canvasName === "CanvasImage") {
|
|
145
|
-
eventType = CanvasImage;
|
|
146
|
-
} else if (canvasName === "CanvasSprite") {
|
|
147
|
-
eventType = CanvasSprite;
|
|
148
|
-
} else if (canvasName === "CanvasText") {
|
|
149
|
-
eventType = CanvasText;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
if (!eventType) {
|
|
153
|
-
console.error(`[Pixi'VN] CanvasElement ${canvasName} not found`);
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
let canvasElement = new eventType();
|
|
157
|
-
return canvasElement;
|
|
158
|
-
} catch (e) {
|
|
159
|
-
console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasName}`, e);
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
69
|
+
var CLOSE_LABEL_ID = "__close-label-id__";
|
|
163
70
|
|
|
164
71
|
// src/functions/CanvasUtility.ts
|
|
165
72
|
function getTextureMemory(texture) {
|
|
@@ -596,29 +503,33 @@ function setMemoryText(element, memory) {
|
|
|
596
503
|
}
|
|
597
504
|
}
|
|
598
505
|
|
|
599
|
-
// src/
|
|
600
|
-
var
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
506
|
+
// src/decorators/CanvasElementDecorator.ts
|
|
507
|
+
var registeredCanvasElement = {};
|
|
508
|
+
function getCanvasElementInstanceByClassName(canvasName) {
|
|
509
|
+
try {
|
|
510
|
+
let eventType = registeredCanvasElement[canvasName];
|
|
511
|
+
if (!eventType) {
|
|
512
|
+
if (canvasName === "CanvasContainer") {
|
|
513
|
+
eventType = CanvasContainer;
|
|
514
|
+
} else if (canvasName === "CanvasImage") {
|
|
515
|
+
eventType = CanvasImage;
|
|
516
|
+
} else if (canvasName === "CanvasSprite") {
|
|
517
|
+
eventType = CanvasSprite;
|
|
518
|
+
} else if (canvasName === "CanvasText") {
|
|
519
|
+
eventType = CanvasText;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
if (!eventType) {
|
|
523
|
+
console.error(`[Pixi'VN] CanvasElement ${canvasName} not found`);
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
let canvasElement = new eventType();
|
|
527
|
+
return canvasElement;
|
|
528
|
+
} catch (e) {
|
|
529
|
+
console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasName}`, e);
|
|
530
|
+
return;
|
|
620
531
|
}
|
|
621
|
-
}
|
|
532
|
+
}
|
|
622
533
|
|
|
623
534
|
// src/decorators/TickerDecorator.ts
|
|
624
535
|
var registeredTickers = {};
|
|
@@ -647,7 +558,51 @@ function geTickerInstanceByClassName(tickerName, args, duration, priority) {
|
|
|
647
558
|
}
|
|
648
559
|
}
|
|
649
560
|
|
|
650
|
-
// src/
|
|
561
|
+
// src/types/PauseType.ts
|
|
562
|
+
var PauseValueType = "pause";
|
|
563
|
+
|
|
564
|
+
// src/types/RepeatType.ts
|
|
565
|
+
var Repeat = "repeat";
|
|
566
|
+
|
|
567
|
+
// src/decorators/LabelDecorator.ts
|
|
568
|
+
var registeredLabels = {};
|
|
569
|
+
function getLabelById(id) {
|
|
570
|
+
let label = registeredLabels[id];
|
|
571
|
+
if (!label) {
|
|
572
|
+
console.error(`[Pixi'VN] Label ${id} not found`);
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
return label;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
// src/functions/DialogueUtility.ts
|
|
579
|
+
function getDialogue() {
|
|
580
|
+
return GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
// src/classes/ticker/TickerBase.ts
|
|
584
|
+
var TickerBase = class {
|
|
585
|
+
/**
|
|
586
|
+
* @param args The arguments that you want to pass to the ticker.
|
|
587
|
+
* @param duration The duration of the ticker. If is undefined, the ticker will be called every frame.
|
|
588
|
+
* @param priority The priority of the ticker. If is undefined, the priority will be UPDATE_PRIORITY.NORMAL.
|
|
589
|
+
*/
|
|
590
|
+
constructor(args, duration, priority) {
|
|
591
|
+
this.args = args;
|
|
592
|
+
this.duration = duration;
|
|
593
|
+
this.priority = priority;
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* The method that will be called every frame.
|
|
597
|
+
* This method should be overridden and you can use GameWindowManager.addCanvasElement() to get the canvas element of the canvas, and edit them.
|
|
598
|
+
* @param t The ticker that is calling this method
|
|
599
|
+
* @param args The arguments that you passed when you added the ticker
|
|
600
|
+
* @param tags The tags of the canvas elements that are connected to this ticker
|
|
601
|
+
*/
|
|
602
|
+
fn(_t, _args, _tags) {
|
|
603
|
+
throw new Error("[Pixi'VN] The method TickerBase.fn() must be overridden");
|
|
604
|
+
}
|
|
605
|
+
};
|
|
651
606
|
var TickerFadeAlpha = class extends TickerBase {
|
|
652
607
|
/**
|
|
653
608
|
* The method that will be called every frame to fade the alpha of the canvas element of the canvas.
|
|
@@ -1561,7 +1516,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1561
1516
|
*/
|
|
1562
1517
|
static get currentLabel() {
|
|
1563
1518
|
if (_GameStepManager.currentLabelId) {
|
|
1564
|
-
return
|
|
1519
|
+
return getLabelById(_GameStepManager.currentLabelId);
|
|
1565
1520
|
}
|
|
1566
1521
|
}
|
|
1567
1522
|
static get currentLabelStepIndex() {
|
|
@@ -1582,7 +1537,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1582
1537
|
return true;
|
|
1583
1538
|
} else {
|
|
1584
1539
|
this.openedLabels.forEach((item) => {
|
|
1585
|
-
let label =
|
|
1540
|
+
let label = getLabelById(item.label);
|
|
1586
1541
|
if (label && label.steps.length > item.currentStepIndex) {
|
|
1587
1542
|
return false;
|
|
1588
1543
|
}
|
|
@@ -1675,9 +1630,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1675
1630
|
* @param label The label to add to the history.
|
|
1676
1631
|
*/
|
|
1677
1632
|
static pushNewLabel(label) {
|
|
1678
|
-
let currentLabel =
|
|
1633
|
+
let currentLabel = getLabelById(label);
|
|
1679
1634
|
if (!currentLabel) {
|
|
1680
|
-
throw new Error(
|
|
1635
|
+
throw new Error(`[Pixi'VN] Label ${label} not found`);
|
|
1681
1636
|
}
|
|
1682
1637
|
_GameStepManager._openedLabels.push({
|
|
1683
1638
|
label,
|
|
@@ -1694,7 +1649,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1694
1649
|
return;
|
|
1695
1650
|
}
|
|
1696
1651
|
if (!_GameStepManager.currentLabel) {
|
|
1697
|
-
console.error("[Pixi'VN]
|
|
1652
|
+
console.error("[Pixi'VN] currentLabel not found");
|
|
1698
1653
|
return;
|
|
1699
1654
|
}
|
|
1700
1655
|
_GameStepManager._openedLabels.pop();
|
|
@@ -1766,7 +1721,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1766
1721
|
}
|
|
1767
1722
|
let currentLabel = _GameStepManager.currentLabel;
|
|
1768
1723
|
if (!currentLabel) {
|
|
1769
|
-
console.error("[Pixi'VN]
|
|
1724
|
+
console.error("[Pixi'VN] currentLabel not found");
|
|
1770
1725
|
return;
|
|
1771
1726
|
}
|
|
1772
1727
|
let n = currentLabel.steps.length;
|
|
@@ -1787,12 +1742,12 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1787
1742
|
/**
|
|
1788
1743
|
* Execute the label and add it to the history.
|
|
1789
1744
|
* Is a call function in Ren'Py.
|
|
1790
|
-
* @param label The label to execute
|
|
1745
|
+
* @param label The label to execute or the id of the label
|
|
1791
1746
|
* @param props The props to pass to the label.
|
|
1792
1747
|
* @returns StepLabelResultType or undefined.
|
|
1793
1748
|
* @example
|
|
1794
1749
|
* ```typescript
|
|
1795
|
-
* GameStepManager.callLabel(
|
|
1750
|
+
* GameStepManager.callLabel(startLabel, yourParams).then((result) => {
|
|
1796
1751
|
* if (result) {
|
|
1797
1752
|
* // your code
|
|
1798
1753
|
* }
|
|
@@ -1801,7 +1756,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1801
1756
|
* @example
|
|
1802
1757
|
* ```typescript
|
|
1803
1758
|
* // if you use it in a step label you should return the result.
|
|
1804
|
-
* return GameStepManager.callLabel(
|
|
1759
|
+
* return GameStepManager.callLabel(startLabel).then((result) => {
|
|
1805
1760
|
* return result
|
|
1806
1761
|
* })
|
|
1807
1762
|
* ```
|
|
@@ -1809,16 +1764,24 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1809
1764
|
static callLabel(label, props) {
|
|
1810
1765
|
return __async(this, null, function* () {
|
|
1811
1766
|
let choiseMade = void 0;
|
|
1767
|
+
let labelId;
|
|
1768
|
+
if (typeof label === "string") {
|
|
1769
|
+
labelId = label;
|
|
1770
|
+
} else {
|
|
1771
|
+
labelId = label.id;
|
|
1772
|
+
if (typeof label.choiseIndex === "number") {
|
|
1773
|
+
choiseMade = label.choiseIndex;
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1812
1776
|
try {
|
|
1813
|
-
if (
|
|
1777
|
+
if (labelId === CLOSE_LABEL_ID) {
|
|
1814
1778
|
return _GameStepManager.runNextStep(props);
|
|
1815
1779
|
}
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1780
|
+
let tempLabel = getLabelById(labelId);
|
|
1781
|
+
if (!tempLabel) {
|
|
1782
|
+
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
1819
1783
|
}
|
|
1820
|
-
|
|
1821
|
-
_GameStepManager.pushNewLabel(labelName);
|
|
1784
|
+
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
1822
1785
|
} catch (e) {
|
|
1823
1786
|
console.error("[Pixi'VN] Error calling label", e);
|
|
1824
1787
|
return;
|
|
@@ -1830,11 +1793,11 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1830
1793
|
* Execute the label, close all labels and add them to the history.
|
|
1831
1794
|
* Is a jump function in Ren'Py.
|
|
1832
1795
|
* @param label The label to execute.
|
|
1833
|
-
* @param props The props to pass to the label
|
|
1796
|
+
* @param props The props to pass to the label or the id of the label
|
|
1834
1797
|
* @returns StepLabelResultType or undefined.
|
|
1835
1798
|
* @example
|
|
1836
1799
|
* ```typescript
|
|
1837
|
-
* GameStepManager.jumpLabel(
|
|
1800
|
+
* GameStepManager.jumpLabel(startLabel, yourParams).then((result) => {
|
|
1838
1801
|
* if (result) {
|
|
1839
1802
|
* // your code
|
|
1840
1803
|
* }
|
|
@@ -1843,7 +1806,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1843
1806
|
* @example
|
|
1844
1807
|
* ```typescript
|
|
1845
1808
|
* // if you use it in a step label you should return the result.
|
|
1846
|
-
* return GameStepManager.jumpLabel(
|
|
1809
|
+
* return GameStepManager.jumpLabel(startLabel).then((result) => {
|
|
1847
1810
|
* return result
|
|
1848
1811
|
* })
|
|
1849
1812
|
* ```
|
|
@@ -1851,15 +1814,24 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1851
1814
|
static jumpLabel(label, props) {
|
|
1852
1815
|
return __async(this, null, function* () {
|
|
1853
1816
|
_GameStepManager.closeAllLabels();
|
|
1817
|
+
let labelId;
|
|
1818
|
+
if (typeof label === "string") {
|
|
1819
|
+
labelId = label;
|
|
1820
|
+
} else {
|
|
1821
|
+
labelId = label.id;
|
|
1822
|
+
if (typeof label.choiseIndex === "number") {
|
|
1823
|
+
label.choiseIndex;
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1854
1826
|
try {
|
|
1855
|
-
if (
|
|
1827
|
+
if (labelId === CLOSE_LABEL_ID) {
|
|
1856
1828
|
return _GameStepManager.runNextStep(props);
|
|
1857
1829
|
}
|
|
1858
|
-
|
|
1859
|
-
|
|
1830
|
+
let tempLabel = getLabelById(labelId);
|
|
1831
|
+
if (!tempLabel) {
|
|
1832
|
+
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
1860
1833
|
}
|
|
1861
|
-
|
|
1862
|
-
_GameStepManager.pushNewLabel(labelName);
|
|
1834
|
+
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
1863
1835
|
} catch (e) {
|
|
1864
1836
|
console.error("[Pixi'VN] Error jumping label", e);
|
|
1865
1837
|
return;
|
|
@@ -1873,14 +1845,14 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1873
1845
|
* @returns StepLabelResultType or undefined.
|
|
1874
1846
|
* @example
|
|
1875
1847
|
* ```typescript
|
|
1876
|
-
* GameStepManager.
|
|
1848
|
+
* GameStepManager.closeChoiceMenu(yourParams).then((result) => {
|
|
1877
1849
|
* if (result) {
|
|
1878
1850
|
* // your code
|
|
1879
1851
|
* }
|
|
1880
1852
|
* })
|
|
1881
1853
|
* ```
|
|
1882
1854
|
*/
|
|
1883
|
-
static
|
|
1855
|
+
static closeChoiceMenu(props) {
|
|
1884
1856
|
return __async(this, null, function* () {
|
|
1885
1857
|
return _GameStepManager.runNextStep(props);
|
|
1886
1858
|
});
|