@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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var deepDiff = require('deep-diff');
|
|
4
|
-
var pixi_js = require('pixi.js');
|
|
5
4
|
var sha1 = require('crypto-js/sha1');
|
|
5
|
+
var pixi_js = require('pixi.js');
|
|
6
6
|
|
|
7
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
8
|
|
|
@@ -57,6 +57,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
57
57
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
58
58
|
});
|
|
59
59
|
};
|
|
60
|
+
function getStepSha1(step) {
|
|
61
|
+
let sha1String = sha1__default.default(step.toString().toLocaleLowerCase());
|
|
62
|
+
return sha1String.toString();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// src/classes/CloseLabel.ts
|
|
66
|
+
var CLOSE_LABEL_ID = "__close-label-id__";
|
|
60
67
|
|
|
61
68
|
// src/functions/ExportUtility.ts
|
|
62
69
|
function createExportableElement(element) {
|
|
@@ -1248,66 +1255,16 @@ _GameWindowManager._currentTickers = [];
|
|
|
1248
1255
|
_GameWindowManager._currentTickersSteps = {};
|
|
1249
1256
|
_GameWindowManager.currentTickersTimeouts = {};
|
|
1250
1257
|
var GameWindowManager = _GameWindowManager;
|
|
1251
|
-
function getStepSha1(step) {
|
|
1252
|
-
let sha1String = sha1__default.default(step.toString().toLocaleLowerCase());
|
|
1253
|
-
return sha1String.toString();
|
|
1254
|
-
}
|
|
1255
|
-
function checkIfStepsIsEqual(step1, step2) {
|
|
1256
|
-
return step1 === step2;
|
|
1257
|
-
}
|
|
1258
|
-
|
|
1259
|
-
// src/classes/Label.ts
|
|
1260
|
-
var Label = class {
|
|
1261
|
-
/**
|
|
1262
|
-
* Get the steps of the label.
|
|
1263
|
-
* This class should be extended and the steps method should be overridden.
|
|
1264
|
-
* Every time you update this list will also be updated when the other game versions load.
|
|
1265
|
-
*/
|
|
1266
|
-
get steps() {
|
|
1267
|
-
throw new Error("[Pixi'VN] The method Label.steps must be overridden");
|
|
1268
|
-
}
|
|
1269
|
-
/**
|
|
1270
|
-
* Get the corresponding steps number
|
|
1271
|
-
* @param externalSteps
|
|
1272
|
-
* @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
|
|
1273
|
-
*/
|
|
1274
|
-
getCorrespondingStepsNumber(externalSteps) {
|
|
1275
|
-
if (externalSteps.length === 0) {
|
|
1276
|
-
return 0;
|
|
1277
|
-
}
|
|
1278
|
-
let res = 0;
|
|
1279
|
-
externalSteps.forEach((step, index) => {
|
|
1280
|
-
if (checkIfStepsIsEqual(step, this.steps[index])) {
|
|
1281
|
-
res = index;
|
|
1282
|
-
}
|
|
1283
|
-
});
|
|
1284
|
-
return res;
|
|
1285
|
-
}
|
|
1286
|
-
};
|
|
1287
|
-
|
|
1288
|
-
// src/classes/CloseLabel.ts
|
|
1289
|
-
var CloseLabel = class extends Label {
|
|
1290
|
-
};
|
|
1291
1258
|
|
|
1292
1259
|
// src/decorators/LabelDecorator.ts
|
|
1293
1260
|
var registeredLabels = {};
|
|
1294
|
-
function
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
console.error(`[Pixi'VN] Label ${labelName} not found`);
|
|
1299
|
-
return;
|
|
1300
|
-
}
|
|
1301
|
-
let label = new labelType();
|
|
1302
|
-
let step = label.steps;
|
|
1303
|
-
if (step.length = 0) {
|
|
1304
|
-
console.warn(`[Pixi'VN] Label ${labelName} has no steps`);
|
|
1305
|
-
}
|
|
1306
|
-
return label;
|
|
1307
|
-
} catch (e) {
|
|
1308
|
-
console.error(`[Pixi'VN] Error while getting Label ${labelName}`, e);
|
|
1261
|
+
function getLabelById(id) {
|
|
1262
|
+
let label = registeredLabels[id];
|
|
1263
|
+
if (!label) {
|
|
1264
|
+
console.error(`[Pixi'VN] Label ${id} not found`);
|
|
1309
1265
|
return;
|
|
1310
1266
|
}
|
|
1267
|
+
return label;
|
|
1311
1268
|
}
|
|
1312
1269
|
|
|
1313
1270
|
// src/functions/DialogueUtility.ts
|
|
@@ -1554,7 +1511,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1554
1511
|
*/
|
|
1555
1512
|
static get currentLabel() {
|
|
1556
1513
|
if (_GameStepManager.currentLabelId) {
|
|
1557
|
-
return
|
|
1514
|
+
return getLabelById(_GameStepManager.currentLabelId);
|
|
1558
1515
|
}
|
|
1559
1516
|
}
|
|
1560
1517
|
static get currentLabelStepIndex() {
|
|
@@ -1575,7 +1532,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1575
1532
|
return true;
|
|
1576
1533
|
} else {
|
|
1577
1534
|
this.openedLabels.forEach((item) => {
|
|
1578
|
-
let label =
|
|
1535
|
+
let label = getLabelById(item.label);
|
|
1579
1536
|
if (label && label.steps.length > item.currentStepIndex) {
|
|
1580
1537
|
return false;
|
|
1581
1538
|
}
|
|
@@ -1668,9 +1625,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1668
1625
|
* @param label The label to add to the history.
|
|
1669
1626
|
*/
|
|
1670
1627
|
static pushNewLabel(label) {
|
|
1671
|
-
let currentLabel =
|
|
1628
|
+
let currentLabel = getLabelById(label);
|
|
1672
1629
|
if (!currentLabel) {
|
|
1673
|
-
throw new Error(
|
|
1630
|
+
throw new Error(`[Pixi'VN] Label ${label} not found`);
|
|
1674
1631
|
}
|
|
1675
1632
|
_GameStepManager._openedLabels.push({
|
|
1676
1633
|
label,
|
|
@@ -1687,7 +1644,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1687
1644
|
return;
|
|
1688
1645
|
}
|
|
1689
1646
|
if (!_GameStepManager.currentLabel) {
|
|
1690
|
-
console.error("[Pixi'VN]
|
|
1647
|
+
console.error("[Pixi'VN] currentLabel not found");
|
|
1691
1648
|
return;
|
|
1692
1649
|
}
|
|
1693
1650
|
_GameStepManager._openedLabels.pop();
|
|
@@ -1759,7 +1716,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1759
1716
|
}
|
|
1760
1717
|
let currentLabel = _GameStepManager.currentLabel;
|
|
1761
1718
|
if (!currentLabel) {
|
|
1762
|
-
console.error("[Pixi'VN]
|
|
1719
|
+
console.error("[Pixi'VN] currentLabel not found");
|
|
1763
1720
|
return;
|
|
1764
1721
|
}
|
|
1765
1722
|
let n = currentLabel.steps.length;
|
|
@@ -1780,12 +1737,12 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1780
1737
|
/**
|
|
1781
1738
|
* Execute the label and add it to the history.
|
|
1782
1739
|
* Is a call function in Ren'Py.
|
|
1783
|
-
* @param label The label to execute
|
|
1740
|
+
* @param label The label to execute or the id of the label
|
|
1784
1741
|
* @param props The props to pass to the label.
|
|
1785
1742
|
* @returns StepLabelResultType or undefined.
|
|
1786
1743
|
* @example
|
|
1787
1744
|
* ```typescript
|
|
1788
|
-
* GameStepManager.callLabel(
|
|
1745
|
+
* GameStepManager.callLabel(startLabel, yourParams).then((result) => {
|
|
1789
1746
|
* if (result) {
|
|
1790
1747
|
* // your code
|
|
1791
1748
|
* }
|
|
@@ -1794,7 +1751,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1794
1751
|
* @example
|
|
1795
1752
|
* ```typescript
|
|
1796
1753
|
* // if you use it in a step label you should return the result.
|
|
1797
|
-
* return GameStepManager.callLabel(
|
|
1754
|
+
* return GameStepManager.callLabel(startLabel).then((result) => {
|
|
1798
1755
|
* return result
|
|
1799
1756
|
* })
|
|
1800
1757
|
* ```
|
|
@@ -1802,16 +1759,24 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1802
1759
|
static callLabel(label, props) {
|
|
1803
1760
|
return __async(this, null, function* () {
|
|
1804
1761
|
let choiseMade = void 0;
|
|
1762
|
+
let labelId;
|
|
1763
|
+
if (typeof label === "string") {
|
|
1764
|
+
labelId = label;
|
|
1765
|
+
} else {
|
|
1766
|
+
labelId = label.id;
|
|
1767
|
+
if (typeof label.choiseIndex === "number") {
|
|
1768
|
+
choiseMade = label.choiseIndex;
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1805
1771
|
try {
|
|
1806
|
-
if (
|
|
1772
|
+
if (labelId === CLOSE_LABEL_ID) {
|
|
1807
1773
|
return _GameStepManager.runNextStep(props);
|
|
1808
1774
|
}
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1775
|
+
let tempLabel = getLabelById(labelId);
|
|
1776
|
+
if (!tempLabel) {
|
|
1777
|
+
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
1812
1778
|
}
|
|
1813
|
-
|
|
1814
|
-
_GameStepManager.pushNewLabel(labelName);
|
|
1779
|
+
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
1815
1780
|
} catch (e) {
|
|
1816
1781
|
console.error("[Pixi'VN] Error calling label", e);
|
|
1817
1782
|
return;
|
|
@@ -1823,11 +1788,11 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1823
1788
|
* Execute the label, close all labels and add them to the history.
|
|
1824
1789
|
* Is a jump function in Ren'Py.
|
|
1825
1790
|
* @param label The label to execute.
|
|
1826
|
-
* @param props The props to pass to the label
|
|
1791
|
+
* @param props The props to pass to the label or the id of the label
|
|
1827
1792
|
* @returns StepLabelResultType or undefined.
|
|
1828
1793
|
* @example
|
|
1829
1794
|
* ```typescript
|
|
1830
|
-
* GameStepManager.jumpLabel(
|
|
1795
|
+
* GameStepManager.jumpLabel(startLabel, yourParams).then((result) => {
|
|
1831
1796
|
* if (result) {
|
|
1832
1797
|
* // your code
|
|
1833
1798
|
* }
|
|
@@ -1836,7 +1801,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1836
1801
|
* @example
|
|
1837
1802
|
* ```typescript
|
|
1838
1803
|
* // if you use it in a step label you should return the result.
|
|
1839
|
-
* return GameStepManager.jumpLabel(
|
|
1804
|
+
* return GameStepManager.jumpLabel(startLabel).then((result) => {
|
|
1840
1805
|
* return result
|
|
1841
1806
|
* })
|
|
1842
1807
|
* ```
|
|
@@ -1844,15 +1809,24 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1844
1809
|
static jumpLabel(label, props) {
|
|
1845
1810
|
return __async(this, null, function* () {
|
|
1846
1811
|
_GameStepManager.closeAllLabels();
|
|
1812
|
+
let labelId;
|
|
1813
|
+
if (typeof label === "string") {
|
|
1814
|
+
labelId = label;
|
|
1815
|
+
} else {
|
|
1816
|
+
labelId = label.id;
|
|
1817
|
+
if (typeof label.choiseIndex === "number") {
|
|
1818
|
+
label.choiseIndex;
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1847
1821
|
try {
|
|
1848
|
-
if (
|
|
1822
|
+
if (labelId === CLOSE_LABEL_ID) {
|
|
1849
1823
|
return _GameStepManager.runNextStep(props);
|
|
1850
1824
|
}
|
|
1851
|
-
|
|
1852
|
-
|
|
1825
|
+
let tempLabel = getLabelById(labelId);
|
|
1826
|
+
if (!tempLabel) {
|
|
1827
|
+
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
1853
1828
|
}
|
|
1854
|
-
|
|
1855
|
-
_GameStepManager.pushNewLabel(labelName);
|
|
1829
|
+
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
1856
1830
|
} catch (e) {
|
|
1857
1831
|
console.error("[Pixi'VN] Error jumping label", e);
|
|
1858
1832
|
return;
|
|
@@ -1866,14 +1840,14 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1866
1840
|
* @returns StepLabelResultType or undefined.
|
|
1867
1841
|
* @example
|
|
1868
1842
|
* ```typescript
|
|
1869
|
-
* GameStepManager.
|
|
1843
|
+
* GameStepManager.closeChoiceMenu(yourParams).then((result) => {
|
|
1870
1844
|
* if (result) {
|
|
1871
1845
|
* // your code
|
|
1872
1846
|
* }
|
|
1873
1847
|
* })
|
|
1874
1848
|
* ```
|
|
1875
1849
|
*/
|
|
1876
|
-
static
|
|
1850
|
+
static closeChoiceMenu(props) {
|
|
1877
1851
|
return __async(this, null, function* () {
|
|
1878
1852
|
return _GameStepManager.runNextStep(props);
|
|
1879
1853
|
});
|