@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { diff } from 'deep-diff';
|
|
2
2
|
import sha1 from 'crypto-js/sha1';
|
|
3
|
-
import { Sprite, Container,
|
|
3
|
+
import { Sprite, Container, Assets, Texture, Application, Text } from 'pixi.js';
|
|
4
4
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __defProps = Object.defineProperties;
|
|
@@ -58,19 +58,18 @@ function checkIfStepsIsEqual(step1, step2) {
|
|
|
58
58
|
return step1 === step2;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
// src/classes/
|
|
62
|
-
var
|
|
61
|
+
// src/classes/LabelAbstract.ts
|
|
62
|
+
var LabelAbstract = class {
|
|
63
63
|
/**
|
|
64
64
|
* @param id is the id of the label
|
|
65
|
-
* @param
|
|
66
|
-
* @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
|
|
67
|
-
* @param choiseIndex is the index of the choice that the label will perform
|
|
65
|
+
* @param props is the properties of the label
|
|
68
66
|
*/
|
|
69
|
-
constructor(id,
|
|
67
|
+
constructor(id, props) {
|
|
70
68
|
this._id = id;
|
|
71
|
-
this.
|
|
72
|
-
this.
|
|
73
|
-
this.
|
|
69
|
+
this._onStepStart = props == null ? void 0 : props.onStepStart;
|
|
70
|
+
this._onLoadStep = props == null ? void 0 : props.onLoadStep;
|
|
71
|
+
this._onStepEnd = props == null ? void 0 : props.onStepEnd;
|
|
72
|
+
this._choiseIndex = props == null ? void 0 : props.choiseIndex;
|
|
74
73
|
}
|
|
75
74
|
/**
|
|
76
75
|
* Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
|
|
@@ -78,17 +77,6 @@ var Label = class {
|
|
|
78
77
|
get id() {
|
|
79
78
|
return this._id;
|
|
80
79
|
}
|
|
81
|
-
/**
|
|
82
|
-
* Get the steps of the label.
|
|
83
|
-
* This class should be extended and the steps method should be overridden.
|
|
84
|
-
* Every time you update this list will also be updated when the other game versions load.
|
|
85
|
-
*/
|
|
86
|
-
get steps() {
|
|
87
|
-
if (typeof this._steps === "function") {
|
|
88
|
-
return this._steps();
|
|
89
|
-
}
|
|
90
|
-
return this._steps;
|
|
91
|
-
}
|
|
92
80
|
/**
|
|
93
81
|
* Get the corresponding steps number
|
|
94
82
|
* @param externalSteps
|
|
@@ -107,37 +95,75 @@ var Label = class {
|
|
|
107
95
|
return res;
|
|
108
96
|
}
|
|
109
97
|
/**
|
|
110
|
-
*
|
|
98
|
+
* 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.
|
|
111
99
|
* @returns Promise<void> or void
|
|
112
|
-
* @example
|
|
113
|
-
* ```typescript
|
|
114
|
-
* newLabel("id", [], () => {
|
|
115
|
-
* Assets.load('path/to/image1.png')
|
|
116
|
-
* Assets.load('path/to/image2.png')
|
|
117
|
-
* })
|
|
118
|
-
* ```
|
|
119
100
|
*/
|
|
120
|
-
get
|
|
121
|
-
return this
|
|
101
|
+
get onStepStart() {
|
|
102
|
+
return (stepIndex, label) => __async(this, null, function* () {
|
|
103
|
+
if (this._onLoadStep) {
|
|
104
|
+
yield this._onLoadStep(stepIndex, label);
|
|
105
|
+
}
|
|
106
|
+
if (this._onStepStart) {
|
|
107
|
+
return yield this._onStepStart(stepIndex, label);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* 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.
|
|
113
|
+
* @returns Promise<void> or void
|
|
114
|
+
*/
|
|
115
|
+
get onLoadStep() {
|
|
116
|
+
return this._onLoadStep;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Is a function that will be executed when the step ends.
|
|
120
|
+
* @returns Promise<void> or void
|
|
121
|
+
*/
|
|
122
|
+
get onStepEnd() {
|
|
123
|
+
return this._onStepEnd;
|
|
122
124
|
}
|
|
123
125
|
get choiseIndex() {
|
|
124
126
|
return this._choiseIndex;
|
|
125
127
|
}
|
|
126
128
|
};
|
|
127
129
|
|
|
130
|
+
// src/classes/Label.ts
|
|
131
|
+
var Label = class extends LabelAbstract {
|
|
132
|
+
/**
|
|
133
|
+
* @param id is the id of the label
|
|
134
|
+
* @param steps is the list of steps that the label will perform
|
|
135
|
+
* @param props is the properties of the label
|
|
136
|
+
*/
|
|
137
|
+
constructor(id, steps, props) {
|
|
138
|
+
super(id, props);
|
|
139
|
+
this._steps = steps;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Get the steps of the label.
|
|
143
|
+
*/
|
|
144
|
+
get steps() {
|
|
145
|
+
if (typeof this._steps === "function") {
|
|
146
|
+
return this._steps();
|
|
147
|
+
}
|
|
148
|
+
return this._steps;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
128
152
|
// src/classes/CloseLabel.ts
|
|
129
153
|
var CLOSE_LABEL_ID = "__close-label-id__";
|
|
130
154
|
function newCloseLabel(choiseIndex) {
|
|
131
|
-
return new Label(CLOSE_LABEL_ID, [],
|
|
155
|
+
return new Label(CLOSE_LABEL_ID, [], {
|
|
156
|
+
choiseIndex
|
|
157
|
+
});
|
|
132
158
|
}
|
|
133
159
|
|
|
134
160
|
// src/decorators/LabelDecorator.ts
|
|
135
161
|
var registeredLabels = {};
|
|
136
|
-
function newLabel(id, steps,
|
|
162
|
+
function newLabel(id, steps, props) {
|
|
137
163
|
if (registeredLabels[id]) {
|
|
138
164
|
console.info(`[Pixi'VN] Label ${id} already exists, it will be overwritten`);
|
|
139
165
|
}
|
|
140
|
-
let label = new Label(id, steps,
|
|
166
|
+
let label = new Label(id, steps, props);
|
|
141
167
|
registeredLabels[id] = label;
|
|
142
168
|
return label;
|
|
143
169
|
}
|
|
@@ -226,8 +252,6 @@ function getMemoryContainer(element) {
|
|
|
226
252
|
};
|
|
227
253
|
}
|
|
228
254
|
function setMemoryContainer(element, memory) {
|
|
229
|
-
memory.width && (element.width = memory.width);
|
|
230
|
-
memory.height && (element.height = memory.height);
|
|
231
255
|
memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
|
|
232
256
|
memory.blendMode && (element.blendMode = memory.blendMode);
|
|
233
257
|
memory.tint && (element.tint = memory.tint);
|
|
@@ -260,6 +284,8 @@ function setMemoryContainer(element, memory) {
|
|
|
260
284
|
memory.interactive && (element.interactive = memory.interactive);
|
|
261
285
|
memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
|
|
262
286
|
memory.hitArea && (element.hitArea = memory.hitArea);
|
|
287
|
+
memory.width && (element.width = memory.width);
|
|
288
|
+
memory.height && (element.height = memory.height);
|
|
263
289
|
}
|
|
264
290
|
function getTexture(imageUrl) {
|
|
265
291
|
return __async(this, null, function* () {
|
|
@@ -681,29 +707,57 @@ var ChoiceMenuOption = class {
|
|
|
681
707
|
/**
|
|
682
708
|
* @param text Text to be displayed in the menu
|
|
683
709
|
* @param label Label to be opened when the option is selected or the id of the label
|
|
710
|
+
* @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.
|
|
684
711
|
* @param type Type of the label to be opened. @default "call"
|
|
685
|
-
* @param props Properties to be passed to the label, when the label is called. it cannot contain functions or classes. @default {}
|
|
686
712
|
*/
|
|
687
|
-
constructor(text, label, type = "call"
|
|
713
|
+
constructor(text, label, props, type = "call") {
|
|
688
714
|
/**
|
|
689
|
-
* Properties to be passed to the label
|
|
715
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
716
|
+
* @example
|
|
717
|
+
* ```tsx
|
|
718
|
+
* setChoiceMenuOptions([
|
|
719
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
720
|
+
* ])
|
|
721
|
+
* return <List>
|
|
722
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
723
|
+
* return (
|
|
724
|
+
* <ChoiceButton
|
|
725
|
+
* disabled={item.props.disabled}
|
|
726
|
+
* onClick={() => {
|
|
727
|
+
* afterSelectChoice(item)
|
|
728
|
+
* }}
|
|
729
|
+
* >
|
|
730
|
+
* {item.text}
|
|
731
|
+
* </ChoiceButton>
|
|
732
|
+
* )
|
|
733
|
+
* })}
|
|
734
|
+
* </List>
|
|
735
|
+
* ```
|
|
690
736
|
*/
|
|
691
737
|
this.props = {};
|
|
692
|
-
if (typeof label === "string") {
|
|
693
|
-
let tLabel = getLabelById(label);
|
|
694
|
-
if (!tLabel) {
|
|
695
|
-
throw new Error(`[Pixi'VN] Label ${label} not found`);
|
|
696
|
-
} else {
|
|
697
|
-
label = tLabel;
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
738
|
this.text = text;
|
|
701
|
-
this.
|
|
739
|
+
this._label = label;
|
|
702
740
|
this.type = type;
|
|
703
741
|
if (props) {
|
|
704
742
|
this.props = props;
|
|
705
743
|
}
|
|
706
744
|
}
|
|
745
|
+
/**
|
|
746
|
+
* Label to be opened when the option is selected
|
|
747
|
+
*/
|
|
748
|
+
get label() {
|
|
749
|
+
let label = this._label;
|
|
750
|
+
if (typeof label === "string") {
|
|
751
|
+
let res = getLabelById(label);
|
|
752
|
+
if (res) {
|
|
753
|
+
label = res;
|
|
754
|
+
} else {
|
|
755
|
+
console.error(`Label ${label} not found, so it will be closed`);
|
|
756
|
+
label = newCloseLabel();
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
return label;
|
|
760
|
+
}
|
|
707
761
|
};
|
|
708
762
|
var ChoiceMenuOptionClose = class {
|
|
709
763
|
/**
|
|
@@ -720,7 +774,27 @@ var ChoiceMenuOptionClose = class {
|
|
|
720
774
|
*/
|
|
721
775
|
this.type = Close;
|
|
722
776
|
/**
|
|
723
|
-
* Properties to be passed to the label
|
|
777
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
778
|
+
* @example
|
|
779
|
+
* ```tsx
|
|
780
|
+
* setChoiceMenuOptions([
|
|
781
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
782
|
+
* ])
|
|
783
|
+
* return <List>
|
|
784
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
785
|
+
* return (
|
|
786
|
+
* <ChoiceButton
|
|
787
|
+
* disabled={item.props.disabled}
|
|
788
|
+
* onClick={() => {
|
|
789
|
+
* afterSelectChoice(item)
|
|
790
|
+
* }}
|
|
791
|
+
* >
|
|
792
|
+
* {item.text}
|
|
793
|
+
* </ChoiceButton>
|
|
794
|
+
* )
|
|
795
|
+
* })}
|
|
796
|
+
* </List>
|
|
797
|
+
* ```
|
|
724
798
|
*/
|
|
725
799
|
this.props = {};
|
|
726
800
|
this.text = text;
|
|
@@ -778,21 +852,18 @@ function getChoiceMenuOptions() {
|
|
|
778
852
|
d.forEach((option, index) => {
|
|
779
853
|
if (option.type === Close) {
|
|
780
854
|
let itemLabel = newCloseLabel(index);
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
type: Close,
|
|
785
|
-
closeCurrentLabel: option.closeCurrentLabel,
|
|
786
|
-
props: {}
|
|
787
|
-
});
|
|
855
|
+
let choice = new ChoiceMenuOptionClose(option.text, option.closeCurrentLabel);
|
|
856
|
+
choice.label = itemLabel;
|
|
857
|
+
options.push(choice);
|
|
788
858
|
return;
|
|
789
859
|
}
|
|
790
860
|
let label = getLabelById(option.label);
|
|
791
861
|
if (label) {
|
|
792
|
-
let itemLabel = new Label(label.id, label.steps,
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
})
|
|
862
|
+
let itemLabel = new Label(label.id, label.steps, {
|
|
863
|
+
onStepStart: label.onStepStart,
|
|
864
|
+
choiseIndex: index
|
|
865
|
+
});
|
|
866
|
+
options.push(new ChoiceMenuOption(option.text, itemLabel, option.props, option.type));
|
|
796
867
|
}
|
|
797
868
|
});
|
|
798
869
|
return options;
|
|
@@ -880,8 +951,9 @@ FadeAlphaTicker = __decorateClass([
|
|
|
880
951
|
], FadeAlphaTicker);
|
|
881
952
|
|
|
882
953
|
// src/functions/TickerUtility.ts
|
|
883
|
-
function updateTickerProgression(args, propertyName, progression) {
|
|
884
|
-
|
|
954
|
+
function updateTickerProgression(args, propertyName, progression, valueConvert) {
|
|
955
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
956
|
+
if (args[propertyName] === void 0 || !progression || args[propertyName] === limit) {
|
|
885
957
|
return;
|
|
886
958
|
}
|
|
887
959
|
if (typeof args[propertyName] === "number") {
|
|
@@ -900,22 +972,25 @@ function updateTickerProgression(args, propertyName, progression) {
|
|
|
900
972
|
}
|
|
901
973
|
}
|
|
902
974
|
}
|
|
903
|
-
function getLinearProgression(number, progression) {
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
return
|
|
975
|
+
function getLinearProgression(number, progression, valueConvert) {
|
|
976
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
977
|
+
let amt = valueConvert ? valueConvert(progression.amt) : progression.amt;
|
|
978
|
+
if (limit !== void 0) {
|
|
979
|
+
if (number > limit && amt > 0) {
|
|
980
|
+
return limit;
|
|
981
|
+
} else if (number < limit && amt < 0) {
|
|
982
|
+
return limit;
|
|
909
983
|
}
|
|
910
984
|
}
|
|
911
|
-
return number +
|
|
985
|
+
return number + amt;
|
|
912
986
|
}
|
|
913
|
-
function getExponentialProgression(number, progression) {
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
987
|
+
function getExponentialProgression(number, progression, valueConvert) {
|
|
988
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
989
|
+
if (limit !== void 0) {
|
|
990
|
+
if (number > limit && progression.percentage > 0) {
|
|
991
|
+
return limit;
|
|
992
|
+
} else if (number < limit && progression.percentage < 0) {
|
|
993
|
+
return limit;
|
|
919
994
|
}
|
|
920
995
|
}
|
|
921
996
|
return number + number * progression.percentage;
|
|
@@ -928,15 +1003,13 @@ var MoveTicker = class extends TickerBase {
|
|
|
928
1003
|
let ySpeed = 1;
|
|
929
1004
|
if (args.speed) {
|
|
930
1005
|
if (typeof args.speed === "number") {
|
|
931
|
-
xSpeed = args.speed;
|
|
932
|
-
ySpeed = args.speed;
|
|
1006
|
+
xSpeed = this.speedConvert(args.speed);
|
|
1007
|
+
ySpeed = this.speedConvert(args.speed);
|
|
933
1008
|
} else {
|
|
934
|
-
xSpeed = args.speed.x;
|
|
935
|
-
ySpeed = args.speed.y;
|
|
1009
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
1010
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
936
1011
|
}
|
|
937
1012
|
}
|
|
938
|
-
xSpeed /= 60;
|
|
939
|
-
ySpeed /= 60;
|
|
940
1013
|
let destination = args.destination;
|
|
941
1014
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
942
1015
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -976,7 +1049,10 @@ var MoveTicker = class extends TickerBase {
|
|
|
976
1049
|
}
|
|
977
1050
|
});
|
|
978
1051
|
if (args.speedProgression)
|
|
979
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1052
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1053
|
+
}
|
|
1054
|
+
speedConvert(speed) {
|
|
1055
|
+
return speed / 6;
|
|
980
1056
|
}
|
|
981
1057
|
};
|
|
982
1058
|
MoveTicker = __decorateClass([
|
|
@@ -984,7 +1060,7 @@ MoveTicker = __decorateClass([
|
|
|
984
1060
|
], MoveTicker);
|
|
985
1061
|
var RotateTicker = class extends TickerBase {
|
|
986
1062
|
fn(ticker, args, tags, tickerId) {
|
|
987
|
-
let speed = (args.speed === void 0 ? 1 : args.speed)
|
|
1063
|
+
let speed = this.speedConvert(args.speed === void 0 ? 1 : args.speed);
|
|
988
1064
|
let clockwise = args.clockwise === void 0 ? true : args.clockwise;
|
|
989
1065
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
990
1066
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -1012,7 +1088,10 @@ var RotateTicker = class extends TickerBase {
|
|
|
1012
1088
|
}
|
|
1013
1089
|
});
|
|
1014
1090
|
if (args.speedProgression)
|
|
1015
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1091
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1092
|
+
}
|
|
1093
|
+
speedConvert(speed) {
|
|
1094
|
+
return speed / 60;
|
|
1016
1095
|
}
|
|
1017
1096
|
};
|
|
1018
1097
|
RotateTicker = __decorateClass([
|
|
@@ -1024,15 +1103,13 @@ var ZoomTicker = class extends TickerBase {
|
|
|
1024
1103
|
let ySpeed = 0.1;
|
|
1025
1104
|
if (args.speed) {
|
|
1026
1105
|
if (typeof args.speed === "number") {
|
|
1027
|
-
xSpeed = args.speed;
|
|
1028
|
-
ySpeed = args.speed;
|
|
1106
|
+
xSpeed = this.speedConvert(args.speed);
|
|
1107
|
+
ySpeed = this.speedConvert(args.speed);
|
|
1029
1108
|
} else {
|
|
1030
|
-
xSpeed = args.speed.x;
|
|
1031
|
-
ySpeed = args.speed.y;
|
|
1109
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
1110
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
1032
1111
|
}
|
|
1033
1112
|
}
|
|
1034
|
-
xSpeed /= 60;
|
|
1035
|
-
ySpeed /= 60;
|
|
1036
1113
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
1037
1114
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
1038
1115
|
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
@@ -1099,7 +1176,10 @@ var ZoomTicker = class extends TickerBase {
|
|
|
1099
1176
|
}
|
|
1100
1177
|
});
|
|
1101
1178
|
if (args.speedProgression)
|
|
1102
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1179
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1180
|
+
}
|
|
1181
|
+
speedConvert(speed) {
|
|
1182
|
+
return speed / 60;
|
|
1103
1183
|
}
|
|
1104
1184
|
onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
|
|
1105
1185
|
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
@@ -1296,14 +1376,14 @@ function zoomIn(_0, _1) {
|
|
|
1296
1376
|
} else {
|
|
1297
1377
|
canvasElement = image;
|
|
1298
1378
|
}
|
|
1299
|
-
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1300
|
-
yield canvasElement.load();
|
|
1301
|
-
}
|
|
1302
1379
|
let container = new CanvasContainer();
|
|
1303
1380
|
container.addChild(canvasElement);
|
|
1304
1381
|
container.height = GameWindowManager.canvasHeight;
|
|
1305
1382
|
container.width = GameWindowManager.canvasWidth;
|
|
1306
1383
|
GameWindowManager.addCanvasElement(tag, container);
|
|
1384
|
+
if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
|
|
1385
|
+
yield canvasElement.load();
|
|
1386
|
+
}
|
|
1307
1387
|
if (props.direction == "up") {
|
|
1308
1388
|
container.pivot.y = GameWindowManager.canvasHeight;
|
|
1309
1389
|
container.pivot.x = GameWindowManager.canvasWidth / 2;
|
|
@@ -2325,6 +2405,16 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2325
2405
|
static set originalStepData(value) {
|
|
2326
2406
|
_GameStepManager._originalStepData = createExportableElement(value);
|
|
2327
2407
|
}
|
|
2408
|
+
static get currentStepData() {
|
|
2409
|
+
let currentStepData = {
|
|
2410
|
+
path: window.location.pathname,
|
|
2411
|
+
storage: GameStorageManager.export(),
|
|
2412
|
+
canvas: GameWindowManager.export(),
|
|
2413
|
+
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
2414
|
+
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
2415
|
+
};
|
|
2416
|
+
return currentStepData;
|
|
2417
|
+
}
|
|
2328
2418
|
/* Edit History Methods */
|
|
2329
2419
|
/**
|
|
2330
2420
|
* Add a label to the history.
|
|
@@ -2332,19 +2422,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2332
2422
|
*/
|
|
2333
2423
|
static addStepHistory(step, choiseMade) {
|
|
2334
2424
|
let stepHistory = getStepSha1(step);
|
|
2335
|
-
let
|
|
2336
|
-
path: window.location.pathname,
|
|
2337
|
-
storage: GameStorageManager.export(),
|
|
2338
|
-
canvas: GameWindowManager.export(),
|
|
2339
|
-
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
2340
|
-
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
2341
|
-
};
|
|
2425
|
+
let currentStepData = _GameStepManager.currentStepData;
|
|
2342
2426
|
if (_GameStepManager.originalStepData) {
|
|
2343
|
-
if (_GameStepManager.originalStepData.openedLabels.length ===
|
|
2427
|
+
if (_GameStepManager.originalStepData.openedLabels.length === currentStepData.openedLabels.length) {
|
|
2344
2428
|
try {
|
|
2345
2429
|
let lastStepDataOpenedLabelsString = JSON.stringify(_GameStepManager.originalStepData.openedLabels);
|
|
2346
|
-
let historyStepOpenedLabelsString = JSON.stringify(
|
|
2347
|
-
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path ===
|
|
2430
|
+
let historyStepOpenedLabelsString = JSON.stringify(currentStepData.openedLabels);
|
|
2431
|
+
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path === currentStepData.path && _GameStepManager.originalStepData.labelIndex === currentStepData.labelIndex) {
|
|
2348
2432
|
return;
|
|
2349
2433
|
}
|
|
2350
2434
|
} catch (e) {
|
|
@@ -2352,7 +2436,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2352
2436
|
}
|
|
2353
2437
|
}
|
|
2354
2438
|
}
|
|
2355
|
-
let data = diff(_GameStepManager.originalStepData,
|
|
2439
|
+
let data = diff(_GameStepManager.originalStepData, currentStepData);
|
|
2356
2440
|
if (data) {
|
|
2357
2441
|
let dialoge = void 0;
|
|
2358
2442
|
let requiredChoices = void 0;
|
|
@@ -2371,7 +2455,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2371
2455
|
index: _GameStepManager.lastStepIndex,
|
|
2372
2456
|
choiceIndexMade: choiseMade
|
|
2373
2457
|
});
|
|
2374
|
-
_GameStepManager.originalStepData =
|
|
2458
|
+
_GameStepManager.originalStepData = currentStepData;
|
|
2375
2459
|
}
|
|
2376
2460
|
_GameStepManager.increaseLastStepIndex();
|
|
2377
2461
|
}
|
|
@@ -2462,6 +2546,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2462
2546
|
console.warn("[Pixi'VN] The player must make a choice");
|
|
2463
2547
|
return;
|
|
2464
2548
|
}
|
|
2549
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2550
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2551
|
+
}
|
|
2465
2552
|
_GameStepManager.increaseCurrentStepIndex();
|
|
2466
2553
|
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
2467
2554
|
});
|
|
@@ -2486,6 +2573,10 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2486
2573
|
return;
|
|
2487
2574
|
}
|
|
2488
2575
|
if (currentLabel.steps.length > currentLabelStepIndex) {
|
|
2576
|
+
let onStepRun = currentLabel.onStepStart;
|
|
2577
|
+
if (onStepRun) {
|
|
2578
|
+
yield onStepRun(currentLabelStepIndex, currentLabel);
|
|
2579
|
+
}
|
|
2489
2580
|
let step = currentLabel.steps[currentLabelStepIndex];
|
|
2490
2581
|
let result = yield step(props);
|
|
2491
2582
|
_GameStepManager.addStepHistory(step, choiseMade);
|
|
@@ -2550,6 +2641,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2550
2641
|
if (!tempLabel) {
|
|
2551
2642
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2552
2643
|
}
|
|
2644
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2645
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2646
|
+
}
|
|
2553
2647
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2554
2648
|
} catch (e) {
|
|
2555
2649
|
console.error("[Pixi'VN] Error calling label", e);
|
|
@@ -2608,6 +2702,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2608
2702
|
if (!tempLabel) {
|
|
2609
2703
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2610
2704
|
}
|
|
2705
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2706
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2707
|
+
}
|
|
2611
2708
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2612
2709
|
} catch (e) {
|
|
2613
2710
|
console.error("[Pixi'VN] Error jumping label", e);
|
|
@@ -2713,24 +2810,29 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2713
2810
|
* ```
|
|
2714
2811
|
*/
|
|
2715
2812
|
static goBack(navigate, steps = 1) {
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2813
|
+
return __async(this, null, function* () {
|
|
2814
|
+
if (steps <= 0) {
|
|
2815
|
+
console.warn("[Pixi'VN] Steps must be greater than 0");
|
|
2816
|
+
return;
|
|
2817
|
+
}
|
|
2818
|
+
if (_GameStepManager._stepsHistory.length <= 1) {
|
|
2819
|
+
console.warn("[Pixi'VN] No steps to go back");
|
|
2820
|
+
return;
|
|
2821
|
+
}
|
|
2822
|
+
let restoredStep = _GameStepManager.goBackInternal(steps, _GameStepManager.originalStepData);
|
|
2823
|
+
if (restoredStep) {
|
|
2824
|
+
_GameStepManager._originalStepData = restoredStep;
|
|
2825
|
+
_GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels);
|
|
2826
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2827
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2828
|
+
}
|
|
2829
|
+
GameStorageManager.import(createExportableElement(restoredStep.storage));
|
|
2830
|
+
GameWindowManager.import(createExportableElement(restoredStep.canvas));
|
|
2831
|
+
navigate(restoredStep.path);
|
|
2832
|
+
} else {
|
|
2833
|
+
console.error("[Pixi'VN] Error going back");
|
|
2834
|
+
}
|
|
2835
|
+
});
|
|
2734
2836
|
}
|
|
2735
2837
|
static goBackInternal(steps, restoredStep) {
|
|
2736
2838
|
if (steps <= 0) {
|
|
@@ -2792,38 +2894,45 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2792
2894
|
* @param dataString The history in a JSON string.
|
|
2793
2895
|
*/
|
|
2794
2896
|
static importJson(dataString) {
|
|
2795
|
-
|
|
2897
|
+
return __async(this, null, function* () {
|
|
2898
|
+
yield _GameStepManager.import(JSON.parse(dataString));
|
|
2899
|
+
});
|
|
2796
2900
|
}
|
|
2797
2901
|
/**
|
|
2798
2902
|
* Import the history from an object.
|
|
2799
2903
|
* @param data The history in an object.
|
|
2800
2904
|
*/
|
|
2801
2905
|
static import(data) {
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2906
|
+
return __async(this, null, function* () {
|
|
2907
|
+
_GameStepManager.clear();
|
|
2908
|
+
try {
|
|
2909
|
+
if (data.hasOwnProperty("stepsHistory")) {
|
|
2910
|
+
_GameStepManager._stepsHistory = data["stepsHistory"];
|
|
2911
|
+
} else {
|
|
2912
|
+
console.warn("[Pixi'VN] Could not import stepsHistory data, so will be ignored");
|
|
2913
|
+
}
|
|
2914
|
+
if (data.hasOwnProperty("openedLabels")) {
|
|
2915
|
+
_GameStepManager._openedLabels = data["openedLabels"];
|
|
2916
|
+
} else {
|
|
2917
|
+
console.warn("[Pixi'VN] Could not import openedLabels data, so will be ignored");
|
|
2918
|
+
}
|
|
2919
|
+
if (data.hasOwnProperty("lastStepIndex")) {
|
|
2920
|
+
_GameStepManager._lastStepIndex = data["lastStepIndex"];
|
|
2921
|
+
} else {
|
|
2922
|
+
console.warn("[Pixi'VN] Could not import lastStepIndex data, so will be ignored");
|
|
2923
|
+
}
|
|
2924
|
+
if (data.hasOwnProperty("originalStepData")) {
|
|
2925
|
+
_GameStepManager._originalStepData = data["originalStepData"];
|
|
2926
|
+
} else {
|
|
2927
|
+
console.warn("[Pixi'VN] Could not import originalStepData data, so will be ignored");
|
|
2928
|
+
}
|
|
2929
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2930
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2931
|
+
}
|
|
2932
|
+
} catch (e) {
|
|
2933
|
+
console.error("[Pixi'VN] Error importing data", e);
|
|
2823
2934
|
}
|
|
2824
|
-
}
|
|
2825
|
-
console.error("[Pixi'VN] Error importing data", e);
|
|
2826
|
-
}
|
|
2935
|
+
});
|
|
2827
2936
|
}
|
|
2828
2937
|
};
|
|
2829
2938
|
/**
|
|
@@ -2999,7 +3108,7 @@ var DialogueBaseModel = class {
|
|
|
2999
3108
|
var juliette = new CharacterBaseModel2("___pixivn_juliette___", {
|
|
3000
3109
|
name: "Juliette",
|
|
3001
3110
|
age: 25,
|
|
3002
|
-
icon: "https://firebasestorage.googleapis.com/v0/b/pixi-vn.appspot.com/o/public%2Fcharacters%2Fjuliette-square.webp?alt=media
|
|
3111
|
+
icon: "https://firebasestorage.googleapis.com/v0/b/pixi-vn.appspot.com/o/public%2Fcharacters%2Fjuliette-square.webp?alt=media",
|
|
3003
3112
|
color: "#ac0086"
|
|
3004
3113
|
});
|
|
3005
3114
|
saveCharacter(juliette);
|
|
@@ -3036,13 +3145,13 @@ var imagesAnimationsTest = newLabel(IMAGE_ANIMAIONS_TEST_LABEL, [
|
|
|
3036
3145
|
() => __async(void 0, null, function* () {
|
|
3037
3146
|
setDialogue({ character: juliette, text: "Here's what they can do." });
|
|
3038
3147
|
setChoiceMenuOptions([
|
|
3039
|
-
new ChoiceMenuOption("Dissolve effect", imagesDissolveTest),
|
|
3040
|
-
new ChoiceMenuOption("Fade effect", imagesFadeTest),
|
|
3041
|
-
new ChoiceMenuOption("Rotate", imagesRotateTest),
|
|
3042
|
-
new ChoiceMenuOption("Move", imagesMoveTest),
|
|
3043
|
-
new ChoiceMenuOption("Zoom", imagesZoomTest),
|
|
3044
|
-
new ChoiceMenuOption("Move in/out", imagesMoveInOutTest),
|
|
3045
|
-
new ChoiceMenuOption("Zoom in/out", imagesZoomInOutTest),
|
|
3148
|
+
new ChoiceMenuOption("Dissolve effect", imagesDissolveTest, {}),
|
|
3149
|
+
new ChoiceMenuOption("Fade effect", imagesFadeTest, {}),
|
|
3150
|
+
new ChoiceMenuOption("Rotate", imagesRotateTest, {}),
|
|
3151
|
+
new ChoiceMenuOption("Move", imagesMoveTest, {}),
|
|
3152
|
+
new ChoiceMenuOption("Zoom", imagesZoomTest, {}),
|
|
3153
|
+
new ChoiceMenuOption("Move in/out", imagesMoveInOutTest, {}),
|
|
3154
|
+
new ChoiceMenuOption("Zoom in/out", imagesZoomInOutTest, {}),
|
|
3046
3155
|
new ChoiceMenuOptionClose("Cancel", true)
|
|
3047
3156
|
]);
|
|
3048
3157
|
}),
|
|
@@ -3152,8 +3261,8 @@ var imagesRotateTest = newLabel("___pixi_vn_images_rotate_test___", [
|
|
|
3152
3261
|
text: `Here's what's going to happen:
|
|
3153
3262
|
- ${eggHeadName} will rotate with a anchor set to 0.
|
|
3154
3263
|
- ${flowerTopName} will rotate with a anchor set to 0.5 and a exponential speed progression.
|
|
3155
|
-
- ${helmlokName} will rotate with a anchor set to 0.5, rotate 2
|
|
3156
|
-
- ${skullyName} will rotate with a anchor set to 1, rotate 3
|
|
3264
|
+
- ${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.
|
|
3265
|
+
- ${skullyName} will rotate with a anchor set to 1, rotate 3 seconds clockwise, wait for 0.5 seconds, and rotate 7 seconds counterclockwise.`
|
|
3157
3266
|
});
|
|
3158
3267
|
let eggHead = GameWindowManager.getCanvasElement("eggHead");
|
|
3159
3268
|
if (eggHead)
|
|
@@ -3206,10 +3315,10 @@ var imagesMoveTest = newLabel("___pixi_vn_images_move_test___", [
|
|
|
3206
3315
|
setDialogue({
|
|
3207
3316
|
character: juliette,
|
|
3208
3317
|
text: `Here's what's going to happen:
|
|
3209
|
-
- ${eggHeadName} will move to { x: 500, y: 100 } with a speed of
|
|
3210
|
-
- ${flowerTopName} will move to { x: 500, y: 300 } with a speed of
|
|
3211
|
-
- ${helmlokName} will move to
|
|
3212
|
-
- ${skullyName} will move to { x: 500, y: 500 } with a speed of
|
|
3318
|
+
- ${eggHeadName} will move to { x: 500, y: 100 } with a speed of 24.
|
|
3319
|
+
- ${flowerTopName} will move to { x: 500, y: 300 } with a speed of 18.
|
|
3320
|
+
- ${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.
|
|
3321
|
+
- ${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.`
|
|
3213
3322
|
});
|
|
3214
3323
|
GameWindowManager.addTicker("eggHead", new MoveTicker({
|
|
3215
3324
|
destination: { x: 500, y: 100 },
|
|
@@ -3222,25 +3331,25 @@ var imagesMoveTest = newLabel("___pixi_vn_images_move_test___", [
|
|
|
3222
3331
|
GameWindowManager.addTickersSteps("helmlok", [
|
|
3223
3332
|
new MoveTicker({
|
|
3224
3333
|
destination: { x: 100, y: 500 },
|
|
3225
|
-
speed:
|
|
3226
|
-
speedProgression: { type: "linear", amt: -
|
|
3334
|
+
speed: 150,
|
|
3335
|
+
speedProgression: { type: "linear", amt: -2, limit: 10 }
|
|
3227
3336
|
}),
|
|
3228
3337
|
new MoveTicker({
|
|
3229
3338
|
destination: { x: 1700, y: 500 },
|
|
3230
|
-
speed:
|
|
3231
|
-
speedProgression: { type: "linear", amt:
|
|
3339
|
+
speed: 10,
|
|
3340
|
+
speedProgression: { type: "linear", amt: 2, limit: 150 }
|
|
3232
3341
|
}),
|
|
3233
3342
|
Repeat
|
|
3234
3343
|
]);
|
|
3235
3344
|
GameWindowManager.addTickersSteps("skully", [
|
|
3236
3345
|
new MoveTicker({
|
|
3237
3346
|
destination: { x: 500, y: 500 },
|
|
3238
|
-
speed:
|
|
3347
|
+
speed: 40
|
|
3239
3348
|
}),
|
|
3240
3349
|
Pause(0.5),
|
|
3241
3350
|
new MoveTicker({
|
|
3242
3351
|
destination: { x: 100, y: 100 },
|
|
3243
|
-
speed:
|
|
3352
|
+
speed: 40
|
|
3244
3353
|
})
|
|
3245
3354
|
]);
|
|
3246
3355
|
}
|
|
@@ -3302,37 +3411,45 @@ var imagesMoveInOutTest = newLabel("___pixi_vn_images_move_in_out_test___", [
|
|
|
3302
3411
|
setDialogue({
|
|
3303
3412
|
character: juliette,
|
|
3304
3413
|
text: `Here's what's going to happen:
|
|
3305
|
-
- ${eggHeadName} will move in from the top with a speed of
|
|
3306
|
-
- ${flowerTopName} will move in from the right with a speed of
|
|
3307
|
-
- ${helmlokName} will move in from the left with a speed of
|
|
3308
|
-
- ${skullyName} will move in from the bottom with a speed of
|
|
3414
|
+
- ${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.
|
|
3415
|
+
- ${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.
|
|
3416
|
+
- ${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.
|
|
3417
|
+
- ${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.`
|
|
3309
3418
|
});
|
|
3310
3419
|
let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
|
|
3311
3420
|
let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
|
|
3312
3421
|
let helmlok = new CanvasImage({ x: 100, y: 300 }, helmlokImage);
|
|
3313
3422
|
let skully = new CanvasImage({ x: 300, y: 300 }, skullyImage);
|
|
3314
|
-
moveIn("eggHead", eggHead, { speed:
|
|
3423
|
+
moveIn("eggHead", eggHead, { speed: 80, direction: "down" });
|
|
3315
3424
|
moveIn("flowerTop", flowerTop, {
|
|
3316
|
-
speed:
|
|
3425
|
+
speed: 80,
|
|
3317
3426
|
direction: "left",
|
|
3318
3427
|
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3319
3428
|
});
|
|
3320
|
-
moveIn("helmlok", helmlok, { speed:
|
|
3429
|
+
moveIn("helmlok", helmlok, { speed: 80, direction: "right" });
|
|
3321
3430
|
moveIn("skully", skully, {
|
|
3322
|
-
speed:
|
|
3431
|
+
speed: 80,
|
|
3323
3432
|
direction: "up",
|
|
3324
3433
|
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3325
3434
|
});
|
|
3326
3435
|
}),
|
|
3327
3436
|
() => {
|
|
3328
|
-
moveOut("eggHead", { speed:
|
|
3329
|
-
moveOut("flowerTop", { speed:
|
|
3330
|
-
moveOut("helmlok", { speed:
|
|
3331
|
-
moveOut("skully", { speed:
|
|
3437
|
+
moveOut("eggHead", { speed: 80, direction: "down" });
|
|
3438
|
+
moveOut("flowerTop", { speed: 80, direction: "left" });
|
|
3439
|
+
moveOut("helmlok", { speed: 80, direction: "right" });
|
|
3440
|
+
moveOut("skully", { speed: 80, direction: "up" });
|
|
3332
3441
|
}
|
|
3333
3442
|
]);
|
|
3334
3443
|
var imagesZoomInOutTest = newLabel("___pixi_vn_images_zoom_in_out_test___", [
|
|
3335
3444
|
() => __async(void 0, null, function* () {
|
|
3445
|
+
setDialogue({
|
|
3446
|
+
character: juliette,
|
|
3447
|
+
text: `Here's what's going to happen:
|
|
3448
|
+
- ${eggHeadName} will zoom in with a speed of 3. If you go next, ${eggHeadName} will zoom out with a speed of 3.
|
|
3449
|
+
- ${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.
|
|
3450
|
+
- ${helmlokName} will zoom in with a speed of 3. If you go next, ${helmlokName} will zoom out with a speed of 1.
|
|
3451
|
+
- ${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.`
|
|
3452
|
+
});
|
|
3336
3453
|
GameWindowManager.removeCanvasElements();
|
|
3337
3454
|
let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
|
|
3338
3455
|
let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
|
|
@@ -3358,7 +3475,7 @@ var imagesZoomInOutTest = newLabel("___pixi_vn_images_zoom_in_out_test___", [
|
|
|
3358
3475
|
speedProgression: { type: "exponential", percentage: 0.02 }
|
|
3359
3476
|
});
|
|
3360
3477
|
zoomOut("flowerTop", { speed: 3, direction: "left" });
|
|
3361
|
-
zoomOut("helmlok", { speed:
|
|
3478
|
+
zoomOut("helmlok", { speed: 1, direction: "right" });
|
|
3362
3479
|
zoomOut("skully", {
|
|
3363
3480
|
speed: 3,
|
|
3364
3481
|
direction: "up",
|