@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/classes/index.mjs
CHANGED
|
@@ -64,13 +64,31 @@ function checkIfStepsIsEqual(step1, step2) {
|
|
|
64
64
|
|
|
65
65
|
// src/classes/Label.ts
|
|
66
66
|
var Label = class {
|
|
67
|
+
/**
|
|
68
|
+
* @param id is the id of the label
|
|
69
|
+
* @param steps is the list of steps that the label will perform
|
|
70
|
+
* @param onStepRun is a function that will be executed before any step is executed, is useful for example to make sure all images used have been cached
|
|
71
|
+
* @param choiseIndex is the index of the choice that the label will perform
|
|
72
|
+
*/
|
|
73
|
+
constructor(id, steps, onStepRun, choiseIndex) {
|
|
74
|
+
this._id = id;
|
|
75
|
+
this._steps = steps;
|
|
76
|
+
this._onStepRun = onStepRun;
|
|
77
|
+
this._choiseIndex = choiseIndex;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get the id of the label
|
|
81
|
+
*/
|
|
82
|
+
get id() {
|
|
83
|
+
return this._id;
|
|
84
|
+
}
|
|
67
85
|
/**
|
|
68
86
|
* Get the steps of the label.
|
|
69
87
|
* This class should be extended and the steps method should be overridden.
|
|
70
88
|
* Every time you update this list will also be updated when the other game versions load.
|
|
71
89
|
*/
|
|
72
90
|
get steps() {
|
|
73
|
-
|
|
91
|
+
return this._steps;
|
|
74
92
|
}
|
|
75
93
|
/**
|
|
76
94
|
* Get the corresponding steps number
|
|
@@ -89,62 +107,34 @@ var Label = class {
|
|
|
89
107
|
});
|
|
90
108
|
return res;
|
|
91
109
|
}
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
// src/types/PauseType.ts
|
|
95
|
-
var PauseValueType = "pause";
|
|
96
|
-
|
|
97
|
-
// src/types/RepeatType.ts
|
|
98
|
-
var Repeat = "repeat";
|
|
99
|
-
|
|
100
|
-
// src/classes/ChoiceMenuOption.ts
|
|
101
|
-
var ChoiceMenuOption = class {
|
|
102
110
|
/**
|
|
103
|
-
*
|
|
104
|
-
* @
|
|
105
|
-
* @
|
|
106
|
-
*
|
|
111
|
+
* Get the function that will be executed before any step is executed, is useful for example to make sure all images used have been cached
|
|
112
|
+
* @returns Promise<void> or void
|
|
113
|
+
* @example
|
|
114
|
+
* ```typescript
|
|
115
|
+
* newLabel("id", [], () => {
|
|
116
|
+
* Assets.load('path/to/image1.png')
|
|
117
|
+
* Assets.load('path/to/image2.png')
|
|
118
|
+
* })
|
|
119
|
+
* ```
|
|
107
120
|
*/
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
this.
|
|
113
|
-
this.text = text;
|
|
114
|
-
this.label = new label();
|
|
115
|
-
this.type = type;
|
|
116
|
-
if (props) {
|
|
117
|
-
this.props = props;
|
|
118
|
-
}
|
|
121
|
+
get onStepRun() {
|
|
122
|
+
return this._onStepRun;
|
|
123
|
+
}
|
|
124
|
+
get choiseIndex() {
|
|
125
|
+
return this._choiseIndex;
|
|
119
126
|
}
|
|
120
127
|
};
|
|
121
128
|
|
|
122
|
-
// src/decorators/
|
|
123
|
-
var
|
|
124
|
-
function
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (canvasName === "CanvasContainer") {
|
|
129
|
-
eventType = CanvasContainer;
|
|
130
|
-
} else if (canvasName === "CanvasImage") {
|
|
131
|
-
eventType = CanvasImage;
|
|
132
|
-
} else if (canvasName === "CanvasSprite") {
|
|
133
|
-
eventType = CanvasSprite;
|
|
134
|
-
} else if (canvasName === "CanvasText") {
|
|
135
|
-
eventType = CanvasText;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
if (!eventType) {
|
|
139
|
-
console.error(`[Pixi'VN] CanvasElement ${canvasName} not found`);
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
let canvasElement = new eventType();
|
|
143
|
-
return canvasElement;
|
|
144
|
-
} catch (e) {
|
|
145
|
-
console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasName}`, e);
|
|
129
|
+
// src/decorators/LabelDecorator.ts
|
|
130
|
+
var registeredLabels = {};
|
|
131
|
+
function getLabelById(id) {
|
|
132
|
+
let label = registeredLabels[id];
|
|
133
|
+
if (!label) {
|
|
134
|
+
console.error(`[Pixi'VN] Label ${id} not found`);
|
|
146
135
|
return;
|
|
147
136
|
}
|
|
137
|
+
return label;
|
|
148
138
|
}
|
|
149
139
|
|
|
150
140
|
// src/functions/CanvasUtility.ts
|
|
@@ -582,29 +572,33 @@ function setMemoryText(element, memory) {
|
|
|
582
572
|
}
|
|
583
573
|
}
|
|
584
574
|
|
|
585
|
-
// src/
|
|
586
|
-
var
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
575
|
+
// src/decorators/CanvasElementDecorator.ts
|
|
576
|
+
var registeredCanvasElement = {};
|
|
577
|
+
function getCanvasElementInstanceByClassName(canvasName) {
|
|
578
|
+
try {
|
|
579
|
+
let eventType = registeredCanvasElement[canvasName];
|
|
580
|
+
if (!eventType) {
|
|
581
|
+
if (canvasName === "CanvasContainer") {
|
|
582
|
+
eventType = CanvasContainer;
|
|
583
|
+
} else if (canvasName === "CanvasImage") {
|
|
584
|
+
eventType = CanvasImage;
|
|
585
|
+
} else if (canvasName === "CanvasSprite") {
|
|
586
|
+
eventType = CanvasSprite;
|
|
587
|
+
} else if (canvasName === "CanvasText") {
|
|
588
|
+
eventType = CanvasText;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
if (!eventType) {
|
|
592
|
+
console.error(`[Pixi'VN] CanvasElement ${canvasName} not found`);
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
let canvasElement = new eventType();
|
|
596
|
+
return canvasElement;
|
|
597
|
+
} catch (e) {
|
|
598
|
+
console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasName}`, e);
|
|
599
|
+
return;
|
|
606
600
|
}
|
|
607
|
-
}
|
|
601
|
+
}
|
|
608
602
|
|
|
609
603
|
// src/decorators/TickerDecorator.ts
|
|
610
604
|
var registeredTickers = {};
|
|
@@ -633,7 +627,65 @@ function geTickerInstanceByClassName(tickerName, args, duration, priority) {
|
|
|
633
627
|
}
|
|
634
628
|
}
|
|
635
629
|
|
|
636
|
-
// src/
|
|
630
|
+
// src/types/PauseType.ts
|
|
631
|
+
var PauseValueType = "pause";
|
|
632
|
+
|
|
633
|
+
// src/types/RepeatType.ts
|
|
634
|
+
var Repeat = "repeat";
|
|
635
|
+
|
|
636
|
+
// src/classes/ChoiceMenuOption.ts
|
|
637
|
+
var ChoiceMenuOption = class {
|
|
638
|
+
/**
|
|
639
|
+
* @param text Text to be displayed in the menu
|
|
640
|
+
* @param label Label to be opened when the option is selected or the id of the label
|
|
641
|
+
* @param type Type of the label to be opened. @default "call"
|
|
642
|
+
* @param props Properties to be passed to the label, when the label is called. it cannot contain functions or classes. @default {}
|
|
643
|
+
*/
|
|
644
|
+
constructor(text, label, type = "call", props) {
|
|
645
|
+
/**
|
|
646
|
+
* Properties to be passed to the label
|
|
647
|
+
*/
|
|
648
|
+
this.props = {};
|
|
649
|
+
if (typeof label === "string") {
|
|
650
|
+
let tLabel = getLabelById(label);
|
|
651
|
+
if (!tLabel) {
|
|
652
|
+
throw new Error(`[Pixi'VN] Label ${label} not found`);
|
|
653
|
+
} else {
|
|
654
|
+
label = tLabel;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
this.text = text;
|
|
658
|
+
this.label = label;
|
|
659
|
+
this.type = type;
|
|
660
|
+
if (props) {
|
|
661
|
+
this.props = props;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
|
|
666
|
+
// src/classes/ticker/TickerBase.ts
|
|
667
|
+
var TickerBase = class {
|
|
668
|
+
/**
|
|
669
|
+
* @param args The arguments that you want to pass to the ticker.
|
|
670
|
+
* @param duration The duration of the ticker. If is undefined, the ticker will be called every frame.
|
|
671
|
+
* @param priority The priority of the ticker. If is undefined, the priority will be UPDATE_PRIORITY.NORMAL.
|
|
672
|
+
*/
|
|
673
|
+
constructor(args, duration, priority) {
|
|
674
|
+
this.args = args;
|
|
675
|
+
this.duration = duration;
|
|
676
|
+
this.priority = priority;
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* The method that will be called every frame.
|
|
680
|
+
* This method should be overridden and you can use GameWindowManager.addCanvasElement() to get the canvas element of the canvas, and edit them.
|
|
681
|
+
* @param t The ticker that is calling this method
|
|
682
|
+
* @param args The arguments that you passed when you added the ticker
|
|
683
|
+
* @param tags The tags of the canvas elements that are connected to this ticker
|
|
684
|
+
*/
|
|
685
|
+
fn(_t, _args, _tags) {
|
|
686
|
+
throw new Error("[Pixi'VN] The method TickerBase.fn() must be overridden");
|
|
687
|
+
}
|
|
688
|
+
};
|
|
637
689
|
var TickerFadeAlpha = class extends TickerBase {
|
|
638
690
|
/**
|
|
639
691
|
* The method that will be called every frame to fade the alpha of the canvas element of the canvas.
|