@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
package/dist/managers/index.mjs
CHANGED
|
@@ -51,106 +51,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
51
51
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
52
52
|
});
|
|
53
53
|
};
|
|
54
|
-
|
|
55
|
-
// src/types/PauseType.ts
|
|
56
|
-
var PauseValueType = "pause";
|
|
57
|
-
|
|
58
|
-
// src/types/RepeatType.ts
|
|
59
|
-
var Repeat = "repeat";
|
|
60
54
|
function getStepSha1(step) {
|
|
61
55
|
let sha1String = sha1(step.toString().toLocaleLowerCase());
|
|
62
56
|
return sha1String.toString();
|
|
63
57
|
}
|
|
64
|
-
function checkIfStepsIsEqual(step1, step2) {
|
|
65
|
-
return step1 === step2;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// src/classes/Label.ts
|
|
69
|
-
var Label = class {
|
|
70
|
-
/**
|
|
71
|
-
* Get the steps of the label.
|
|
72
|
-
* This class should be extended and the steps method should be overridden.
|
|
73
|
-
* Every time you update this list will also be updated when the other game versions load.
|
|
74
|
-
*/
|
|
75
|
-
get steps() {
|
|
76
|
-
throw new Error("[Pixi'VN] The method Label.steps must be overridden");
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Get the corresponding steps number
|
|
80
|
-
* @param externalSteps
|
|
81
|
-
* @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
|
|
82
|
-
*/
|
|
83
|
-
getCorrespondingStepsNumber(externalSteps) {
|
|
84
|
-
if (externalSteps.length === 0) {
|
|
85
|
-
return 0;
|
|
86
|
-
}
|
|
87
|
-
let res = 0;
|
|
88
|
-
externalSteps.forEach((step, index) => {
|
|
89
|
-
if (checkIfStepsIsEqual(step, this.steps[index])) {
|
|
90
|
-
res = index;
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
return res;
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
58
|
|
|
97
59
|
// src/classes/CloseLabel.ts
|
|
98
|
-
var
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
// src/decorators/LabelDecorator.ts
|
|
102
|
-
var registeredLabels = {};
|
|
103
|
-
function getLabelInstanceByClassName(labelName) {
|
|
104
|
-
try {
|
|
105
|
-
let labelType = registeredLabels[labelName];
|
|
106
|
-
if (!labelType) {
|
|
107
|
-
console.error(`[Pixi'VN] Label ${labelName} not found`);
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
let label = new labelType();
|
|
111
|
-
let step = label.steps;
|
|
112
|
-
if (step.length = 0) {
|
|
113
|
-
console.warn(`[Pixi'VN] Label ${labelName} has no steps`);
|
|
114
|
-
}
|
|
115
|
-
return label;
|
|
116
|
-
} catch (e) {
|
|
117
|
-
console.error(`[Pixi'VN] Error while getting Label ${labelName}`, e);
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// src/functions/DialogueUtility.ts
|
|
123
|
-
function getDialogue() {
|
|
124
|
-
return GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// src/decorators/CanvasElementDecorator.ts
|
|
128
|
-
var registeredCanvasElement = {};
|
|
129
|
-
function getCanvasElementInstanceByClassName(canvasName) {
|
|
130
|
-
try {
|
|
131
|
-
let eventType = registeredCanvasElement[canvasName];
|
|
132
|
-
if (!eventType) {
|
|
133
|
-
if (canvasName === "CanvasContainer") {
|
|
134
|
-
eventType = CanvasContainer;
|
|
135
|
-
} else if (canvasName === "CanvasImage") {
|
|
136
|
-
eventType = CanvasImage;
|
|
137
|
-
} else if (canvasName === "CanvasSprite") {
|
|
138
|
-
eventType = CanvasSprite;
|
|
139
|
-
} else if (canvasName === "CanvasText") {
|
|
140
|
-
eventType = CanvasText;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
if (!eventType) {
|
|
144
|
-
console.error(`[Pixi'VN] CanvasElement ${canvasName} not found`);
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
let canvasElement = new eventType();
|
|
148
|
-
return canvasElement;
|
|
149
|
-
} catch (e) {
|
|
150
|
-
console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasName}`, e);
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
60
|
+
var CLOSE_LABEL_ID = "__close-label-id__";
|
|
154
61
|
|
|
155
62
|
// src/functions/CanvasUtility.ts
|
|
156
63
|
function getTextureMemory(texture) {
|
|
@@ -587,29 +494,33 @@ function setMemoryText(element, memory) {
|
|
|
587
494
|
}
|
|
588
495
|
}
|
|
589
496
|
|
|
590
|
-
// src/
|
|
591
|
-
var
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
497
|
+
// src/decorators/CanvasElementDecorator.ts
|
|
498
|
+
var registeredCanvasElement = {};
|
|
499
|
+
function getCanvasElementInstanceByClassName(canvasName) {
|
|
500
|
+
try {
|
|
501
|
+
let eventType = registeredCanvasElement[canvasName];
|
|
502
|
+
if (!eventType) {
|
|
503
|
+
if (canvasName === "CanvasContainer") {
|
|
504
|
+
eventType = CanvasContainer;
|
|
505
|
+
} else if (canvasName === "CanvasImage") {
|
|
506
|
+
eventType = CanvasImage;
|
|
507
|
+
} else if (canvasName === "CanvasSprite") {
|
|
508
|
+
eventType = CanvasSprite;
|
|
509
|
+
} else if (canvasName === "CanvasText") {
|
|
510
|
+
eventType = CanvasText;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
if (!eventType) {
|
|
514
|
+
console.error(`[Pixi'VN] CanvasElement ${canvasName} not found`);
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
let canvasElement = new eventType();
|
|
518
|
+
return canvasElement;
|
|
519
|
+
} catch (e) {
|
|
520
|
+
console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasName}`, e);
|
|
521
|
+
return;
|
|
611
522
|
}
|
|
612
|
-
}
|
|
523
|
+
}
|
|
613
524
|
|
|
614
525
|
// src/decorators/TickerDecorator.ts
|
|
615
526
|
var registeredTickers = {};
|
|
@@ -638,7 +549,51 @@ function geTickerInstanceByClassName(tickerName, args, duration, priority) {
|
|
|
638
549
|
}
|
|
639
550
|
}
|
|
640
551
|
|
|
641
|
-
// src/
|
|
552
|
+
// src/types/PauseType.ts
|
|
553
|
+
var PauseValueType = "pause";
|
|
554
|
+
|
|
555
|
+
// src/types/RepeatType.ts
|
|
556
|
+
var Repeat = "repeat";
|
|
557
|
+
|
|
558
|
+
// src/decorators/LabelDecorator.ts
|
|
559
|
+
var registeredLabels = {};
|
|
560
|
+
function getLabelById(id) {
|
|
561
|
+
let label = registeredLabels[id];
|
|
562
|
+
if (!label) {
|
|
563
|
+
console.error(`[Pixi'VN] Label ${id} not found`);
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
return label;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
// src/functions/DialogueUtility.ts
|
|
570
|
+
function getDialogue() {
|
|
571
|
+
return GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
// src/classes/ticker/TickerBase.ts
|
|
575
|
+
var TickerBase = class {
|
|
576
|
+
/**
|
|
577
|
+
* @param args The arguments that you want to pass to the ticker.
|
|
578
|
+
* @param duration The duration of the ticker. If is undefined, the ticker will be called every frame.
|
|
579
|
+
* @param priority The priority of the ticker. If is undefined, the priority will be UPDATE_PRIORITY.NORMAL.
|
|
580
|
+
*/
|
|
581
|
+
constructor(args, duration, priority) {
|
|
582
|
+
this.args = args;
|
|
583
|
+
this.duration = duration;
|
|
584
|
+
this.priority = priority;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* The method that will be called every frame.
|
|
588
|
+
* This method should be overridden and you can use GameWindowManager.addCanvasElement() to get the canvas element of the canvas, and edit them.
|
|
589
|
+
* @param t The ticker that is calling this method
|
|
590
|
+
* @param args The arguments that you passed when you added the ticker
|
|
591
|
+
* @param tags The tags of the canvas elements that are connected to this ticker
|
|
592
|
+
*/
|
|
593
|
+
fn(_t, _args, _tags) {
|
|
594
|
+
throw new Error("[Pixi'VN] The method TickerBase.fn() must be overridden");
|
|
595
|
+
}
|
|
596
|
+
};
|
|
642
597
|
var TickerFadeAlpha = class extends TickerBase {
|
|
643
598
|
/**
|
|
644
599
|
* The method that will be called every frame to fade the alpha of the canvas element of the canvas.
|
|
@@ -1552,7 +1507,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1552
1507
|
*/
|
|
1553
1508
|
static get currentLabel() {
|
|
1554
1509
|
if (_GameStepManager.currentLabelId) {
|
|
1555
|
-
return
|
|
1510
|
+
return getLabelById(_GameStepManager.currentLabelId);
|
|
1556
1511
|
}
|
|
1557
1512
|
}
|
|
1558
1513
|
static get currentLabelStepIndex() {
|
|
@@ -1573,7 +1528,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1573
1528
|
return true;
|
|
1574
1529
|
} else {
|
|
1575
1530
|
this.openedLabels.forEach((item) => {
|
|
1576
|
-
let label =
|
|
1531
|
+
let label = getLabelById(item.label);
|
|
1577
1532
|
if (label && label.steps.length > item.currentStepIndex) {
|
|
1578
1533
|
return false;
|
|
1579
1534
|
}
|
|
@@ -1666,9 +1621,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1666
1621
|
* @param label The label to add to the history.
|
|
1667
1622
|
*/
|
|
1668
1623
|
static pushNewLabel(label) {
|
|
1669
|
-
let currentLabel =
|
|
1624
|
+
let currentLabel = getLabelById(label);
|
|
1670
1625
|
if (!currentLabel) {
|
|
1671
|
-
throw new Error(
|
|
1626
|
+
throw new Error(`[Pixi'VN] Label ${label} not found`);
|
|
1672
1627
|
}
|
|
1673
1628
|
_GameStepManager._openedLabels.push({
|
|
1674
1629
|
label,
|
|
@@ -1685,7 +1640,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1685
1640
|
return;
|
|
1686
1641
|
}
|
|
1687
1642
|
if (!_GameStepManager.currentLabel) {
|
|
1688
|
-
console.error("[Pixi'VN]
|
|
1643
|
+
console.error("[Pixi'VN] currentLabel not found");
|
|
1689
1644
|
return;
|
|
1690
1645
|
}
|
|
1691
1646
|
_GameStepManager._openedLabels.pop();
|
|
@@ -1757,7 +1712,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1757
1712
|
}
|
|
1758
1713
|
let currentLabel = _GameStepManager.currentLabel;
|
|
1759
1714
|
if (!currentLabel) {
|
|
1760
|
-
console.error("[Pixi'VN]
|
|
1715
|
+
console.error("[Pixi'VN] currentLabel not found");
|
|
1761
1716
|
return;
|
|
1762
1717
|
}
|
|
1763
1718
|
let n = currentLabel.steps.length;
|
|
@@ -1778,12 +1733,12 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1778
1733
|
/**
|
|
1779
1734
|
* Execute the label and add it to the history.
|
|
1780
1735
|
* Is a call function in Ren'Py.
|
|
1781
|
-
* @param label The label to execute
|
|
1736
|
+
* @param label The label to execute or the id of the label
|
|
1782
1737
|
* @param props The props to pass to the label.
|
|
1783
1738
|
* @returns StepLabelResultType or undefined.
|
|
1784
1739
|
* @example
|
|
1785
1740
|
* ```typescript
|
|
1786
|
-
* GameStepManager.callLabel(
|
|
1741
|
+
* GameStepManager.callLabel(startLabel, yourParams).then((result) => {
|
|
1787
1742
|
* if (result) {
|
|
1788
1743
|
* // your code
|
|
1789
1744
|
* }
|
|
@@ -1792,7 +1747,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1792
1747
|
* @example
|
|
1793
1748
|
* ```typescript
|
|
1794
1749
|
* // if you use it in a step label you should return the result.
|
|
1795
|
-
* return GameStepManager.callLabel(
|
|
1750
|
+
* return GameStepManager.callLabel(startLabel).then((result) => {
|
|
1796
1751
|
* return result
|
|
1797
1752
|
* })
|
|
1798
1753
|
* ```
|
|
@@ -1800,16 +1755,24 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1800
1755
|
static callLabel(label, props) {
|
|
1801
1756
|
return __async(this, null, function* () {
|
|
1802
1757
|
let choiseMade = void 0;
|
|
1758
|
+
let labelId;
|
|
1759
|
+
if (typeof label === "string") {
|
|
1760
|
+
labelId = label;
|
|
1761
|
+
} else {
|
|
1762
|
+
labelId = label.id;
|
|
1763
|
+
if (typeof label.choiseIndex === "number") {
|
|
1764
|
+
choiseMade = label.choiseIndex;
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1803
1767
|
try {
|
|
1804
|
-
if (
|
|
1768
|
+
if (labelId === CLOSE_LABEL_ID) {
|
|
1805
1769
|
return _GameStepManager.runNextStep(props);
|
|
1806
1770
|
}
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1771
|
+
let tempLabel = getLabelById(labelId);
|
|
1772
|
+
if (!tempLabel) {
|
|
1773
|
+
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
1810
1774
|
}
|
|
1811
|
-
|
|
1812
|
-
_GameStepManager.pushNewLabel(labelName);
|
|
1775
|
+
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
1813
1776
|
} catch (e) {
|
|
1814
1777
|
console.error("[Pixi'VN] Error calling label", e);
|
|
1815
1778
|
return;
|
|
@@ -1821,11 +1784,11 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1821
1784
|
* Execute the label, close all labels and add them to the history.
|
|
1822
1785
|
* Is a jump function in Ren'Py.
|
|
1823
1786
|
* @param label The label to execute.
|
|
1824
|
-
* @param props The props to pass to the label
|
|
1787
|
+
* @param props The props to pass to the label or the id of the label
|
|
1825
1788
|
* @returns StepLabelResultType or undefined.
|
|
1826
1789
|
* @example
|
|
1827
1790
|
* ```typescript
|
|
1828
|
-
* GameStepManager.jumpLabel(
|
|
1791
|
+
* GameStepManager.jumpLabel(startLabel, yourParams).then((result) => {
|
|
1829
1792
|
* if (result) {
|
|
1830
1793
|
* // your code
|
|
1831
1794
|
* }
|
|
@@ -1834,7 +1797,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1834
1797
|
* @example
|
|
1835
1798
|
* ```typescript
|
|
1836
1799
|
* // if you use it in a step label you should return the result.
|
|
1837
|
-
* return GameStepManager.jumpLabel(
|
|
1800
|
+
* return GameStepManager.jumpLabel(startLabel).then((result) => {
|
|
1838
1801
|
* return result
|
|
1839
1802
|
* })
|
|
1840
1803
|
* ```
|
|
@@ -1842,15 +1805,24 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1842
1805
|
static jumpLabel(label, props) {
|
|
1843
1806
|
return __async(this, null, function* () {
|
|
1844
1807
|
_GameStepManager.closeAllLabels();
|
|
1808
|
+
let labelId;
|
|
1809
|
+
if (typeof label === "string") {
|
|
1810
|
+
labelId = label;
|
|
1811
|
+
} else {
|
|
1812
|
+
labelId = label.id;
|
|
1813
|
+
if (typeof label.choiseIndex === "number") {
|
|
1814
|
+
label.choiseIndex;
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1845
1817
|
try {
|
|
1846
|
-
if (
|
|
1818
|
+
if (labelId === CLOSE_LABEL_ID) {
|
|
1847
1819
|
return _GameStepManager.runNextStep(props);
|
|
1848
1820
|
}
|
|
1849
|
-
|
|
1850
|
-
|
|
1821
|
+
let tempLabel = getLabelById(labelId);
|
|
1822
|
+
if (!tempLabel) {
|
|
1823
|
+
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
1851
1824
|
}
|
|
1852
|
-
|
|
1853
|
-
_GameStepManager.pushNewLabel(labelName);
|
|
1825
|
+
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
1854
1826
|
} catch (e) {
|
|
1855
1827
|
console.error("[Pixi'VN] Error jumping label", e);
|
|
1856
1828
|
return;
|
|
@@ -1864,14 +1836,14 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1864
1836
|
* @returns StepLabelResultType or undefined.
|
|
1865
1837
|
* @example
|
|
1866
1838
|
* ```typescript
|
|
1867
|
-
* GameStepManager.
|
|
1839
|
+
* GameStepManager.closeChoiceMenu(yourParams).then((result) => {
|
|
1868
1840
|
* if (result) {
|
|
1869
1841
|
* // your code
|
|
1870
1842
|
* }
|
|
1871
1843
|
* })
|
|
1872
1844
|
* ```
|
|
1873
1845
|
*/
|
|
1874
|
-
static
|
|
1846
|
+
static closeChoiceMenu(props) {
|
|
1875
1847
|
return __async(this, null, function* () {
|
|
1876
1848
|
return _GameStepManager.runNextStep(props);
|
|
1877
1849
|
});
|