@drincs/pixi-vn 0.6.4 → 0.6.6
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/README.md +56 -7
- package/dist/classes/CharacterBaseModel.js +99 -90
- package/dist/classes/CharacterBaseModel.js.map +1 -1
- package/dist/classes/CharacterBaseModel.mjs +99 -90
- package/dist/classes/CharacterBaseModel.mjs.map +1 -1
- package/dist/classes/ChoiceMenuOption.d.mts +71 -8
- package/dist/classes/ChoiceMenuOption.d.ts +71 -8
- package/dist/classes/ChoiceMenuOption.js +160 -77
- package/dist/classes/ChoiceMenuOption.js.map +1 -1
- package/dist/classes/ChoiceMenuOption.mjs +160 -77
- package/dist/classes/ChoiceMenuOption.mjs.map +1 -1
- package/dist/classes/CloseLabel.d.mts +3 -1
- package/dist/classes/CloseLabel.d.ts +3 -1
- package/dist/classes/CloseLabel.js +77 -32
- package/dist/classes/CloseLabel.js.map +1 -1
- package/dist/classes/CloseLabel.mjs +77 -32
- package/dist/classes/CloseLabel.mjs.map +1 -1
- package/dist/classes/Label.d.mts +6 -33
- package/dist/classes/Label.d.ts +6 -33
- package/dist/classes/Label.js +74 -31
- package/dist/classes/Label.js.map +1 -1
- package/dist/classes/Label.mjs +74 -31
- package/dist/classes/Label.mjs.map +1 -1
- package/dist/classes/LabelAbstract.d.mts +50 -0
- package/dist/classes/LabelAbstract.d.ts +50 -0
- package/dist/classes/LabelAbstract.js +100 -0
- package/dist/classes/LabelAbstract.js.map +1 -0
- package/dist/classes/LabelAbstract.mjs +98 -0
- package/dist/classes/LabelAbstract.mjs.map +1 -0
- package/dist/classes/LabelJson.d.mts +30 -0
- package/dist/classes/LabelJson.d.ts +30 -0
- package/dist/classes/LabelJson.js +2766 -0
- package/dist/classes/LabelJson.js.map +1 -0
- package/dist/classes/LabelJson.mjs +2760 -0
- package/dist/classes/LabelJson.mjs.map +1 -0
- package/dist/classes/StoredClassModel.js +42 -33
- package/dist/classes/StoredClassModel.js.map +1 -1
- package/dist/classes/StoredClassModel.mjs +42 -33
- package/dist/classes/StoredClassModel.mjs.map +1 -1
- package/dist/classes/canvas/CanvasContainer.js +2 -2
- package/dist/classes/canvas/CanvasContainer.js.map +1 -1
- package/dist/classes/canvas/CanvasContainer.mjs +2 -2
- package/dist/classes/canvas/CanvasContainer.mjs.map +1 -1
- package/dist/classes/canvas/CanvasImage.js +2 -2
- package/dist/classes/canvas/CanvasImage.js.map +1 -1
- package/dist/classes/canvas/CanvasImage.mjs +2 -2
- package/dist/classes/canvas/CanvasImage.mjs.map +1 -1
- package/dist/classes/canvas/CanvasSprite.js +2 -2
- package/dist/classes/canvas/CanvasSprite.js.map +1 -1
- package/dist/classes/canvas/CanvasSprite.mjs +2 -2
- package/dist/classes/canvas/CanvasSprite.mjs.map +1 -1
- package/dist/classes/canvas/CanvasText.js +2 -2
- package/dist/classes/canvas/CanvasText.js.map +1 -1
- package/dist/classes/canvas/CanvasText.mjs +2 -2
- package/dist/classes/canvas/CanvasText.mjs.map +1 -1
- package/dist/classes/canvas/index.js +2 -2
- package/dist/classes/canvas/index.js.map +1 -1
- package/dist/classes/canvas/index.mjs +2 -2
- package/dist/classes/canvas/index.mjs.map +1 -1
- package/dist/classes/index.d.mts +6 -1
- package/dist/classes/index.d.ts +6 -1
- package/dist/classes/index.js +945 -78
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +945 -79
- package/dist/classes/index.mjs.map +1 -1
- package/dist/classes/ticker/FadeAlphaTicker.js +42 -33
- package/dist/classes/ticker/FadeAlphaTicker.js.map +1 -1
- package/dist/classes/ticker/FadeAlphaTicker.mjs +42 -33
- package/dist/classes/ticker/FadeAlphaTicker.mjs.map +1 -1
- package/dist/classes/ticker/MoveTicker.d.mts +1 -0
- package/dist/classes/ticker/MoveTicker.d.ts +1 -0
- package/dist/classes/ticker/MoveTicker.js +42 -33
- package/dist/classes/ticker/MoveTicker.js.map +1 -1
- package/dist/classes/ticker/MoveTicker.mjs +42 -33
- package/dist/classes/ticker/MoveTicker.mjs.map +1 -1
- package/dist/classes/ticker/RotateTicker.d.mts +1 -0
- package/dist/classes/ticker/RotateTicker.d.ts +1 -0
- package/dist/classes/ticker/RotateTicker.js +42 -33
- package/dist/classes/ticker/RotateTicker.js.map +1 -1
- package/dist/classes/ticker/RotateTicker.mjs +42 -33
- package/dist/classes/ticker/RotateTicker.mjs.map +1 -1
- package/dist/classes/ticker/ZoomTicker.d.mts +1 -0
- package/dist/classes/ticker/ZoomTicker.d.ts +1 -0
- package/dist/classes/ticker/ZoomTicker.js +42 -33
- package/dist/classes/ticker/ZoomTicker.js.map +1 -1
- package/dist/classes/ticker/ZoomTicker.mjs +42 -33
- package/dist/classes/ticker/ZoomTicker.mjs.map +1 -1
- package/dist/classes/ticker/index.js +42 -33
- package/dist/classes/ticker/index.js.map +1 -1
- package/dist/classes/ticker/index.mjs +42 -33
- 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/CanvasElementDecorator.js +2 -2
- package/dist/decorators/CanvasElementDecorator.js.map +1 -1
- package/dist/decorators/CanvasElementDecorator.mjs +2 -2
- package/dist/decorators/CanvasElementDecorator.mjs.map +1 -1
- package/dist/decorators/LabelDecorator.d.mts +19 -5
- package/dist/decorators/LabelDecorator.d.ts +19 -5
- package/dist/decorators/LabelDecorator.js +102 -65
- package/dist/decorators/LabelDecorator.js.map +1 -1
- package/dist/decorators/LabelDecorator.mjs +102 -66
- package/dist/decorators/LabelDecorator.mjs.map +1 -1
- package/dist/decorators/index.d.mts +10 -2
- package/dist/decorators/index.d.ts +10 -2
- package/dist/decorators/index.js +98 -65
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +98 -65
- package/dist/decorators/index.mjs.map +1 -1
- package/dist/functions/CanvasUtility.js +2 -2
- package/dist/functions/CanvasUtility.js.map +1 -1
- package/dist/functions/CanvasUtility.mjs +2 -2
- package/dist/functions/CanvasUtility.mjs.map +1 -1
- package/dist/functions/DialogueUtility.d.mts +10 -8
- package/dist/functions/DialogueUtility.d.ts +10 -8
- package/dist/functions/DialogueUtility.js +268 -131
- package/dist/functions/DialogueUtility.js.map +1 -1
- package/dist/functions/DialogueUtility.mjs +268 -131
- package/dist/functions/DialogueUtility.mjs.map +1 -1
- package/dist/functions/FlagsUtility.js +42 -33
- package/dist/functions/FlagsUtility.js.map +1 -1
- package/dist/functions/FlagsUtility.mjs +42 -33
- package/dist/functions/FlagsUtility.mjs.map +1 -1
- package/dist/functions/GameUtility.js +42 -33
- package/dist/functions/GameUtility.js.map +1 -1
- package/dist/functions/GameUtility.mjs +42 -33
- package/dist/functions/GameUtility.mjs.map +1 -1
- package/dist/functions/ImageUtility.js +45 -36
- package/dist/functions/ImageUtility.js.map +1 -1
- package/dist/functions/ImageUtility.mjs +45 -36
- package/dist/functions/ImageUtility.mjs.map +1 -1
- package/dist/functions/Importer.d.mts +24 -0
- package/dist/functions/Importer.d.ts +24 -0
- package/dist/functions/Importer.js +2804 -0
- package/dist/functions/Importer.js.map +1 -0
- package/dist/functions/Importer.mjs +2798 -0
- package/dist/functions/Importer.mjs.map +1 -0
- package/dist/functions/SavesUtility.d.mts +5 -3
- package/dist/functions/SavesUtility.d.ts +5 -3
- package/dist/functions/SavesUtility.js +310 -145
- package/dist/functions/SavesUtility.js.map +1 -1
- package/dist/functions/SavesUtility.mjs +310 -145
- package/dist/functions/SavesUtility.mjs.map +1 -1
- package/dist/functions/TickerUtility.d.mts +2 -1
- package/dist/functions/TickerUtility.d.ts +2 -1
- package/dist/functions/TickerUtility.js +19 -15
- package/dist/functions/TickerUtility.js.map +1 -1
- package/dist/functions/TickerUtility.mjs +19 -15
- package/dist/functions/TickerUtility.mjs.map +1 -1
- package/dist/functions/index.d.mts +7 -2
- package/dist/functions/index.d.ts +7 -2
- package/dist/functions/index.js +364 -140
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs +364 -141
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +453 -219
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +453 -221
- package/dist/index.mjs.map +1 -1
- package/dist/interface/IHistoryStep.d.mts +3 -1
- package/dist/interface/IHistoryStep.d.ts +3 -1
- package/dist/interface/ISaveData.d.mts +3 -1
- package/dist/interface/ISaveData.d.ts +3 -1
- package/dist/interface/LabelProps.d.mts +38 -0
- package/dist/interface/LabelProps.d.ts +38 -0
- package/dist/interface/LabelProps.js +4 -0
- package/dist/interface/LabelProps.js.map +1 -0
- package/dist/interface/LabelProps.mjs +3 -0
- package/dist/interface/LabelProps.mjs.map +1 -0
- package/dist/interface/export/ExportedStep.d.mts +3 -1
- package/dist/interface/export/ExportedStep.d.ts +3 -1
- package/dist/interface/export/index.d.mts +3 -1
- package/dist/interface/export/index.d.ts +3 -1
- package/dist/interface/index.d.mts +3 -1
- package/dist/interface/index.d.ts +3 -1
- package/dist/labels/BaseCanvasElementTestLabel.d.mts +3 -1
- package/dist/labels/BaseCanvasElementTestLabel.d.ts +3 -1
- package/dist/labels/BaseCanvasElementTestLabel.js +303 -136
- package/dist/labels/BaseCanvasElementTestLabel.js.map +1 -1
- package/dist/labels/BaseCanvasElementTestLabel.mjs +304 -137
- package/dist/labels/BaseCanvasElementTestLabel.mjs.map +1 -1
- package/dist/labels/CanvasEventsTestLabel.d.mts +4 -5
- package/dist/labels/CanvasEventsTestLabel.d.ts +4 -5
- package/dist/labels/CanvasEventsTestLabel.js +313 -148
- package/dist/labels/CanvasEventsTestLabel.js.map +1 -1
- package/dist/labels/CanvasEventsTestLabel.mjs +314 -149
- package/dist/labels/CanvasEventsTestLabel.mjs.map +1 -1
- package/dist/labels/CustomTickerCanvasElementTestLabel.d.mts +3 -1
- package/dist/labels/CustomTickerCanvasElementTestLabel.d.ts +3 -1
- package/dist/labels/CustomTickerCanvasElementTestLabel.js +294 -133
- package/dist/labels/CustomTickerCanvasElementTestLabel.js.map +1 -1
- package/dist/labels/CustomTickerCanvasElementTestLabel.mjs +295 -134
- package/dist/labels/CustomTickerCanvasElementTestLabel.mjs.map +1 -1
- package/dist/labels/ImagesAnimationsTestLabel.d.mts +3 -1
- package/dist/labels/ImagesAnimationsTestLabel.d.ts +3 -1
- package/dist/labels/ImagesAnimationsTestLabel.js +298 -181
- package/dist/labels/ImagesAnimationsTestLabel.js.map +1 -1
- package/dist/labels/ImagesAnimationsTestLabel.mjs +299 -182
- package/dist/labels/ImagesAnimationsTestLabel.mjs.map +1 -1
- package/dist/labels/MarkdownTest.d.mts +3 -1
- package/dist/labels/MarkdownTest.d.ts +3 -1
- package/dist/labels/MarkdownTest.js +294 -133
- package/dist/labels/MarkdownTest.js.map +1 -1
- package/dist/labels/MarkdownTest.mjs +294 -133
- package/dist/labels/MarkdownTest.mjs.map +1 -1
- package/dist/labels/StartLabel.d.mts +3 -1
- package/dist/labels/StartLabel.d.ts +3 -1
- package/dist/labels/StartLabel.js +360 -213
- package/dist/labels/StartLabel.js.map +1 -1
- package/dist/labels/StartLabel.mjs +361 -214
- package/dist/labels/StartLabel.mjs.map +1 -1
- package/dist/labels/StepLabelTest.d.mts +11 -0
- package/dist/labels/StepLabelTest.d.ts +11 -0
- package/dist/labels/StepLabelTest.js +2861 -0
- package/dist/labels/StepLabelTest.js.map +1 -0
- package/dist/labels/StepLabelTest.mjs +2855 -0
- package/dist/labels/StepLabelTest.mjs.map +1 -0
- package/dist/labels/TestConstant.js +43 -34
- package/dist/labels/TestConstant.js.map +1 -1
- package/dist/labels/TestConstant.mjs +43 -34
- package/dist/labels/TestConstant.mjs.map +1 -1
- package/dist/labels/index.d.mts +3 -1
- package/dist/labels/index.d.ts +3 -1
- package/dist/labels/index.js +360 -213
- package/dist/labels/index.js.map +1 -1
- package/dist/labels/index.mjs +361 -214
- package/dist/labels/index.mjs.map +1 -1
- package/dist/managers/StepManager.d.mts +10 -7
- package/dist/managers/StepManager.d.ts +10 -7
- package/dist/managers/StepManager.js +300 -139
- package/dist/managers/StepManager.js.map +1 -1
- package/dist/managers/StepManager.mjs +300 -139
- package/dist/managers/StepManager.mjs.map +1 -1
- package/dist/managers/WindowManager.js +2 -2
- package/dist/managers/WindowManager.js.map +1 -1
- package/dist/managers/WindowManager.mjs +2 -2
- package/dist/managers/WindowManager.mjs.map +1 -1
- package/dist/managers/index.d.mts +7 -5
- package/dist/managers/index.d.ts +7 -5
- package/dist/managers/index.js +300 -139
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/index.mjs +300 -139
- package/dist/managers/index.mjs.map +1 -1
- package/dist/types/ChoiceMenuOptionsType.d.mts +3 -1
- package/dist/types/ChoiceMenuOptionsType.d.ts +3 -1
- package/dist/types/LabelJsonType.d.mts +22 -0
- package/dist/types/LabelJsonType.d.ts +22 -0
- package/dist/types/LabelJsonType.js +4 -0
- package/dist/types/LabelJsonType.js.map +1 -0
- package/dist/types/LabelJsonType.mjs +3 -0
- package/dist/types/LabelJsonType.mjs.map +1 -0
- package/dist/types/StepLabelJsonType.d.mts +30 -0
- package/dist/types/StepLabelJsonType.d.ts +30 -0
- package/dist/types/StepLabelJsonType.js +4 -0
- package/dist/types/StepLabelJsonType.js.map +1 -0
- package/dist/types/StepLabelJsonType.mjs +3 -0
- package/dist/types/StepLabelJsonType.mjs.map +1 -0
- package/dist/types/index.d.mts +4 -0
- package/dist/types/index.d.ts +4 -0
- package/package.json +7 -6
|
@@ -64,19 +64,18 @@ function checkIfStepsIsEqual(step1, step2) {
|
|
|
64
64
|
return step1 === step2;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
// src/classes/
|
|
68
|
-
var
|
|
67
|
+
// src/classes/LabelAbstract.ts
|
|
68
|
+
var LabelAbstract = class {
|
|
69
69
|
/**
|
|
70
70
|
* @param id is the id of the label
|
|
71
|
-
* @param
|
|
72
|
-
* @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
|
|
73
|
-
* @param choiseIndex is the index of the choice that the label will perform
|
|
71
|
+
* @param props is the properties of the label
|
|
74
72
|
*/
|
|
75
|
-
constructor(id,
|
|
73
|
+
constructor(id, props) {
|
|
76
74
|
this._id = id;
|
|
77
|
-
this.
|
|
78
|
-
this.
|
|
79
|
-
this.
|
|
75
|
+
this._onStepStart = props == null ? void 0 : props.onStepStart;
|
|
76
|
+
this._onLoadStep = props == null ? void 0 : props.onLoadStep;
|
|
77
|
+
this._onStepEnd = props == null ? void 0 : props.onStepEnd;
|
|
78
|
+
this._choiseIndex = props == null ? void 0 : props.choiseIndex;
|
|
80
79
|
}
|
|
81
80
|
/**
|
|
82
81
|
* Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
|
|
@@ -84,17 +83,6 @@ var Label = class {
|
|
|
84
83
|
get id() {
|
|
85
84
|
return this._id;
|
|
86
85
|
}
|
|
87
|
-
/**
|
|
88
|
-
* Get the steps of the label.
|
|
89
|
-
* This class should be extended and the steps method should be overridden.
|
|
90
|
-
* Every time you update this list will also be updated when the other game versions load.
|
|
91
|
-
*/
|
|
92
|
-
get steps() {
|
|
93
|
-
if (typeof this._steps === "function") {
|
|
94
|
-
return this._steps();
|
|
95
|
-
}
|
|
96
|
-
return this._steps;
|
|
97
|
-
}
|
|
98
86
|
/**
|
|
99
87
|
* Get the corresponding steps number
|
|
100
88
|
* @param externalSteps
|
|
@@ -113,37 +101,75 @@ var Label = class {
|
|
|
113
101
|
return res;
|
|
114
102
|
}
|
|
115
103
|
/**
|
|
116
|
-
*
|
|
104
|
+
* Is a function that will be executed in {@link Label#onStepStart} and when the user goes back to it or when the user laods a save file.
|
|
117
105
|
* @returns Promise<void> or void
|
|
118
|
-
* @example
|
|
119
|
-
* ```typescript
|
|
120
|
-
* newLabel("id", [], () => {
|
|
121
|
-
* Assets.load('path/to/image1.png')
|
|
122
|
-
* Assets.load('path/to/image2.png')
|
|
123
|
-
* })
|
|
124
|
-
* ```
|
|
125
106
|
*/
|
|
126
|
-
get
|
|
127
|
-
return this
|
|
107
|
+
get onStepStart() {
|
|
108
|
+
return (stepIndex, label) => __async(this, null, function* () {
|
|
109
|
+
if (this._onLoadStep) {
|
|
110
|
+
yield this._onLoadStep(stepIndex, label);
|
|
111
|
+
}
|
|
112
|
+
if (this._onStepStart) {
|
|
113
|
+
return yield this._onStepStart(stepIndex, label);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Get the function that will be executed a old step is reloaded. A step is reloaded when the user goes back to it or when the user laods a save file.
|
|
119
|
+
* @returns Promise<void> or void
|
|
120
|
+
*/
|
|
121
|
+
get onLoadStep() {
|
|
122
|
+
return this._onLoadStep;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Is a function that will be executed when the step ends.
|
|
126
|
+
* @returns Promise<void> or void
|
|
127
|
+
*/
|
|
128
|
+
get onStepEnd() {
|
|
129
|
+
return this._onStepEnd;
|
|
128
130
|
}
|
|
129
131
|
get choiseIndex() {
|
|
130
132
|
return this._choiseIndex;
|
|
131
133
|
}
|
|
132
134
|
};
|
|
133
135
|
|
|
136
|
+
// src/classes/Label.ts
|
|
137
|
+
var Label = class extends LabelAbstract {
|
|
138
|
+
/**
|
|
139
|
+
* @param id is the id of the label
|
|
140
|
+
* @param steps is the list of steps that the label will perform
|
|
141
|
+
* @param props is the properties of the label
|
|
142
|
+
*/
|
|
143
|
+
constructor(id, steps, props) {
|
|
144
|
+
super(id, props);
|
|
145
|
+
this._steps = steps;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Get the steps of the label.
|
|
149
|
+
*/
|
|
150
|
+
get steps() {
|
|
151
|
+
if (typeof this._steps === "function") {
|
|
152
|
+
return this._steps();
|
|
153
|
+
}
|
|
154
|
+
return this._steps;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
134
158
|
// src/classes/CloseLabel.ts
|
|
135
159
|
var CLOSE_LABEL_ID = "__close-label-id__";
|
|
136
160
|
function newCloseLabel(choiseIndex) {
|
|
137
|
-
return new Label(CLOSE_LABEL_ID, [],
|
|
161
|
+
return new Label(CLOSE_LABEL_ID, [], {
|
|
162
|
+
choiseIndex
|
|
163
|
+
});
|
|
138
164
|
}
|
|
139
165
|
|
|
140
166
|
// src/decorators/LabelDecorator.ts
|
|
141
167
|
var registeredLabels = {};
|
|
142
|
-
function newLabel(id, steps,
|
|
168
|
+
function newLabel(id, steps, props) {
|
|
143
169
|
if (registeredLabels[id]) {
|
|
144
170
|
console.info(`[Pixi'VN] Label ${id} already exists, it will be overwritten`);
|
|
145
171
|
}
|
|
146
|
-
let label = new Label(id, steps,
|
|
172
|
+
let label = new Label(id, steps, props);
|
|
147
173
|
registeredLabels[id] = label;
|
|
148
174
|
return label;
|
|
149
175
|
}
|
|
@@ -232,8 +258,6 @@ function getMemoryContainer(element) {
|
|
|
232
258
|
};
|
|
233
259
|
}
|
|
234
260
|
function setMemoryContainer(element, memory) {
|
|
235
|
-
memory.width && (element.width = memory.width);
|
|
236
|
-
memory.height && (element.height = memory.height);
|
|
237
261
|
memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
|
|
238
262
|
memory.blendMode && (element.blendMode = memory.blendMode);
|
|
239
263
|
memory.tint && (element.tint = memory.tint);
|
|
@@ -266,6 +290,8 @@ function setMemoryContainer(element, memory) {
|
|
|
266
290
|
memory.interactive && (element.interactive = memory.interactive);
|
|
267
291
|
memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
|
|
268
292
|
memory.hitArea && (element.hitArea = memory.hitArea);
|
|
293
|
+
memory.width && (element.width = memory.width);
|
|
294
|
+
memory.height && (element.height = memory.height);
|
|
269
295
|
}
|
|
270
296
|
function getTexture(imageUrl) {
|
|
271
297
|
return __async(this, null, function* () {
|
|
@@ -687,29 +713,57 @@ var ChoiceMenuOption = class {
|
|
|
687
713
|
/**
|
|
688
714
|
* @param text Text to be displayed in the menu
|
|
689
715
|
* @param label Label to be opened when the option is selected or the id of the label
|
|
716
|
+
* @param props Properties to be passed to the label and olther parameters that you can use when get all the choice menu options. It be converted to a JSON string, so it cannot contain functions or classes.
|
|
690
717
|
* @param type Type of the label to be opened. @default "call"
|
|
691
|
-
* @param props Properties to be passed to the label, when the label is called. it cannot contain functions or classes. @default {}
|
|
692
718
|
*/
|
|
693
|
-
constructor(text, label, type = "call"
|
|
719
|
+
constructor(text, label, props, type = "call") {
|
|
694
720
|
/**
|
|
695
|
-
* Properties to be passed to the label
|
|
721
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
722
|
+
* @example
|
|
723
|
+
* ```tsx
|
|
724
|
+
* setChoiceMenuOptions([
|
|
725
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
726
|
+
* ])
|
|
727
|
+
* return <List>
|
|
728
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
729
|
+
* return (
|
|
730
|
+
* <ChoiceButton
|
|
731
|
+
* disabled={item.props.disabled}
|
|
732
|
+
* onClick={() => {
|
|
733
|
+
* afterSelectChoice(item)
|
|
734
|
+
* }}
|
|
735
|
+
* >
|
|
736
|
+
* {item.text}
|
|
737
|
+
* </ChoiceButton>
|
|
738
|
+
* )
|
|
739
|
+
* })}
|
|
740
|
+
* </List>
|
|
741
|
+
* ```
|
|
696
742
|
*/
|
|
697
743
|
this.props = {};
|
|
698
|
-
if (typeof label === "string") {
|
|
699
|
-
let tLabel = getLabelById(label);
|
|
700
|
-
if (!tLabel) {
|
|
701
|
-
throw new Error(`[Pixi'VN] Label ${label} not found`);
|
|
702
|
-
} else {
|
|
703
|
-
label = tLabel;
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
744
|
this.text = text;
|
|
707
|
-
this.
|
|
745
|
+
this._label = label;
|
|
708
746
|
this.type = type;
|
|
709
747
|
if (props) {
|
|
710
748
|
this.props = props;
|
|
711
749
|
}
|
|
712
750
|
}
|
|
751
|
+
/**
|
|
752
|
+
* Label to be opened when the option is selected
|
|
753
|
+
*/
|
|
754
|
+
get label() {
|
|
755
|
+
let label = this._label;
|
|
756
|
+
if (typeof label === "string") {
|
|
757
|
+
let res = getLabelById(label);
|
|
758
|
+
if (res) {
|
|
759
|
+
label = res;
|
|
760
|
+
} else {
|
|
761
|
+
console.error(`Label ${label} not found, so it will be closed`);
|
|
762
|
+
label = newCloseLabel();
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
return label;
|
|
766
|
+
}
|
|
713
767
|
};
|
|
714
768
|
var ChoiceMenuOptionClose = class {
|
|
715
769
|
/**
|
|
@@ -726,7 +780,27 @@ var ChoiceMenuOptionClose = class {
|
|
|
726
780
|
*/
|
|
727
781
|
this.type = Close;
|
|
728
782
|
/**
|
|
729
|
-
* Properties to be passed to the label
|
|
783
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
784
|
+
* @example
|
|
785
|
+
* ```tsx
|
|
786
|
+
* setChoiceMenuOptions([
|
|
787
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
788
|
+
* ])
|
|
789
|
+
* return <List>
|
|
790
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
791
|
+
* return (
|
|
792
|
+
* <ChoiceButton
|
|
793
|
+
* disabled={item.props.disabled}
|
|
794
|
+
* onClick={() => {
|
|
795
|
+
* afterSelectChoice(item)
|
|
796
|
+
* }}
|
|
797
|
+
* >
|
|
798
|
+
* {item.text}
|
|
799
|
+
* </ChoiceButton>
|
|
800
|
+
* )
|
|
801
|
+
* })}
|
|
802
|
+
* </List>
|
|
803
|
+
* ```
|
|
730
804
|
*/
|
|
731
805
|
this.props = {};
|
|
732
806
|
this.text = text;
|
|
@@ -784,21 +858,18 @@ function getChoiceMenuOptions() {
|
|
|
784
858
|
d.forEach((option, index) => {
|
|
785
859
|
if (option.type === Close) {
|
|
786
860
|
let itemLabel = newCloseLabel(index);
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
type: Close,
|
|
791
|
-
closeCurrentLabel: option.closeCurrentLabel,
|
|
792
|
-
props: {}
|
|
793
|
-
});
|
|
861
|
+
let choice = new ChoiceMenuOptionClose(option.text, option.closeCurrentLabel);
|
|
862
|
+
choice.label = itemLabel;
|
|
863
|
+
options.push(choice);
|
|
794
864
|
return;
|
|
795
865
|
}
|
|
796
866
|
let label = getLabelById(option.label);
|
|
797
867
|
if (label) {
|
|
798
|
-
let itemLabel = new Label(label.id, label.steps,
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
})
|
|
868
|
+
let itemLabel = new Label(label.id, label.steps, {
|
|
869
|
+
onStepStart: label.onStepStart,
|
|
870
|
+
choiseIndex: index
|
|
871
|
+
});
|
|
872
|
+
options.push(new ChoiceMenuOption(option.text, itemLabel, option.props, option.type));
|
|
802
873
|
}
|
|
803
874
|
});
|
|
804
875
|
return options;
|
|
@@ -886,8 +957,9 @@ FadeAlphaTicker = __decorateClass([
|
|
|
886
957
|
], FadeAlphaTicker);
|
|
887
958
|
|
|
888
959
|
// src/functions/TickerUtility.ts
|
|
889
|
-
function updateTickerProgression(args, propertyName, progression) {
|
|
890
|
-
|
|
960
|
+
function updateTickerProgression(args, propertyName, progression, valueConvert) {
|
|
961
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
962
|
+
if (args[propertyName] === void 0 || !progression || args[propertyName] === limit) {
|
|
891
963
|
return;
|
|
892
964
|
}
|
|
893
965
|
if (typeof args[propertyName] === "number") {
|
|
@@ -906,22 +978,25 @@ function updateTickerProgression(args, propertyName, progression) {
|
|
|
906
978
|
}
|
|
907
979
|
}
|
|
908
980
|
}
|
|
909
|
-
function getLinearProgression(number, progression) {
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
return
|
|
981
|
+
function getLinearProgression(number, progression, valueConvert) {
|
|
982
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
983
|
+
let amt = valueConvert ? valueConvert(progression.amt) : progression.amt;
|
|
984
|
+
if (limit !== void 0) {
|
|
985
|
+
if (number > limit && amt > 0) {
|
|
986
|
+
return limit;
|
|
987
|
+
} else if (number < limit && amt < 0) {
|
|
988
|
+
return limit;
|
|
915
989
|
}
|
|
916
990
|
}
|
|
917
|
-
return number +
|
|
991
|
+
return number + amt;
|
|
918
992
|
}
|
|
919
|
-
function getExponentialProgression(number, progression) {
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
993
|
+
function getExponentialProgression(number, progression, valueConvert) {
|
|
994
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
995
|
+
if (limit !== void 0) {
|
|
996
|
+
if (number > limit && progression.percentage > 0) {
|
|
997
|
+
return limit;
|
|
998
|
+
} else if (number < limit && progression.percentage < 0) {
|
|
999
|
+
return limit;
|
|
925
1000
|
}
|
|
926
1001
|
}
|
|
927
1002
|
return number + number * progression.percentage;
|
|
@@ -934,15 +1009,13 @@ var MoveTicker = class extends TickerBase {
|
|
|
934
1009
|
let ySpeed = 1;
|
|
935
1010
|
if (args.speed) {
|
|
936
1011
|
if (typeof args.speed === "number") {
|
|
937
|
-
xSpeed = args.speed;
|
|
938
|
-
ySpeed = args.speed;
|
|
1012
|
+
xSpeed = this.speedConvert(args.speed);
|
|
1013
|
+
ySpeed = this.speedConvert(args.speed);
|
|
939
1014
|
} else {
|
|
940
|
-
xSpeed = args.speed.x;
|
|
941
|
-
ySpeed = args.speed.y;
|
|
1015
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
1016
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
942
1017
|
}
|
|
943
1018
|
}
|
|
944
|
-
xSpeed /= 60;
|
|
945
|
-
ySpeed /= 60;
|
|
946
1019
|
let destination = args.destination;
|
|
947
1020
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
948
1021
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -982,7 +1055,10 @@ var MoveTicker = class extends TickerBase {
|
|
|
982
1055
|
}
|
|
983
1056
|
});
|
|
984
1057
|
if (args.speedProgression)
|
|
985
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1058
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1059
|
+
}
|
|
1060
|
+
speedConvert(speed) {
|
|
1061
|
+
return speed / 6;
|
|
986
1062
|
}
|
|
987
1063
|
};
|
|
988
1064
|
MoveTicker = __decorateClass([
|
|
@@ -990,7 +1066,7 @@ MoveTicker = __decorateClass([
|
|
|
990
1066
|
], MoveTicker);
|
|
991
1067
|
var RotateTicker = class extends TickerBase {
|
|
992
1068
|
fn(ticker, args, tags, tickerId) {
|
|
993
|
-
let speed = (args.speed === void 0 ? 1 : args.speed)
|
|
1069
|
+
let speed = this.speedConvert(args.speed === void 0 ? 1 : args.speed);
|
|
994
1070
|
let clockwise = args.clockwise === void 0 ? true : args.clockwise;
|
|
995
1071
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
996
1072
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -1018,7 +1094,10 @@ var RotateTicker = class extends TickerBase {
|
|
|
1018
1094
|
}
|
|
1019
1095
|
});
|
|
1020
1096
|
if (args.speedProgression)
|
|
1021
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1097
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1098
|
+
}
|
|
1099
|
+
speedConvert(speed) {
|
|
1100
|
+
return speed / 60;
|
|
1022
1101
|
}
|
|
1023
1102
|
};
|
|
1024
1103
|
RotateTicker = __decorateClass([
|
|
@@ -1030,15 +1109,13 @@ var ZoomTicker = class extends TickerBase {
|
|
|
1030
1109
|
let ySpeed = 0.1;
|
|
1031
1110
|
if (args.speed) {
|
|
1032
1111
|
if (typeof args.speed === "number") {
|
|
1033
|
-
xSpeed = args.speed;
|
|
1034
|
-
ySpeed = args.speed;
|
|
1112
|
+
xSpeed = this.speedConvert(args.speed);
|
|
1113
|
+
ySpeed = this.speedConvert(args.speed);
|
|
1035
1114
|
} else {
|
|
1036
|
-
xSpeed = args.speed.x;
|
|
1037
|
-
ySpeed = args.speed.y;
|
|
1115
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
1116
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
1038
1117
|
}
|
|
1039
1118
|
}
|
|
1040
|
-
xSpeed /= 60;
|
|
1041
|
-
ySpeed /= 60;
|
|
1042
1119
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
1043
1120
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
1044
1121
|
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
@@ -1105,7 +1182,10 @@ var ZoomTicker = class extends TickerBase {
|
|
|
1105
1182
|
}
|
|
1106
1183
|
});
|
|
1107
1184
|
if (args.speedProgression)
|
|
1108
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1185
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1186
|
+
}
|
|
1187
|
+
speedConvert(speed) {
|
|
1188
|
+
return speed / 60;
|
|
1109
1189
|
}
|
|
1110
1190
|
onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
|
|
1111
1191
|
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
@@ -1302,14 +1382,14 @@ function zoomIn(_0, _1) {
|
|
|
1302
1382
|
} else {
|
|
1303
1383
|
canvasElement = image;
|
|
1304
1384
|
}
|
|
1305
|
-
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1306
|
-
yield canvasElement.load();
|
|
1307
|
-
}
|
|
1308
1385
|
let container = new CanvasContainer();
|
|
1309
1386
|
container.addChild(canvasElement);
|
|
1310
1387
|
container.height = GameWindowManager.canvasHeight;
|
|
1311
1388
|
container.width = GameWindowManager.canvasWidth;
|
|
1312
1389
|
GameWindowManager.addCanvasElement(tag, container);
|
|
1390
|
+
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1391
|
+
yield canvasElement.load();
|
|
1392
|
+
}
|
|
1313
1393
|
if (props.direction == "up") {
|
|
1314
1394
|
container.pivot.y = GameWindowManager.canvasHeight;
|
|
1315
1395
|
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
@@ -2331,6 +2411,16 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2331
2411
|
static set originalStepData(value) {
|
|
2332
2412
|
_GameStepManager._originalStepData = createExportableElement(value);
|
|
2333
2413
|
}
|
|
2414
|
+
static get currentStepData() {
|
|
2415
|
+
let currentStepData = {
|
|
2416
|
+
path: window.location.pathname,
|
|
2417
|
+
storage: GameStorageManager.export(),
|
|
2418
|
+
canvas: GameWindowManager.export(),
|
|
2419
|
+
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
2420
|
+
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
2421
|
+
};
|
|
2422
|
+
return currentStepData;
|
|
2423
|
+
}
|
|
2334
2424
|
/* Edit History Methods */
|
|
2335
2425
|
/**
|
|
2336
2426
|
* Add a label to the history.
|
|
@@ -2338,19 +2428,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2338
2428
|
*/
|
|
2339
2429
|
static addStepHistory(step, choiseMade) {
|
|
2340
2430
|
let stepHistory = getStepSha1(step);
|
|
2341
|
-
let
|
|
2342
|
-
path: window.location.pathname,
|
|
2343
|
-
storage: GameStorageManager.export(),
|
|
2344
|
-
canvas: GameWindowManager.export(),
|
|
2345
|
-
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
2346
|
-
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
2347
|
-
};
|
|
2431
|
+
let currentStepData = _GameStepManager.currentStepData;
|
|
2348
2432
|
if (_GameStepManager.originalStepData) {
|
|
2349
|
-
if (_GameStepManager.originalStepData.openedLabels.length ===
|
|
2433
|
+
if (_GameStepManager.originalStepData.openedLabels.length === currentStepData.openedLabels.length) {
|
|
2350
2434
|
try {
|
|
2351
2435
|
let lastStepDataOpenedLabelsString = JSON.stringify(_GameStepManager.originalStepData.openedLabels);
|
|
2352
|
-
let historyStepOpenedLabelsString = JSON.stringify(
|
|
2353
|
-
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path ===
|
|
2436
|
+
let historyStepOpenedLabelsString = JSON.stringify(currentStepData.openedLabels);
|
|
2437
|
+
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path === currentStepData.path && _GameStepManager.originalStepData.labelIndex === currentStepData.labelIndex) {
|
|
2354
2438
|
return;
|
|
2355
2439
|
}
|
|
2356
2440
|
} catch (e) {
|
|
@@ -2358,7 +2442,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2358
2442
|
}
|
|
2359
2443
|
}
|
|
2360
2444
|
}
|
|
2361
|
-
let data = deepDiff.diff(_GameStepManager.originalStepData,
|
|
2445
|
+
let data = deepDiff.diff(_GameStepManager.originalStepData, currentStepData);
|
|
2362
2446
|
if (data) {
|
|
2363
2447
|
let dialoge = void 0;
|
|
2364
2448
|
let requiredChoices = void 0;
|
|
@@ -2377,7 +2461,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2377
2461
|
index: _GameStepManager.lastStepIndex,
|
|
2378
2462
|
choiceIndexMade: choiseMade
|
|
2379
2463
|
});
|
|
2380
|
-
_GameStepManager.originalStepData =
|
|
2464
|
+
_GameStepManager.originalStepData = currentStepData;
|
|
2381
2465
|
}
|
|
2382
2466
|
_GameStepManager.increaseLastStepIndex();
|
|
2383
2467
|
}
|
|
@@ -2468,6 +2552,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2468
2552
|
console.warn("[Pixi'VN] The player must make a choice");
|
|
2469
2553
|
return;
|
|
2470
2554
|
}
|
|
2555
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2556
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2557
|
+
}
|
|
2471
2558
|
_GameStepManager.increaseCurrentStepIndex();
|
|
2472
2559
|
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
2473
2560
|
});
|
|
@@ -2492,6 +2579,10 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2492
2579
|
return;
|
|
2493
2580
|
}
|
|
2494
2581
|
if (currentLabel.steps.length > currentLabelStepIndex) {
|
|
2582
|
+
let onStepRun = currentLabel.onStepStart;
|
|
2583
|
+
if (onStepRun) {
|
|
2584
|
+
yield onStepRun(currentLabelStepIndex, currentLabel);
|
|
2585
|
+
}
|
|
2495
2586
|
let step = currentLabel.steps[currentLabelStepIndex];
|
|
2496
2587
|
let result = yield step(props);
|
|
2497
2588
|
_GameStepManager.addStepHistory(step, choiseMade);
|
|
@@ -2556,6 +2647,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2556
2647
|
if (!tempLabel) {
|
|
2557
2648
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2558
2649
|
}
|
|
2650
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2651
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2652
|
+
}
|
|
2559
2653
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2560
2654
|
} catch (e) {
|
|
2561
2655
|
console.error("[Pixi'VN] Error calling label", e);
|
|
@@ -2614,6 +2708,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2614
2708
|
if (!tempLabel) {
|
|
2615
2709
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2616
2710
|
}
|
|
2711
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2712
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2713
|
+
}
|
|
2617
2714
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2618
2715
|
} catch (e) {
|
|
2619
2716
|
console.error("[Pixi'VN] Error jumping label", e);
|
|
@@ -2719,24 +2816,29 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2719
2816
|
* ```
|
|
2720
2817
|
*/
|
|
2721
2818
|
static goBack(navigate, steps = 1) {
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2819
|
+
return __async(this, null, function* () {
|
|
2820
|
+
if (steps <= 0) {
|
|
2821
|
+
console.warn("[Pixi'VN] Steps must be greater than 0");
|
|
2822
|
+
return;
|
|
2823
|
+
}
|
|
2824
|
+
if (_GameStepManager._stepsHistory.length <= 1) {
|
|
2825
|
+
console.warn("[Pixi'VN] No steps to go back");
|
|
2826
|
+
return;
|
|
2827
|
+
}
|
|
2828
|
+
let restoredStep = _GameStepManager.goBackInternal(steps, _GameStepManager.originalStepData);
|
|
2829
|
+
if (restoredStep) {
|
|
2830
|
+
_GameStepManager._originalStepData = restoredStep;
|
|
2831
|
+
_GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels);
|
|
2832
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2833
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2834
|
+
}
|
|
2835
|
+
GameStorageManager.import(createExportableElement(restoredStep.storage));
|
|
2836
|
+
GameWindowManager.import(createExportableElement(restoredStep.canvas));
|
|
2837
|
+
navigate(restoredStep.path);
|
|
2838
|
+
} else {
|
|
2839
|
+
console.error("[Pixi'VN] Error going back");
|
|
2840
|
+
}
|
|
2841
|
+
});
|
|
2740
2842
|
}
|
|
2741
2843
|
static goBackInternal(steps, restoredStep) {
|
|
2742
2844
|
if (steps <= 0) {
|
|
@@ -2798,38 +2900,45 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2798
2900
|
* @param dataString The history in a JSON string.
|
|
2799
2901
|
*/
|
|
2800
2902
|
static importJson(dataString) {
|
|
2801
|
-
|
|
2903
|
+
return __async(this, null, function* () {
|
|
2904
|
+
yield _GameStepManager.import(JSON.parse(dataString));
|
|
2905
|
+
});
|
|
2802
2906
|
}
|
|
2803
2907
|
/**
|
|
2804
2908
|
* Import the history from an object.
|
|
2805
2909
|
* @param data The history in an object.
|
|
2806
2910
|
*/
|
|
2807
2911
|
static import(data) {
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2912
|
+
return __async(this, null, function* () {
|
|
2913
|
+
_GameStepManager.clear();
|
|
2914
|
+
try {
|
|
2915
|
+
if (data.hasOwnProperty("stepsHistory")) {
|
|
2916
|
+
_GameStepManager._stepsHistory = data["stepsHistory"];
|
|
2917
|
+
} else {
|
|
2918
|
+
console.warn("[Pixi'VN] Could not import stepsHistory data, so will be ignored");
|
|
2919
|
+
}
|
|
2920
|
+
if (data.hasOwnProperty("openedLabels")) {
|
|
2921
|
+
_GameStepManager._openedLabels = data["openedLabels"];
|
|
2922
|
+
} else {
|
|
2923
|
+
console.warn("[Pixi'VN] Could not import openedLabels data, so will be ignored");
|
|
2924
|
+
}
|
|
2925
|
+
if (data.hasOwnProperty("lastStepIndex")) {
|
|
2926
|
+
_GameStepManager._lastStepIndex = data["lastStepIndex"];
|
|
2927
|
+
} else {
|
|
2928
|
+
console.warn("[Pixi'VN] Could not import lastStepIndex data, so will be ignored");
|
|
2929
|
+
}
|
|
2930
|
+
if (data.hasOwnProperty("originalStepData")) {
|
|
2931
|
+
_GameStepManager._originalStepData = data["originalStepData"];
|
|
2932
|
+
} else {
|
|
2933
|
+
console.warn("[Pixi'VN] Could not import originalStepData data, so will be ignored");
|
|
2934
|
+
}
|
|
2935
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2936
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2937
|
+
}
|
|
2938
|
+
} catch (e) {
|
|
2939
|
+
console.error("[Pixi'VN] Error importing data", e);
|
|
2829
2940
|
}
|
|
2830
|
-
}
|
|
2831
|
-
console.error("[Pixi'VN] Error importing data", e);
|
|
2832
|
-
}
|
|
2941
|
+
});
|
|
2833
2942
|
}
|
|
2834
2943
|
};
|
|
2835
2944
|
/**
|
|
@@ -3005,7 +3114,7 @@ var DialogueBaseModel = class {
|
|
|
3005
3114
|
var juliette = new CharacterBaseModel2("___pixivn_juliette___", {
|
|
3006
3115
|
name: "Juliette",
|
|
3007
3116
|
age: 25,
|
|
3008
|
-
icon: "https://firebasestorage.googleapis.com/v0/b/pixi-vn.appspot.com/o/public%2Fcharacters%2Fjuliette-square.webp?alt=media
|
|
3117
|
+
icon: "https://firebasestorage.googleapis.com/v0/b/pixi-vn.appspot.com/o/public%2Fcharacters%2Fjuliette-square.webp?alt=media",
|
|
3009
3118
|
color: "#ac0086"
|
|
3010
3119
|
});
|
|
3011
3120
|
saveCharacter(juliette);
|
|
@@ -3042,13 +3151,13 @@ var imagesAnimationsTest = newLabel(IMAGE_ANIMAIONS_TEST_LABEL, [
|
|
|
3042
3151
|
() => __async(void 0, null, function* () {
|
|
3043
3152
|
setDialogue({ character: juliette, text: "Here's what they can do." });
|
|
3044
3153
|
setChoiceMenuOptions([
|
|
3045
|
-
new ChoiceMenuOption("Dissolve effect", imagesDissolveTest),
|
|
3046
|
-
new ChoiceMenuOption("Fade effect", imagesFadeTest),
|
|
3047
|
-
new ChoiceMenuOption("Rotate", imagesRotateTest),
|
|
3048
|
-
new ChoiceMenuOption("Move", imagesMoveTest),
|
|
3049
|
-
new ChoiceMenuOption("Zoom", imagesZoomTest),
|
|
3050
|
-
new ChoiceMenuOption("Move in/out", imagesMoveInOutTest),
|
|
3051
|
-
new ChoiceMenuOption("Zoom in/out", imagesZoomInOutTest),
|
|
3154
|
+
new ChoiceMenuOption("Dissolve effect", imagesDissolveTest, {}),
|
|
3155
|
+
new ChoiceMenuOption("Fade effect", imagesFadeTest, {}),
|
|
3156
|
+
new ChoiceMenuOption("Rotate", imagesRotateTest, {}),
|
|
3157
|
+
new ChoiceMenuOption("Move", imagesMoveTest, {}),
|
|
3158
|
+
new ChoiceMenuOption("Zoom", imagesZoomTest, {}),
|
|
3159
|
+
new ChoiceMenuOption("Move in/out", imagesMoveInOutTest, {}),
|
|
3160
|
+
new ChoiceMenuOption("Zoom in/out", imagesZoomInOutTest, {}),
|
|
3052
3161
|
new ChoiceMenuOptionClose("Cancel", true)
|
|
3053
3162
|
]);
|
|
3054
3163
|
}),
|
|
@@ -3158,8 +3267,8 @@ var imagesRotateTest = newLabel("___pixi_vn_images_rotate_test___", [
|
|
|
3158
3267
|
text: `Here's what's going to happen:
|
|
3159
3268
|
- ${eggHeadName} will rotate with a anchor set to 0.
|
|
3160
3269
|
- ${flowerTopName} will rotate with a anchor set to 0.5 and a exponential speed progression.
|
|
3161
|
-
- ${helmlokName} will rotate with a anchor set to 0.5, rotate 2
|
|
3162
|
-
- ${skullyName} will rotate with a anchor set to 1, rotate 3
|
|
3270
|
+
- ${helmlokName} will rotate with a anchor set to 0.5, rotate clockwise for 2 seconds, rotate counterclockwise with a exponential (-0.05) speed progression, and when it reaches 0, it will repeat.
|
|
3271
|
+
- ${skullyName} will rotate with a anchor set to 1, rotate 3 seconds clockwise, wait for 0.5 seconds, and rotate 7 seconds counterclockwise.`
|
|
3163
3272
|
});
|
|
3164
3273
|
let eggHead = GameWindowManager.getCanvasElement("eggHead");
|
|
3165
3274
|
if (eggHead)
|
|
@@ -3212,10 +3321,10 @@ var imagesMoveTest = newLabel("___pixi_vn_images_move_test___", [
|
|
|
3212
3321
|
setDialogue({
|
|
3213
3322
|
character: juliette,
|
|
3214
3323
|
text: `Here's what's going to happen:
|
|
3215
|
-
- ${eggHeadName} will move to { x: 500, y: 100 } with a speed of
|
|
3216
|
-
- ${flowerTopName} will move to { x: 500, y: 300 } with a speed of
|
|
3217
|
-
- ${helmlokName} will move to
|
|
3218
|
-
- ${skullyName} will move to { x: 500, y: 500 } with a speed of
|
|
3324
|
+
- ${eggHeadName} will move to { x: 500, y: 100 } with a speed of 24.
|
|
3325
|
+
- ${flowerTopName} will move to { x: 500, y: 300 } with a speed of 18.
|
|
3326
|
+
- ${helmlokName} will move to { x: 100, y: 500 } with a speed of 150 and a linear speed progression of -2 ( limit 10 ), and then move to { x: 1700, y: 500 } with a speed of 10 and a linear speed progression of 2 ( limit 150 ), and repeat.
|
|
3327
|
+
- ${skullyName} will move to { x: 500, y: 500 } with a speed of 40, wait for 0.5 seconds, and move to { x: 100, y: 100 } with a speed of 40.`
|
|
3219
3328
|
});
|
|
3220
3329
|
GameWindowManager.addTicker("eggHead", new MoveTicker({
|
|
3221
3330
|
destination: { x: 500, y: 100 },
|
|
@@ -3228,25 +3337,25 @@ var imagesMoveTest = newLabel("___pixi_vn_images_move_test___", [
|
|
|
3228
3337
|
GameWindowManager.addTickersSteps("helmlok", [
|
|
3229
3338
|
new MoveTicker({
|
|
3230
3339
|
destination: { x: 100, y: 500 },
|
|
3231
|
-
speed:
|
|
3232
|
-
speedProgression: { type: "linear", amt: -
|
|
3340
|
+
speed: 150,
|
|
3341
|
+
speedProgression: { type: "linear", amt: -2, limit: 10 }
|
|
3233
3342
|
}),
|
|
3234
3343
|
new MoveTicker({
|
|
3235
3344
|
destination: { x: 1700, y: 500 },
|
|
3236
|
-
speed:
|
|
3237
|
-
speedProgression: { type: "linear", amt:
|
|
3345
|
+
speed: 10,
|
|
3346
|
+
speedProgression: { type: "linear", amt: 2, limit: 150 }
|
|
3238
3347
|
}),
|
|
3239
3348
|
Repeat
|
|
3240
3349
|
]);
|
|
3241
3350
|
GameWindowManager.addTickersSteps("skully", [
|
|
3242
3351
|
new MoveTicker({
|
|
3243
3352
|
destination: { x: 500, y: 500 },
|
|
3244
|
-
speed:
|
|
3353
|
+
speed: 40
|
|
3245
3354
|
}),
|
|
3246
3355
|
Pause(0.5),
|
|
3247
3356
|
new MoveTicker({
|
|
3248
3357
|
destination: { x: 100, y: 100 },
|
|
3249
|
-
speed:
|
|
3358
|
+
speed: 40
|
|
3250
3359
|
})
|
|
3251
3360
|
]);
|
|
3252
3361
|
}
|
|
@@ -3308,37 +3417,45 @@ var imagesMoveInOutTest = newLabel("___pixi_vn_images_move_in_out_test___", [
|
|
|
3308
3417
|
setDialogue({
|
|
3309
3418
|
character: juliette,
|
|
3310
3419
|
text: `Here's what's going to happen:
|
|
3311
|
-
- ${eggHeadName} will move in from the top with a speed of
|
|
3312
|
-
- ${flowerTopName} will move in from the right with a speed of
|
|
3313
|
-
- ${helmlokName} will move in from the left with a speed of
|
|
3314
|
-
- ${skullyName} will move in from the bottom with a speed of
|
|
3420
|
+
- ${eggHeadName} will move in from the top with a speed of 80. If you go next, ${eggHeadName} will move out from the bottom with a speed of 80.
|
|
3421
|
+
- ${flowerTopName} will move in from the right with a speed of 80 and a speed progression of 0.02. If you go next, ${flowerTopName} will move out from the left with a speed of 80 and a speed progression of 0.02.
|
|
3422
|
+
- ${helmlokName} will move in from the left with a speed of 80. If you go next, ${helmlokName} will move out from the right with a speed of 80.
|
|
3423
|
+
- ${skullyName} will move in from the bottom with a speed of 80 and a speed progression of 0.02. If you go next, ${skullyName} will move out from the top with a speed of 80 and a speed progression of 0.02.`
|
|
3315
3424
|
});
|
|
3316
3425
|
let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
|
|
3317
3426
|
let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
|
|
3318
3427
|
let helmlok = new CanvasImage({ x: 100, y: 300 }, helmlokImage);
|
|
3319
3428
|
let skully = new CanvasImage({ x: 300, y: 300 }, skullyImage);
|
|
3320
|
-
moveIn("eggHead", eggHead, { speed:
|
|
3429
|
+
moveIn("eggHead", eggHead, { speed: 80, direction: "down" });
|
|
3321
3430
|
moveIn("flowerTop", flowerTop, {
|
|
3322
|
-
speed:
|
|
3431
|
+
speed: 80,
|
|
3323
3432
|
direction: "left",
|
|
3324
3433
|
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3325
3434
|
});
|
|
3326
|
-
moveIn("helmlok", helmlok, { speed:
|
|
3435
|
+
moveIn("helmlok", helmlok, { speed: 80, direction: "right" });
|
|
3327
3436
|
moveIn("skully", skully, {
|
|
3328
|
-
speed:
|
|
3437
|
+
speed: 80,
|
|
3329
3438
|
direction: "up",
|
|
3330
3439
|
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3331
3440
|
});
|
|
3332
3441
|
}),
|
|
3333
3442
|
() => {
|
|
3334
|
-
moveOut("eggHead", { speed:
|
|
3335
|
-
moveOut("flowerTop", { speed:
|
|
3336
|
-
moveOut("helmlok", { speed:
|
|
3337
|
-
moveOut("skully", { speed:
|
|
3443
|
+
moveOut("eggHead", { speed: 80, direction: "down" });
|
|
3444
|
+
moveOut("flowerTop", { speed: 80, direction: "left" });
|
|
3445
|
+
moveOut("helmlok", { speed: 80, direction: "right" });
|
|
3446
|
+
moveOut("skully", { speed: 80, direction: "up" });
|
|
3338
3447
|
}
|
|
3339
3448
|
]);
|
|
3340
3449
|
var imagesZoomInOutTest = newLabel("___pixi_vn_images_zoom_in_out_test___", [
|
|
3341
3450
|
() => __async(void 0, null, function* () {
|
|
3451
|
+
setDialogue({
|
|
3452
|
+
character: juliette,
|
|
3453
|
+
text: `Here's what's going to happen:
|
|
3454
|
+
- ${eggHeadName} will zoom in with a speed of 3. If you go next, ${eggHeadName} will zoom out with a speed of 3.
|
|
3455
|
+
- ${flowerTopName} will zoom in with a speed of 3 and a speed progression of 0.02. If you go next, ${flowerTopName} will zoom out with a speed of 3.
|
|
3456
|
+
- ${helmlokName} will zoom in with a speed of 3. If you go next, ${helmlokName} will zoom out with a speed of 1.
|
|
3457
|
+
- ${skullyName} will zoom in with a speed of 3 and a speed progression of 0.02. If you go next, ${skullyName} will zoom out with a speed of 3 and a speed progression of 0.02.`
|
|
3458
|
+
});
|
|
3342
3459
|
GameWindowManager.removeCanvasElements();
|
|
3343
3460
|
let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
|
|
3344
3461
|
let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
|
|
@@ -3364,7 +3481,7 @@ var imagesZoomInOutTest = newLabel("___pixi_vn_images_zoom_in_out_test___", [
|
|
|
3364
3481
|
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3365
3482
|
});
|
|
3366
3483
|
zoomOut("flowerTop", { speed: 3, direction: "left" });
|
|
3367
|
-
zoomOut("helmlok", { speed:
|
|
3484
|
+
zoomOut("helmlok", { speed: 1, direction: "right" });
|
|
3368
3485
|
zoomOut("skully", {
|
|
3369
3486
|
speed: 3,
|
|
3370
3487
|
direction: "up",
|