@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,4 +1,4 @@
|
|
|
1
|
-
import { Texture, Sprite, Container,
|
|
1
|
+
import { Texture, Sprite, Container, Assets, Application, Text } from 'pixi.js';
|
|
2
2
|
import { diff } from 'deep-diff';
|
|
3
3
|
import sha1 from 'crypto-js/sha1';
|
|
4
4
|
|
|
@@ -72,19 +72,18 @@ function checkIfStepsIsEqual(step1, step2) {
|
|
|
72
72
|
return step1 === step2;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
// src/classes/
|
|
76
|
-
var
|
|
75
|
+
// src/classes/LabelAbstract.ts
|
|
76
|
+
var LabelAbstract = class {
|
|
77
77
|
/**
|
|
78
78
|
* @param id is the id of the label
|
|
79
|
-
* @param
|
|
80
|
-
* @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
|
|
81
|
-
* @param choiseIndex is the index of the choice that the label will perform
|
|
79
|
+
* @param props is the properties of the label
|
|
82
80
|
*/
|
|
83
|
-
constructor(id,
|
|
81
|
+
constructor(id, props) {
|
|
84
82
|
this._id = id;
|
|
85
|
-
this.
|
|
86
|
-
this.
|
|
87
|
-
this.
|
|
83
|
+
this._onStepStart = props == null ? void 0 : props.onStepStart;
|
|
84
|
+
this._onLoadStep = props == null ? void 0 : props.onLoadStep;
|
|
85
|
+
this._onStepEnd = props == null ? void 0 : props.onStepEnd;
|
|
86
|
+
this._choiseIndex = props == null ? void 0 : props.choiseIndex;
|
|
88
87
|
}
|
|
89
88
|
/**
|
|
90
89
|
* Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
|
|
@@ -92,17 +91,6 @@ var Label = class {
|
|
|
92
91
|
get id() {
|
|
93
92
|
return this._id;
|
|
94
93
|
}
|
|
95
|
-
/**
|
|
96
|
-
* Get the steps of the label.
|
|
97
|
-
* This class should be extended and the steps method should be overridden.
|
|
98
|
-
* Every time you update this list will also be updated when the other game versions load.
|
|
99
|
-
*/
|
|
100
|
-
get steps() {
|
|
101
|
-
if (typeof this._steps === "function") {
|
|
102
|
-
return this._steps();
|
|
103
|
-
}
|
|
104
|
-
return this._steps;
|
|
105
|
-
}
|
|
106
94
|
/**
|
|
107
95
|
* Get the corresponding steps number
|
|
108
96
|
* @param externalSteps
|
|
@@ -121,37 +109,75 @@ var Label = class {
|
|
|
121
109
|
return res;
|
|
122
110
|
}
|
|
123
111
|
/**
|
|
124
|
-
*
|
|
112
|
+
* 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.
|
|
113
|
+
* @returns Promise<void> or void
|
|
114
|
+
*/
|
|
115
|
+
get onStepStart() {
|
|
116
|
+
return (stepIndex, label) => __async(this, null, function* () {
|
|
117
|
+
if (this._onLoadStep) {
|
|
118
|
+
yield this._onLoadStep(stepIndex, label);
|
|
119
|
+
}
|
|
120
|
+
if (this._onStepStart) {
|
|
121
|
+
return yield this._onStepStart(stepIndex, label);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* 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.
|
|
127
|
+
* @returns Promise<void> or void
|
|
128
|
+
*/
|
|
129
|
+
get onLoadStep() {
|
|
130
|
+
return this._onLoadStep;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Is a function that will be executed when the step ends.
|
|
125
134
|
* @returns Promise<void> or void
|
|
126
|
-
* @example
|
|
127
|
-
* ```typescript
|
|
128
|
-
* newLabel("id", [], () => {
|
|
129
|
-
* Assets.load('path/to/image1.png')
|
|
130
|
-
* Assets.load('path/to/image2.png')
|
|
131
|
-
* })
|
|
132
|
-
* ```
|
|
133
135
|
*/
|
|
134
|
-
get
|
|
135
|
-
return this.
|
|
136
|
+
get onStepEnd() {
|
|
137
|
+
return this._onStepEnd;
|
|
136
138
|
}
|
|
137
139
|
get choiseIndex() {
|
|
138
140
|
return this._choiseIndex;
|
|
139
141
|
}
|
|
140
142
|
};
|
|
141
143
|
|
|
144
|
+
// src/classes/Label.ts
|
|
145
|
+
var Label = class extends LabelAbstract {
|
|
146
|
+
/**
|
|
147
|
+
* @param id is the id of the label
|
|
148
|
+
* @param steps is the list of steps that the label will perform
|
|
149
|
+
* @param props is the properties of the label
|
|
150
|
+
*/
|
|
151
|
+
constructor(id, steps, props) {
|
|
152
|
+
super(id, props);
|
|
153
|
+
this._steps = steps;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Get the steps of the label.
|
|
157
|
+
*/
|
|
158
|
+
get steps() {
|
|
159
|
+
if (typeof this._steps === "function") {
|
|
160
|
+
return this._steps();
|
|
161
|
+
}
|
|
162
|
+
return this._steps;
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
|
|
142
166
|
// src/classes/CloseLabel.ts
|
|
143
167
|
var CLOSE_LABEL_ID = "__close-label-id__";
|
|
144
168
|
function newCloseLabel(choiseIndex) {
|
|
145
|
-
return new Label(CLOSE_LABEL_ID, [],
|
|
169
|
+
return new Label(CLOSE_LABEL_ID, [], {
|
|
170
|
+
choiseIndex
|
|
171
|
+
});
|
|
146
172
|
}
|
|
147
173
|
|
|
148
174
|
// src/decorators/LabelDecorator.ts
|
|
149
175
|
var registeredLabels = {};
|
|
150
|
-
function newLabel(id, steps,
|
|
176
|
+
function newLabel(id, steps, props) {
|
|
151
177
|
if (registeredLabels[id]) {
|
|
152
178
|
console.info(`[Pixi'VN] Label ${id} already exists, it will be overwritten`);
|
|
153
179
|
}
|
|
154
|
-
let label = new Label(id, steps,
|
|
180
|
+
let label = new Label(id, steps, props);
|
|
155
181
|
registeredLabels[id] = label;
|
|
156
182
|
return label;
|
|
157
183
|
}
|
|
@@ -240,8 +266,6 @@ function getMemoryContainer(element) {
|
|
|
240
266
|
};
|
|
241
267
|
}
|
|
242
268
|
function setMemoryContainer(element, memory) {
|
|
243
|
-
memory.width && (element.width = memory.width);
|
|
244
|
-
memory.height && (element.height = memory.height);
|
|
245
269
|
memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
|
|
246
270
|
memory.blendMode && (element.blendMode = memory.blendMode);
|
|
247
271
|
memory.tint && (element.tint = memory.tint);
|
|
@@ -274,6 +298,8 @@ function setMemoryContainer(element, memory) {
|
|
|
274
298
|
memory.interactive && (element.interactive = memory.interactive);
|
|
275
299
|
memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
|
|
276
300
|
memory.hitArea && (element.hitArea = memory.hitArea);
|
|
301
|
+
memory.width && (element.width = memory.width);
|
|
302
|
+
memory.height && (element.height = memory.height);
|
|
277
303
|
}
|
|
278
304
|
function getTexture(imageUrl) {
|
|
279
305
|
return __async(this, null, function* () {
|
|
@@ -702,6 +728,106 @@ function geTickerInstanceById(tickerId, args, duration, priority) {
|
|
|
702
728
|
// src/types/CloseType.ts
|
|
703
729
|
var Close = "close";
|
|
704
730
|
|
|
731
|
+
// src/classes/ChoiceMenuOption.ts
|
|
732
|
+
var ChoiceMenuOption = class {
|
|
733
|
+
/**
|
|
734
|
+
* @param text Text to be displayed in the menu
|
|
735
|
+
* @param label Label to be opened when the option is selected or the id of the label
|
|
736
|
+
* @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.
|
|
737
|
+
* @param type Type of the label to be opened. @default "call"
|
|
738
|
+
*/
|
|
739
|
+
constructor(text, label, props, type = "call") {
|
|
740
|
+
/**
|
|
741
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
742
|
+
* @example
|
|
743
|
+
* ```tsx
|
|
744
|
+
* setChoiceMenuOptions([
|
|
745
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
746
|
+
* ])
|
|
747
|
+
* return <List>
|
|
748
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
749
|
+
* return (
|
|
750
|
+
* <ChoiceButton
|
|
751
|
+
* disabled={item.props.disabled}
|
|
752
|
+
* onClick={() => {
|
|
753
|
+
* afterSelectChoice(item)
|
|
754
|
+
* }}
|
|
755
|
+
* >
|
|
756
|
+
* {item.text}
|
|
757
|
+
* </ChoiceButton>
|
|
758
|
+
* )
|
|
759
|
+
* })}
|
|
760
|
+
* </List>
|
|
761
|
+
* ```
|
|
762
|
+
*/
|
|
763
|
+
this.props = {};
|
|
764
|
+
this.text = text;
|
|
765
|
+
this._label = label;
|
|
766
|
+
this.type = type;
|
|
767
|
+
if (props) {
|
|
768
|
+
this.props = props;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Label to be opened when the option is selected
|
|
773
|
+
*/
|
|
774
|
+
get label() {
|
|
775
|
+
let label = this._label;
|
|
776
|
+
if (typeof label === "string") {
|
|
777
|
+
let res = getLabelById(label);
|
|
778
|
+
if (res) {
|
|
779
|
+
label = res;
|
|
780
|
+
} else {
|
|
781
|
+
console.error(`Label ${label} not found, so it will be closed`);
|
|
782
|
+
label = newCloseLabel();
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
return label;
|
|
786
|
+
}
|
|
787
|
+
};
|
|
788
|
+
var ChoiceMenuOptionClose = class {
|
|
789
|
+
/**
|
|
790
|
+
* @param text Text to be displayed in the menu
|
|
791
|
+
* @param closeCurrentLabel If true, the current label will be closed. @default false
|
|
792
|
+
*/
|
|
793
|
+
constructor(text, closeCurrentLabel = false) {
|
|
794
|
+
/**
|
|
795
|
+
* Label to be opened when the option is selected
|
|
796
|
+
*/
|
|
797
|
+
this.label = newCloseLabel();
|
|
798
|
+
/**
|
|
799
|
+
* Type of the label to be opened
|
|
800
|
+
*/
|
|
801
|
+
this.type = Close;
|
|
802
|
+
/**
|
|
803
|
+
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
|
|
804
|
+
* @example
|
|
805
|
+
* ```tsx
|
|
806
|
+
* setChoiceMenuOptions([
|
|
807
|
+
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
|
|
808
|
+
* ])
|
|
809
|
+
* return <List>
|
|
810
|
+
* {getChoiceMenuOptions()?.map((item, index) => {
|
|
811
|
+
* return (
|
|
812
|
+
* <ChoiceButton
|
|
813
|
+
* disabled={item.props.disabled}
|
|
814
|
+
* onClick={() => {
|
|
815
|
+
* afterSelectChoice(item)
|
|
816
|
+
* }}
|
|
817
|
+
* >
|
|
818
|
+
* {item.text}
|
|
819
|
+
* </ChoiceButton>
|
|
820
|
+
* )
|
|
821
|
+
* })}
|
|
822
|
+
* </List>
|
|
823
|
+
* ```
|
|
824
|
+
*/
|
|
825
|
+
this.props = {};
|
|
826
|
+
this.text = text;
|
|
827
|
+
this.closeCurrentLabel = closeCurrentLabel;
|
|
828
|
+
}
|
|
829
|
+
};
|
|
830
|
+
|
|
705
831
|
// src/functions/DialogueUtility.ts
|
|
706
832
|
function setDialogue(props) {
|
|
707
833
|
let text = "";
|
|
@@ -736,21 +862,18 @@ function getChoiceMenuOptions() {
|
|
|
736
862
|
d.forEach((option, index) => {
|
|
737
863
|
if (option.type === Close) {
|
|
738
864
|
let itemLabel = newCloseLabel(index);
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
type: Close,
|
|
743
|
-
closeCurrentLabel: option.closeCurrentLabel,
|
|
744
|
-
props: {}
|
|
745
|
-
});
|
|
865
|
+
let choice = new ChoiceMenuOptionClose(option.text, option.closeCurrentLabel);
|
|
866
|
+
choice.label = itemLabel;
|
|
867
|
+
options.push(choice);
|
|
746
868
|
return;
|
|
747
869
|
}
|
|
748
870
|
let label = getLabelById(option.label);
|
|
749
871
|
if (label) {
|
|
750
|
-
let itemLabel = new Label(label.id, label.steps,
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
})
|
|
872
|
+
let itemLabel = new Label(label.id, label.steps, {
|
|
873
|
+
onStepStart: label.onStepStart,
|
|
874
|
+
choiseIndex: index
|
|
875
|
+
});
|
|
876
|
+
options.push(new ChoiceMenuOption(option.text, itemLabel, option.props, option.type));
|
|
754
877
|
}
|
|
755
878
|
});
|
|
756
879
|
return options;
|
|
@@ -838,8 +961,9 @@ FadeAlphaTicker = __decorateClass([
|
|
|
838
961
|
], FadeAlphaTicker);
|
|
839
962
|
|
|
840
963
|
// src/functions/TickerUtility.ts
|
|
841
|
-
function updateTickerProgression(args, propertyName, progression) {
|
|
842
|
-
|
|
964
|
+
function updateTickerProgression(args, propertyName, progression, valueConvert) {
|
|
965
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
966
|
+
if (args[propertyName] === void 0 || !progression || args[propertyName] === limit) {
|
|
843
967
|
return;
|
|
844
968
|
}
|
|
845
969
|
if (typeof args[propertyName] === "number") {
|
|
@@ -858,22 +982,25 @@ function updateTickerProgression(args, propertyName, progression) {
|
|
|
858
982
|
}
|
|
859
983
|
}
|
|
860
984
|
}
|
|
861
|
-
function getLinearProgression(number, progression) {
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
return
|
|
985
|
+
function getLinearProgression(number, progression, valueConvert) {
|
|
986
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
987
|
+
let amt = valueConvert ? valueConvert(progression.amt) : progression.amt;
|
|
988
|
+
if (limit !== void 0) {
|
|
989
|
+
if (number > limit && amt > 0) {
|
|
990
|
+
return limit;
|
|
991
|
+
} else if (number < limit && amt < 0) {
|
|
992
|
+
return limit;
|
|
867
993
|
}
|
|
868
994
|
}
|
|
869
|
-
return number +
|
|
995
|
+
return number + amt;
|
|
870
996
|
}
|
|
871
|
-
function getExponentialProgression(number, progression) {
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
997
|
+
function getExponentialProgression(number, progression, valueConvert) {
|
|
998
|
+
let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
|
|
999
|
+
if (limit !== void 0) {
|
|
1000
|
+
if (number > limit && progression.percentage > 0) {
|
|
1001
|
+
return limit;
|
|
1002
|
+
} else if (number < limit && progression.percentage < 0) {
|
|
1003
|
+
return limit;
|
|
877
1004
|
}
|
|
878
1005
|
}
|
|
879
1006
|
return number + number * progression.percentage;
|
|
@@ -886,15 +1013,13 @@ var MoveTicker = class extends TickerBase {
|
|
|
886
1013
|
let ySpeed = 1;
|
|
887
1014
|
if (args.speed) {
|
|
888
1015
|
if (typeof args.speed === "number") {
|
|
889
|
-
xSpeed = args.speed;
|
|
890
|
-
ySpeed = args.speed;
|
|
1016
|
+
xSpeed = this.speedConvert(args.speed);
|
|
1017
|
+
ySpeed = this.speedConvert(args.speed);
|
|
891
1018
|
} else {
|
|
892
|
-
xSpeed = args.speed.x;
|
|
893
|
-
ySpeed = args.speed.y;
|
|
1019
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
1020
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
894
1021
|
}
|
|
895
1022
|
}
|
|
896
|
-
xSpeed /= 60;
|
|
897
|
-
ySpeed /= 60;
|
|
898
1023
|
let destination = args.destination;
|
|
899
1024
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
900
1025
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -934,7 +1059,10 @@ var MoveTicker = class extends TickerBase {
|
|
|
934
1059
|
}
|
|
935
1060
|
});
|
|
936
1061
|
if (args.speedProgression)
|
|
937
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1062
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1063
|
+
}
|
|
1064
|
+
speedConvert(speed) {
|
|
1065
|
+
return speed / 6;
|
|
938
1066
|
}
|
|
939
1067
|
};
|
|
940
1068
|
MoveTicker = __decorateClass([
|
|
@@ -942,7 +1070,7 @@ MoveTicker = __decorateClass([
|
|
|
942
1070
|
], MoveTicker);
|
|
943
1071
|
var RotateTicker = class extends TickerBase {
|
|
944
1072
|
fn(ticker, args, tags, tickerId) {
|
|
945
|
-
let speed = (args.speed === void 0 ? 1 : args.speed)
|
|
1073
|
+
let speed = this.speedConvert(args.speed === void 0 ? 1 : args.speed);
|
|
946
1074
|
let clockwise = args.clockwise === void 0 ? true : args.clockwise;
|
|
947
1075
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
948
1076
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
@@ -970,7 +1098,10 @@ var RotateTicker = class extends TickerBase {
|
|
|
970
1098
|
}
|
|
971
1099
|
});
|
|
972
1100
|
if (args.speedProgression)
|
|
973
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1101
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1102
|
+
}
|
|
1103
|
+
speedConvert(speed) {
|
|
1104
|
+
return speed / 60;
|
|
974
1105
|
}
|
|
975
1106
|
};
|
|
976
1107
|
RotateTicker = __decorateClass([
|
|
@@ -982,15 +1113,13 @@ var ZoomTicker = class extends TickerBase {
|
|
|
982
1113
|
let ySpeed = 0.1;
|
|
983
1114
|
if (args.speed) {
|
|
984
1115
|
if (typeof args.speed === "number") {
|
|
985
|
-
xSpeed = args.speed;
|
|
986
|
-
ySpeed = args.speed;
|
|
1116
|
+
xSpeed = this.speedConvert(args.speed);
|
|
1117
|
+
ySpeed = this.speedConvert(args.speed);
|
|
987
1118
|
} else {
|
|
988
|
-
xSpeed = args.speed.x;
|
|
989
|
-
ySpeed = args.speed.y;
|
|
1119
|
+
xSpeed = this.speedConvert(args.speed.x);
|
|
1120
|
+
ySpeed = this.speedConvert(args.speed.y);
|
|
990
1121
|
}
|
|
991
1122
|
}
|
|
992
|
-
xSpeed /= 60;
|
|
993
|
-
ySpeed /= 60;
|
|
994
1123
|
let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
|
|
995
1124
|
if (typeof tagToRemoveAfter2 === "string") {
|
|
996
1125
|
tagToRemoveAfter2 = [tagToRemoveAfter2];
|
|
@@ -1057,7 +1186,10 @@ var ZoomTicker = class extends TickerBase {
|
|
|
1057
1186
|
}
|
|
1058
1187
|
});
|
|
1059
1188
|
if (args.speedProgression)
|
|
1060
|
-
updateTickerProgression(args, "speed", args.speedProgression);
|
|
1189
|
+
updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
|
|
1190
|
+
}
|
|
1191
|
+
speedConvert(speed) {
|
|
1192
|
+
return speed / 60;
|
|
1061
1193
|
}
|
|
1062
1194
|
onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
|
|
1063
1195
|
GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
|
|
@@ -2019,6 +2151,16 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2019
2151
|
static set originalStepData(value) {
|
|
2020
2152
|
_GameStepManager._originalStepData = createExportableElement(value);
|
|
2021
2153
|
}
|
|
2154
|
+
static get currentStepData() {
|
|
2155
|
+
let currentStepData = {
|
|
2156
|
+
path: window.location.pathname,
|
|
2157
|
+
storage: GameStorageManager.export(),
|
|
2158
|
+
canvas: GameWindowManager.export(),
|
|
2159
|
+
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
2160
|
+
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
2161
|
+
};
|
|
2162
|
+
return currentStepData;
|
|
2163
|
+
}
|
|
2022
2164
|
/* Edit History Methods */
|
|
2023
2165
|
/**
|
|
2024
2166
|
* Add a label to the history.
|
|
@@ -2026,19 +2168,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2026
2168
|
*/
|
|
2027
2169
|
static addStepHistory(step, choiseMade) {
|
|
2028
2170
|
let stepHistory = getStepSha1(step);
|
|
2029
|
-
let
|
|
2030
|
-
path: window.location.pathname,
|
|
2031
|
-
storage: GameStorageManager.export(),
|
|
2032
|
-
canvas: GameWindowManager.export(),
|
|
2033
|
-
labelIndex: _GameStepManager.currentLabelStepIndex || 0,
|
|
2034
|
-
openedLabels: createExportableElement(_GameStepManager._openedLabels)
|
|
2035
|
-
};
|
|
2171
|
+
let currentStepData = _GameStepManager.currentStepData;
|
|
2036
2172
|
if (_GameStepManager.originalStepData) {
|
|
2037
|
-
if (_GameStepManager.originalStepData.openedLabels.length ===
|
|
2173
|
+
if (_GameStepManager.originalStepData.openedLabels.length === currentStepData.openedLabels.length) {
|
|
2038
2174
|
try {
|
|
2039
2175
|
let lastStepDataOpenedLabelsString = JSON.stringify(_GameStepManager.originalStepData.openedLabels);
|
|
2040
|
-
let historyStepOpenedLabelsString = JSON.stringify(
|
|
2041
|
-
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path ===
|
|
2176
|
+
let historyStepOpenedLabelsString = JSON.stringify(currentStepData.openedLabels);
|
|
2177
|
+
if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path === currentStepData.path && _GameStepManager.originalStepData.labelIndex === currentStepData.labelIndex) {
|
|
2042
2178
|
return;
|
|
2043
2179
|
}
|
|
2044
2180
|
} catch (e) {
|
|
@@ -2046,7 +2182,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2046
2182
|
}
|
|
2047
2183
|
}
|
|
2048
2184
|
}
|
|
2049
|
-
let data = diff(_GameStepManager.originalStepData,
|
|
2185
|
+
let data = diff(_GameStepManager.originalStepData, currentStepData);
|
|
2050
2186
|
if (data) {
|
|
2051
2187
|
let dialoge = void 0;
|
|
2052
2188
|
let requiredChoices = void 0;
|
|
@@ -2065,7 +2201,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2065
2201
|
index: _GameStepManager.lastStepIndex,
|
|
2066
2202
|
choiceIndexMade: choiseMade
|
|
2067
2203
|
});
|
|
2068
|
-
_GameStepManager.originalStepData =
|
|
2204
|
+
_GameStepManager.originalStepData = currentStepData;
|
|
2069
2205
|
}
|
|
2070
2206
|
_GameStepManager.increaseLastStepIndex();
|
|
2071
2207
|
}
|
|
@@ -2156,6 +2292,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2156
2292
|
console.warn("[Pixi'VN] The player must make a choice");
|
|
2157
2293
|
return;
|
|
2158
2294
|
}
|
|
2295
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2296
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2297
|
+
}
|
|
2159
2298
|
_GameStepManager.increaseCurrentStepIndex();
|
|
2160
2299
|
return yield _GameStepManager.runCurrentStep(props, choiseMade);
|
|
2161
2300
|
});
|
|
@@ -2180,6 +2319,10 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2180
2319
|
return;
|
|
2181
2320
|
}
|
|
2182
2321
|
if (currentLabel.steps.length > currentLabelStepIndex) {
|
|
2322
|
+
let onStepRun = currentLabel.onStepStart;
|
|
2323
|
+
if (onStepRun) {
|
|
2324
|
+
yield onStepRun(currentLabelStepIndex, currentLabel);
|
|
2325
|
+
}
|
|
2183
2326
|
let step = currentLabel.steps[currentLabelStepIndex];
|
|
2184
2327
|
let result = yield step(props);
|
|
2185
2328
|
_GameStepManager.addStepHistory(step, choiseMade);
|
|
@@ -2244,6 +2387,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2244
2387
|
if (!tempLabel) {
|
|
2245
2388
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2246
2389
|
}
|
|
2390
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2391
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2392
|
+
}
|
|
2247
2393
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2248
2394
|
} catch (e) {
|
|
2249
2395
|
console.error("[Pixi'VN] Error calling label", e);
|
|
@@ -2302,6 +2448,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2302
2448
|
if (!tempLabel) {
|
|
2303
2449
|
throw new Error(`[Pixi'VN] Label ${labelId} not found`);
|
|
2304
2450
|
}
|
|
2451
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
|
|
2452
|
+
yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2453
|
+
}
|
|
2305
2454
|
_GameStepManager.pushNewLabel(tempLabel.id);
|
|
2306
2455
|
} catch (e) {
|
|
2307
2456
|
console.error("[Pixi'VN] Error jumping label", e);
|
|
@@ -2407,24 +2556,29 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2407
2556
|
* ```
|
|
2408
2557
|
*/
|
|
2409
2558
|
static goBack(navigate, steps = 1) {
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2559
|
+
return __async(this, null, function* () {
|
|
2560
|
+
if (steps <= 0) {
|
|
2561
|
+
console.warn("[Pixi'VN] Steps must be greater than 0");
|
|
2562
|
+
return;
|
|
2563
|
+
}
|
|
2564
|
+
if (_GameStepManager._stepsHistory.length <= 1) {
|
|
2565
|
+
console.warn("[Pixi'VN] No steps to go back");
|
|
2566
|
+
return;
|
|
2567
|
+
}
|
|
2568
|
+
let restoredStep = _GameStepManager.goBackInternal(steps, _GameStepManager.originalStepData);
|
|
2569
|
+
if (restoredStep) {
|
|
2570
|
+
_GameStepManager._originalStepData = restoredStep;
|
|
2571
|
+
_GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels);
|
|
2572
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2573
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2574
|
+
}
|
|
2575
|
+
GameStorageManager.import(createExportableElement(restoredStep.storage));
|
|
2576
|
+
GameWindowManager.import(createExportableElement(restoredStep.canvas));
|
|
2577
|
+
navigate(restoredStep.path);
|
|
2578
|
+
} else {
|
|
2579
|
+
console.error("[Pixi'VN] Error going back");
|
|
2580
|
+
}
|
|
2581
|
+
});
|
|
2428
2582
|
}
|
|
2429
2583
|
static goBackInternal(steps, restoredStep) {
|
|
2430
2584
|
if (steps <= 0) {
|
|
@@ -2486,38 +2640,45 @@ var _GameStepManager = class _GameStepManager {
|
|
|
2486
2640
|
* @param dataString The history in a JSON string.
|
|
2487
2641
|
*/
|
|
2488
2642
|
static importJson(dataString) {
|
|
2489
|
-
|
|
2643
|
+
return __async(this, null, function* () {
|
|
2644
|
+
yield _GameStepManager.import(JSON.parse(dataString));
|
|
2645
|
+
});
|
|
2490
2646
|
}
|
|
2491
2647
|
/**
|
|
2492
2648
|
* Import the history from an object.
|
|
2493
2649
|
* @param data The history in an object.
|
|
2494
2650
|
*/
|
|
2495
2651
|
static import(data) {
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2652
|
+
return __async(this, null, function* () {
|
|
2653
|
+
_GameStepManager.clear();
|
|
2654
|
+
try {
|
|
2655
|
+
if (data.hasOwnProperty("stepsHistory")) {
|
|
2656
|
+
_GameStepManager._stepsHistory = data["stepsHistory"];
|
|
2657
|
+
} else {
|
|
2658
|
+
console.warn("[Pixi'VN] Could not import stepsHistory data, so will be ignored");
|
|
2659
|
+
}
|
|
2660
|
+
if (data.hasOwnProperty("openedLabels")) {
|
|
2661
|
+
_GameStepManager._openedLabels = data["openedLabels"];
|
|
2662
|
+
} else {
|
|
2663
|
+
console.warn("[Pixi'VN] Could not import openedLabels data, so will be ignored");
|
|
2664
|
+
}
|
|
2665
|
+
if (data.hasOwnProperty("lastStepIndex")) {
|
|
2666
|
+
_GameStepManager._lastStepIndex = data["lastStepIndex"];
|
|
2667
|
+
} else {
|
|
2668
|
+
console.warn("[Pixi'VN] Could not import lastStepIndex data, so will be ignored");
|
|
2669
|
+
}
|
|
2670
|
+
if (data.hasOwnProperty("originalStepData")) {
|
|
2671
|
+
_GameStepManager._originalStepData = data["originalStepData"];
|
|
2672
|
+
} else {
|
|
2673
|
+
console.warn("[Pixi'VN] Could not import originalStepData data, so will be ignored");
|
|
2674
|
+
}
|
|
2675
|
+
if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
|
|
2676
|
+
yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
|
|
2677
|
+
}
|
|
2678
|
+
} catch (e) {
|
|
2679
|
+
console.error("[Pixi'VN] Error importing data", e);
|
|
2517
2680
|
}
|
|
2518
|
-
}
|
|
2519
|
-
console.error("[Pixi'VN] Error importing data", e);
|
|
2520
|
-
}
|
|
2681
|
+
});
|
|
2521
2682
|
}
|
|
2522
2683
|
};
|
|
2523
2684
|
/**
|
|
@@ -2693,7 +2854,7 @@ var DialogueBaseModel = class {
|
|
|
2693
2854
|
var juliette = new CharacterBaseModel2("___pixivn_juliette___", {
|
|
2694
2855
|
name: "Juliette",
|
|
2695
2856
|
age: 25,
|
|
2696
|
-
icon: "https://firebasestorage.googleapis.com/v0/b/pixi-vn.appspot.com/o/public%2Fcharacters%2Fjuliette-square.webp?alt=media
|
|
2857
|
+
icon: "https://firebasestorage.googleapis.com/v0/b/pixi-vn.appspot.com/o/public%2Fcharacters%2Fjuliette-square.webp?alt=media",
|
|
2697
2858
|
color: "#ac0086"
|
|
2698
2859
|
});
|
|
2699
2860
|
saveCharacter(juliette);
|
|
@@ -2713,36 +2874,30 @@ EventTest1 = __decorateClass([
|
|
|
2713
2874
|
eventDecorator("___pixi_vn_canvas_events_test_event1___")
|
|
2714
2875
|
], EventTest1);
|
|
2715
2876
|
var EventTest2 = class extends CanvasEvent {
|
|
2716
|
-
constructor() {
|
|
2717
|
-
super(...arguments);
|
|
2718
|
-
this.textureButtonDown = Texture.from("https://pixijs.com/assets/button_down.png");
|
|
2719
|
-
this.textureButtonOver = Texture.from("https://pixijs.com/assets/button_over.png");
|
|
2720
|
-
this.textureButton = Texture.from("https://pixijs.com/assets/button.png");
|
|
2721
|
-
}
|
|
2722
2877
|
fn(event, sprite) {
|
|
2723
2878
|
if (event === "pointerdown") {
|
|
2724
2879
|
sprite.isdown = true;
|
|
2725
|
-
sprite.texture =
|
|
2880
|
+
sprite.texture = Texture.from("https://pixijs.com/assets/button_down.png");
|
|
2726
2881
|
sprite.alpha = 1;
|
|
2727
2882
|
} else if (event === "pointerup" || event === "pointerupoutside") {
|
|
2728
2883
|
sprite.isdown = false;
|
|
2729
2884
|
if (sprite.isOver) {
|
|
2730
|
-
sprite.texture =
|
|
2885
|
+
sprite.texture = Texture.from("https://pixijs.com/assets/button_over.png");
|
|
2731
2886
|
} else {
|
|
2732
|
-
sprite.texture =
|
|
2887
|
+
sprite.texture = Texture.from("https://pixijs.com/assets/button.png");
|
|
2733
2888
|
}
|
|
2734
2889
|
} else if (event === "pointerover") {
|
|
2735
2890
|
sprite.isOver = true;
|
|
2736
2891
|
if (sprite.isdown) {
|
|
2737
2892
|
return;
|
|
2738
2893
|
}
|
|
2739
|
-
sprite.texture =
|
|
2894
|
+
sprite.texture = Texture.from("https://pixijs.com/assets/button_over.png");
|
|
2740
2895
|
} else if (event === "pointerout") {
|
|
2741
2896
|
sprite.isOver = false;
|
|
2742
2897
|
if (sprite.isdown) {
|
|
2743
2898
|
return;
|
|
2744
2899
|
}
|
|
2745
|
-
sprite.texture =
|
|
2900
|
+
sprite.texture = Texture.from("https://pixijs.com/assets/button.png");
|
|
2746
2901
|
}
|
|
2747
2902
|
}
|
|
2748
2903
|
};
|
|
@@ -2764,6 +2919,7 @@ var canvasEventsTestLabel = newLabel(
|
|
|
2764
2919
|
});
|
|
2765
2920
|
const texture = yield Assets.load(bunnyImage);
|
|
2766
2921
|
const sprite = CanvasSprite.from(texture);
|
|
2922
|
+
sprite.scale.set(3);
|
|
2767
2923
|
sprite.anchor.set(0.5);
|
|
2768
2924
|
sprite.x = GameWindowManager.screen.width / 2;
|
|
2769
2925
|
sprite.y = GameWindowManager.screen.height / 2;
|
|
@@ -2779,12 +2935,11 @@ var canvasEventsTestLabel = newLabel(
|
|
|
2779
2935
|
text: `This is the test of buttons in a canvas. (This example is from the official [PixiJS website](https://pixijs.com/8.x/examples/events/interactivity).)`
|
|
2780
2936
|
});
|
|
2781
2937
|
const backgroundT = yield Assets.load("https://pixijs.com/assets/bg_button.jpg");
|
|
2782
|
-
const background = CanvasSprite
|
|
2938
|
+
const background = new CanvasSprite(backgroundT);
|
|
2783
2939
|
background.width = GameWindowManager.screen.width;
|
|
2784
2940
|
background.height = GameWindowManager.screen.height;
|
|
2785
2941
|
GameWindowManager.addCanvasElement("bg", background);
|
|
2786
|
-
const
|
|
2787
|
-
const textureButton = CanvasSprite.from(textureButtonT);
|
|
2942
|
+
const textureButton = yield Assets.load("https://pixijs.com/assets/button.png");
|
|
2788
2943
|
const buttons = [];
|
|
2789
2944
|
const buttonPositions = [175, 75, 655, 75, 410, 325, 150, 465, 685, 445];
|
|
2790
2945
|
for (let i = 0; i < 5; i++) {
|
|
@@ -2804,7 +2959,17 @@ var canvasEventsTestLabel = newLabel(
|
|
|
2804
2959
|
buttons[4].scale.set(0.8, 1.2);
|
|
2805
2960
|
buttons[4].rotation = Math.PI;
|
|
2806
2961
|
})
|
|
2807
|
-
]
|
|
2962
|
+
],
|
|
2963
|
+
{
|
|
2964
|
+
onLoadStep: () => __async(void 0, null, function* () {
|
|
2965
|
+
yield Assets.load([
|
|
2966
|
+
"https://pixijs.com/assets/bg_button.jpg",
|
|
2967
|
+
"https://pixijs.com/assets/button.png",
|
|
2968
|
+
"https://pixijs.com/assets/button_down.png",
|
|
2969
|
+
"https://pixijs.com/assets/button_over.png"
|
|
2970
|
+
]);
|
|
2971
|
+
})
|
|
2972
|
+
}
|
|
2808
2973
|
);
|
|
2809
2974
|
|
|
2810
2975
|
export { EventTest1, EventTest2, canvasEventsTestLabel };
|