@drincs/pixi-vn 0.1.5 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +50 -13
- package/dist/index.d.ts +50 -13
- package/dist/index.js +119 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +117 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -35,7 +35,7 @@ declare class CanvasEvent<C> {
|
|
|
35
35
|
* ```typescript
|
|
36
36
|
* export class CharacterModelBase extends StoredClassModel implements ICharacterModelBase {
|
|
37
37
|
* constructor(id: string, props: ICharacterModelBase) {
|
|
38
|
-
* super(id)
|
|
38
|
+
* super("___character___", id)
|
|
39
39
|
* this.defaultName = props.name
|
|
40
40
|
* this.defaultSurname = props.surname
|
|
41
41
|
* }
|
|
@@ -44,24 +44,42 @@ declare class CanvasEvent<C> {
|
|
|
44
44
|
* return this.getStorageProperty<string>("name") || this.defaultName
|
|
45
45
|
* }
|
|
46
46
|
* set name(value: string) {
|
|
47
|
-
* this.
|
|
47
|
+
* this.setStorageProperty<string>("name", value)
|
|
48
48
|
* }
|
|
49
49
|
* private defaultSurname?: string
|
|
50
50
|
* get surname(): string | undefined {
|
|
51
51
|
* return this.getStorageProperty<string>("surname") || this.defaultSurname
|
|
52
52
|
* }
|
|
53
53
|
* set surname(value: string | undefined) {
|
|
54
|
-
* this.
|
|
54
|
+
* this.setStorageProperty<string>("surname", value)
|
|
55
55
|
* }
|
|
56
56
|
* }
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
59
|
declare abstract class StoredClassModel {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
/**
|
|
61
|
+
* @param categoryId The id of the category. For example if you are storing a character class, you can use "characters" as categoryId. so all instances of the character class will be stored in the "characters" category.
|
|
62
|
+
* @param id The id of instance of the class. This id must be unique for the category.
|
|
63
|
+
*/
|
|
64
|
+
constructor(categoryId: string, id: string);
|
|
65
|
+
private _id;
|
|
66
|
+
/**
|
|
67
|
+
* Is id of the stored class. is unique for this class.
|
|
68
|
+
*/
|
|
69
|
+
get id(): string;
|
|
70
|
+
private categoryId;
|
|
71
|
+
/**
|
|
72
|
+
* Update a property in the storage.
|
|
73
|
+
* @param propertyName The name of the property to set.
|
|
74
|
+
* @param value The value to set. If is undefined, the property will be removed from the storage.
|
|
75
|
+
*/
|
|
76
|
+
setStorageProperty<T>(propertyName: string, value: T | undefined): void;
|
|
77
|
+
/**
|
|
78
|
+
* Get a property from the storage.
|
|
79
|
+
* @param propertyName The name of the property to get.
|
|
80
|
+
* @returns The value of the property. If the property is not found, returns undefined.
|
|
81
|
+
*/
|
|
82
|
+
getStorageProperty<T>(propertyName: string): T | undefined;
|
|
65
83
|
}
|
|
66
84
|
|
|
67
85
|
interface ICharacterModelBase {
|
|
@@ -961,6 +979,19 @@ declare function clearChoiceMenuOptions(): void;
|
|
|
961
979
|
*/
|
|
962
980
|
declare function getDialogueHistory<T extends DialogueModelBase = DialogueModelBase>(): IDialogueHistory<T>[];
|
|
963
981
|
|
|
982
|
+
/**
|
|
983
|
+
* Set a flag to true or false.
|
|
984
|
+
* @param name The name of the flag
|
|
985
|
+
* @param value The value of the flag.
|
|
986
|
+
*/
|
|
987
|
+
declare function setFlag(name: string, value: boolean): void;
|
|
988
|
+
/**
|
|
989
|
+
* Get the value of a flag
|
|
990
|
+
* @param name The name of the flag
|
|
991
|
+
* @returns The value of the flag
|
|
992
|
+
*/
|
|
993
|
+
declare function getFlag(name: string): boolean;
|
|
994
|
+
|
|
964
995
|
/**
|
|
965
996
|
* Clear all game data. This function is used to reset the game.
|
|
966
997
|
*/
|
|
@@ -1091,13 +1122,18 @@ declare class GameStepManager {
|
|
|
1091
1122
|
private static _openedLabels;
|
|
1092
1123
|
static get openedLabels(): IOpenedLabel[];
|
|
1093
1124
|
/**
|
|
1094
|
-
*
|
|
1125
|
+
* currentLabelId is the current label id that occurred during the progression of the steps.
|
|
1095
1126
|
*/
|
|
1096
|
-
private static get
|
|
1127
|
+
private static get currentLabelId();
|
|
1097
1128
|
/**
|
|
1098
|
-
* is the current
|
|
1129
|
+
* currentLabel is the current label that occurred during the progression of the steps.
|
|
1099
1130
|
*/
|
|
1131
|
+
static get currentLabel(): Label | undefined;
|
|
1100
1132
|
private static get currentLabelStepIndex();
|
|
1133
|
+
/**
|
|
1134
|
+
* currentLabelStep is the current step that occurred during the progression of the steps. It can used to determine the game end.
|
|
1135
|
+
*/
|
|
1136
|
+
static get isLastGameStep(): boolean;
|
|
1101
1137
|
/**
|
|
1102
1138
|
* lastHistoryStep is the last history step that occurred during the progression of the steps.
|
|
1103
1139
|
*/
|
|
@@ -1228,7 +1264,8 @@ declare class GameStorageManager {
|
|
|
1228
1264
|
LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY: string;
|
|
1229
1265
|
CURRENT_MENU_OPTIONS_MEMORY_KEY: string;
|
|
1230
1266
|
LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY: string;
|
|
1231
|
-
|
|
1267
|
+
CHARACTER_CATEGORY_KEY: string;
|
|
1268
|
+
FLAGS_CATEGORY_KEY: string;
|
|
1232
1269
|
};
|
|
1233
1270
|
/**
|
|
1234
1271
|
* Set a variable in the storage
|
|
@@ -1511,4 +1548,4 @@ declare class GameWindowManager {
|
|
|
1511
1548
|
static import(data: object): void;
|
|
1512
1549
|
}
|
|
1513
1550
|
|
|
1514
|
-
export { CanvasBase, CanvasContainer, CanvasEvent, type CanvasEventNamesType, CanvasImage, CanvasSprite, CanvasText, CharacterModelBase, ChoiceMenuOptionLabel, type ChoiceMenuOptionsType, DialogueModelBase, type ExportedCanvas, type ExportedStep, type ExportedStorage, GameStepManager, GameStorageManager, GameWindowManager, type ICanvasBaseMemory, type ICanvasContainerMemory, type ICanvasImageMemory, type ICanvasSpriteBaseMemory, type ICanvasSpriteMemory, type ICanvasTextMemory as ICanvasTextTextMemory, type IClassWithArgsHistory, type IClassWithArgsHistoryForExport, type IDialogueHistory, type IHistoryStep, type IHistoryStepData, type IOpenedLabel, type ISaveData, type ITextureMemory, type ITicker, type ITickersSteps, Label, LabelRunModeEnum, Pause, type PauseType, PauseValueType, Repeat, type RepeatType, type StepLabelType, type StorageElementType, StoredClassModel, TickerBase, TickerFadeAlpha, type TickerProgrationType, TickerRotate, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getSaveData, getSaveJson, getTexture, labelDecorator, loadSaveData, loadSaveJson, removeCanvasElement, saveCharacter, setChoiceMenuOptions, setDialogue, showCanvasImages, showImageWithDissolveTransition, tickerDecorator };
|
|
1551
|
+
export { CanvasBase, CanvasContainer, CanvasEvent, type CanvasEventNamesType, CanvasImage, CanvasSprite, CanvasText, CharacterModelBase, ChoiceMenuOptionLabel, type ChoiceMenuOptionsType, DialogueModelBase, type ExportedCanvas, type ExportedStep, type ExportedStorage, GameStepManager, GameStorageManager, GameWindowManager, type ICanvasBaseMemory, type ICanvasContainerMemory, type ICanvasImageMemory, type ICanvasSpriteBaseMemory, type ICanvasSpriteMemory, type ICanvasTextMemory as ICanvasTextTextMemory, type IClassWithArgsHistory, type IClassWithArgsHistoryForExport, type IDialogueHistory, type IHistoryStep, type IHistoryStepData, type IOpenedLabel, type ISaveData, type ITextureMemory, type ITicker, type ITickersSteps, Label, LabelRunModeEnum, Pause, type PauseType, PauseValueType, Repeat, type RepeatType, type StepLabelType, type StorageElementType, StoredClassModel, TickerBase, TickerFadeAlpha, type TickerProgrationType, TickerRotate, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getSaveData, getSaveJson, getTexture, labelDecorator, loadSaveData, loadSaveJson, removeCanvasElement, saveCharacter, setChoiceMenuOptions, setDialogue, setFlag, showCanvasImages, showImageWithDissolveTransition, tickerDecorator };
|
package/dist/index.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ declare class CanvasEvent<C> {
|
|
|
35
35
|
* ```typescript
|
|
36
36
|
* export class CharacterModelBase extends StoredClassModel implements ICharacterModelBase {
|
|
37
37
|
* constructor(id: string, props: ICharacterModelBase) {
|
|
38
|
-
* super(id)
|
|
38
|
+
* super("___character___", id)
|
|
39
39
|
* this.defaultName = props.name
|
|
40
40
|
* this.defaultSurname = props.surname
|
|
41
41
|
* }
|
|
@@ -44,24 +44,42 @@ declare class CanvasEvent<C> {
|
|
|
44
44
|
* return this.getStorageProperty<string>("name") || this.defaultName
|
|
45
45
|
* }
|
|
46
46
|
* set name(value: string) {
|
|
47
|
-
* this.
|
|
47
|
+
* this.setStorageProperty<string>("name", value)
|
|
48
48
|
* }
|
|
49
49
|
* private defaultSurname?: string
|
|
50
50
|
* get surname(): string | undefined {
|
|
51
51
|
* return this.getStorageProperty<string>("surname") || this.defaultSurname
|
|
52
52
|
* }
|
|
53
53
|
* set surname(value: string | undefined) {
|
|
54
|
-
* this.
|
|
54
|
+
* this.setStorageProperty<string>("surname", value)
|
|
55
55
|
* }
|
|
56
56
|
* }
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
59
|
declare abstract class StoredClassModel {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
/**
|
|
61
|
+
* @param categoryId The id of the category. For example if you are storing a character class, you can use "characters" as categoryId. so all instances of the character class will be stored in the "characters" category.
|
|
62
|
+
* @param id The id of instance of the class. This id must be unique for the category.
|
|
63
|
+
*/
|
|
64
|
+
constructor(categoryId: string, id: string);
|
|
65
|
+
private _id;
|
|
66
|
+
/**
|
|
67
|
+
* Is id of the stored class. is unique for this class.
|
|
68
|
+
*/
|
|
69
|
+
get id(): string;
|
|
70
|
+
private categoryId;
|
|
71
|
+
/**
|
|
72
|
+
* Update a property in the storage.
|
|
73
|
+
* @param propertyName The name of the property to set.
|
|
74
|
+
* @param value The value to set. If is undefined, the property will be removed from the storage.
|
|
75
|
+
*/
|
|
76
|
+
setStorageProperty<T>(propertyName: string, value: T | undefined): void;
|
|
77
|
+
/**
|
|
78
|
+
* Get a property from the storage.
|
|
79
|
+
* @param propertyName The name of the property to get.
|
|
80
|
+
* @returns The value of the property. If the property is not found, returns undefined.
|
|
81
|
+
*/
|
|
82
|
+
getStorageProperty<T>(propertyName: string): T | undefined;
|
|
65
83
|
}
|
|
66
84
|
|
|
67
85
|
interface ICharacterModelBase {
|
|
@@ -961,6 +979,19 @@ declare function clearChoiceMenuOptions(): void;
|
|
|
961
979
|
*/
|
|
962
980
|
declare function getDialogueHistory<T extends DialogueModelBase = DialogueModelBase>(): IDialogueHistory<T>[];
|
|
963
981
|
|
|
982
|
+
/**
|
|
983
|
+
* Set a flag to true or false.
|
|
984
|
+
* @param name The name of the flag
|
|
985
|
+
* @param value The value of the flag.
|
|
986
|
+
*/
|
|
987
|
+
declare function setFlag(name: string, value: boolean): void;
|
|
988
|
+
/**
|
|
989
|
+
* Get the value of a flag
|
|
990
|
+
* @param name The name of the flag
|
|
991
|
+
* @returns The value of the flag
|
|
992
|
+
*/
|
|
993
|
+
declare function getFlag(name: string): boolean;
|
|
994
|
+
|
|
964
995
|
/**
|
|
965
996
|
* Clear all game data. This function is used to reset the game.
|
|
966
997
|
*/
|
|
@@ -1091,13 +1122,18 @@ declare class GameStepManager {
|
|
|
1091
1122
|
private static _openedLabels;
|
|
1092
1123
|
static get openedLabels(): IOpenedLabel[];
|
|
1093
1124
|
/**
|
|
1094
|
-
*
|
|
1125
|
+
* currentLabelId is the current label id that occurred during the progression of the steps.
|
|
1095
1126
|
*/
|
|
1096
|
-
private static get
|
|
1127
|
+
private static get currentLabelId();
|
|
1097
1128
|
/**
|
|
1098
|
-
* is the current
|
|
1129
|
+
* currentLabel is the current label that occurred during the progression of the steps.
|
|
1099
1130
|
*/
|
|
1131
|
+
static get currentLabel(): Label | undefined;
|
|
1100
1132
|
private static get currentLabelStepIndex();
|
|
1133
|
+
/**
|
|
1134
|
+
* currentLabelStep is the current step that occurred during the progression of the steps. It can used to determine the game end.
|
|
1135
|
+
*/
|
|
1136
|
+
static get isLastGameStep(): boolean;
|
|
1101
1137
|
/**
|
|
1102
1138
|
* lastHistoryStep is the last history step that occurred during the progression of the steps.
|
|
1103
1139
|
*/
|
|
@@ -1228,7 +1264,8 @@ declare class GameStorageManager {
|
|
|
1228
1264
|
LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY: string;
|
|
1229
1265
|
CURRENT_MENU_OPTIONS_MEMORY_KEY: string;
|
|
1230
1266
|
LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY: string;
|
|
1231
|
-
|
|
1267
|
+
CHARACTER_CATEGORY_KEY: string;
|
|
1268
|
+
FLAGS_CATEGORY_KEY: string;
|
|
1232
1269
|
};
|
|
1233
1270
|
/**
|
|
1234
1271
|
* Set a variable in the storage
|
|
@@ -1511,4 +1548,4 @@ declare class GameWindowManager {
|
|
|
1511
1548
|
static import(data: object): void;
|
|
1512
1549
|
}
|
|
1513
1550
|
|
|
1514
|
-
export { CanvasBase, CanvasContainer, CanvasEvent, type CanvasEventNamesType, CanvasImage, CanvasSprite, CanvasText, CharacterModelBase, ChoiceMenuOptionLabel, type ChoiceMenuOptionsType, DialogueModelBase, type ExportedCanvas, type ExportedStep, type ExportedStorage, GameStepManager, GameStorageManager, GameWindowManager, type ICanvasBaseMemory, type ICanvasContainerMemory, type ICanvasImageMemory, type ICanvasSpriteBaseMemory, type ICanvasSpriteMemory, type ICanvasTextMemory as ICanvasTextTextMemory, type IClassWithArgsHistory, type IClassWithArgsHistoryForExport, type IDialogueHistory, type IHistoryStep, type IHistoryStepData, type IOpenedLabel, type ISaveData, type ITextureMemory, type ITicker, type ITickersSteps, Label, LabelRunModeEnum, Pause, type PauseType, PauseValueType, Repeat, type RepeatType, type StepLabelType, type StorageElementType, StoredClassModel, TickerBase, TickerFadeAlpha, type TickerProgrationType, TickerRotate, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getSaveData, getSaveJson, getTexture, labelDecorator, loadSaveData, loadSaveJson, removeCanvasElement, saveCharacter, setChoiceMenuOptions, setDialogue, showCanvasImages, showImageWithDissolveTransition, tickerDecorator };
|
|
1551
|
+
export { CanvasBase, CanvasContainer, CanvasEvent, type CanvasEventNamesType, CanvasImage, CanvasSprite, CanvasText, CharacterModelBase, ChoiceMenuOptionLabel, type ChoiceMenuOptionsType, DialogueModelBase, type ExportedCanvas, type ExportedStep, type ExportedStorage, GameStepManager, GameStorageManager, GameWindowManager, type ICanvasBaseMemory, type ICanvasContainerMemory, type ICanvasImageMemory, type ICanvasSpriteBaseMemory, type ICanvasSpriteMemory, type ICanvasTextMemory as ICanvasTextTextMemory, type IClassWithArgsHistory, type IClassWithArgsHistoryForExport, type IDialogueHistory, type IHistoryStep, type IHistoryStepData, type IOpenedLabel, type ISaveData, type ITextureMemory, type ITicker, type ITickersSteps, Label, LabelRunModeEnum, Pause, type PauseType, PauseValueType, Repeat, type RepeatType, type StepLabelType, type StorageElementType, StoredClassModel, TickerBase, TickerFadeAlpha, type TickerProgrationType, TickerRotate, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getSaveData, getSaveJson, getTexture, labelDecorator, loadSaveData, loadSaveJson, removeCanvasElement, saveCharacter, setChoiceMenuOptions, setDialogue, setFlag, showCanvasImages, showImageWithDissolveTransition, tickerDecorator };
|
package/dist/index.js
CHANGED
|
@@ -107,6 +107,7 @@ __export(src_exports, {
|
|
|
107
107
|
getChoiceMenuOptions: () => getChoiceMenuOptions,
|
|
108
108
|
getDialogue: () => getDialogue,
|
|
109
109
|
getDialogueHistory: () => getDialogueHistory,
|
|
110
|
+
getFlag: () => getFlag,
|
|
110
111
|
getSaveData: () => getSaveData,
|
|
111
112
|
getSaveJson: () => getSaveJson,
|
|
112
113
|
getTexture: () => getTexture,
|
|
@@ -117,6 +118,7 @@ __export(src_exports, {
|
|
|
117
118
|
saveCharacter: () => saveCharacter,
|
|
118
119
|
setChoiceMenuOptions: () => setChoiceMenuOptions,
|
|
119
120
|
setDialogue: () => setDialogue,
|
|
121
|
+
setFlag: () => setFlag,
|
|
120
122
|
showCanvasImages: () => showCanvasImages,
|
|
121
123
|
showImageWithDissolveTransition: () => showImageWithDissolveTransition,
|
|
122
124
|
tickerDecorator: () => tickerDecorator
|
|
@@ -256,6 +258,26 @@ function getDialogueHistory() {
|
|
|
256
258
|
return list;
|
|
257
259
|
}
|
|
258
260
|
|
|
261
|
+
// src/functions/FlagsUtility.ts
|
|
262
|
+
function setFlag(name, value) {
|
|
263
|
+
let flags = GameStorageManager.getVariable(GameStorageManager.keysSystem.FLAGS_CATEGORY_KEY) || [];
|
|
264
|
+
if (value) {
|
|
265
|
+
if (!flags.includes(name)) {
|
|
266
|
+
flags.push(name);
|
|
267
|
+
}
|
|
268
|
+
} else {
|
|
269
|
+
let index = flags.indexOf(name);
|
|
270
|
+
if (index > -1) {
|
|
271
|
+
flags.splice(index, 1);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
GameStorageManager.setVariable(GameStorageManager.keysSystem.FLAGS_CATEGORY_KEY, flags);
|
|
275
|
+
}
|
|
276
|
+
function getFlag(name) {
|
|
277
|
+
let flags = GameStorageManager.getVariable(GameStorageManager.keysSystem.FLAGS_CATEGORY_KEY) || [];
|
|
278
|
+
return flags.includes(name);
|
|
279
|
+
}
|
|
280
|
+
|
|
259
281
|
// src/functions/GameUtility.ts
|
|
260
282
|
function clearAllGameDatas() {
|
|
261
283
|
GameStorageManager.clear();
|
|
@@ -1128,7 +1150,8 @@ var _GameStorageManager = class _GameStorageManager {
|
|
|
1128
1150
|
LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY: "___last_dialogue_added_in_step_memory_key___",
|
|
1129
1151
|
CURRENT_MENU_OPTIONS_MEMORY_KEY: "___current_menu_options_memory_key___",
|
|
1130
1152
|
LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY: "___last_menu_options_added_in_step_memory_key___",
|
|
1131
|
-
|
|
1153
|
+
CHARACTER_CATEGORY_KEY: "___character___",
|
|
1154
|
+
FLAGS_CATEGORY_KEY: "___flags___"
|
|
1132
1155
|
};
|
|
1133
1156
|
}
|
|
1134
1157
|
/**
|
|
@@ -1139,7 +1162,7 @@ var _GameStorageManager = class _GameStorageManager {
|
|
|
1139
1162
|
*/
|
|
1140
1163
|
static setVariable(key, value) {
|
|
1141
1164
|
key = key.toLowerCase();
|
|
1142
|
-
if (value === void 0) {
|
|
1165
|
+
if (value === void 0 || value === null) {
|
|
1143
1166
|
if (_GameStorageManager.storage.hasOwnProperty(key)) {
|
|
1144
1167
|
delete _GameStorageManager.storage[key];
|
|
1145
1168
|
}
|
|
@@ -1205,6 +1228,17 @@ var GameStorageManager = _GameStorageManager;
|
|
|
1205
1228
|
// src/managers/WindowManager.ts
|
|
1206
1229
|
var import_pixi9 = require("pixi.js");
|
|
1207
1230
|
|
|
1231
|
+
// src/functions/EasterEgg.ts
|
|
1232
|
+
function asciiArtLog() {
|
|
1233
|
+
console.log(`
|
|
1234
|
+
____ _ _ ___ ___ _
|
|
1235
|
+
| _ \\(_)_ _(_| ) \\ / / \\ | |
|
|
1236
|
+
| |_) | \\ \\/ / |/ \\ \\ / /| \\| |
|
|
1237
|
+
| __/| |> <| | \\ V / | |\\ |
|
|
1238
|
+
|_| |_/_/\\_\\_| \\_/ |_| \\_|
|
|
1239
|
+
`);
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1208
1242
|
// src/types/PauseType.ts
|
|
1209
1243
|
var PauseValueType = "Pause";
|
|
1210
1244
|
function Pause(duration) {
|
|
@@ -1273,6 +1307,7 @@ var _GameWindowManager = class _GameWindowManager {
|
|
|
1273
1307
|
this.addCanvasIntoElement(element);
|
|
1274
1308
|
window.addEventListener("resize", _GameWindowManager.resize);
|
|
1275
1309
|
_GameWindowManager.resize();
|
|
1310
|
+
asciiArtLog();
|
|
1276
1311
|
});
|
|
1277
1312
|
});
|
|
1278
1313
|
}
|
|
@@ -1805,9 +1840,9 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1805
1840
|
return _GameStepManager._openedLabels;
|
|
1806
1841
|
}
|
|
1807
1842
|
/**
|
|
1808
|
-
*
|
|
1843
|
+
* currentLabelId is the current label id that occurred during the progression of the steps.
|
|
1809
1844
|
*/
|
|
1810
|
-
static get
|
|
1845
|
+
static get currentLabelId() {
|
|
1811
1846
|
if (_GameStepManager._openedLabels.length > 0) {
|
|
1812
1847
|
let item = _GameStepManager._openedLabels[_GameStepManager._openedLabels.length - 1];
|
|
1813
1848
|
return item.label;
|
|
@@ -1815,8 +1850,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1815
1850
|
return void 0;
|
|
1816
1851
|
}
|
|
1817
1852
|
/**
|
|
1818
|
-
* is the current
|
|
1853
|
+
* currentLabel is the current label that occurred during the progression of the steps.
|
|
1819
1854
|
*/
|
|
1855
|
+
static get currentLabel() {
|
|
1856
|
+
if (_GameStepManager.currentLabelId) {
|
|
1857
|
+
return getLabelInstanceByClassName(_GameStepManager.currentLabelId);
|
|
1858
|
+
}
|
|
1859
|
+
}
|
|
1820
1860
|
static get currentLabelStepIndex() {
|
|
1821
1861
|
if (_GameStepManager._openedLabels.length > 0) {
|
|
1822
1862
|
let item = _GameStepManager._openedLabels[_GameStepManager._openedLabels.length - 1];
|
|
@@ -1824,6 +1864,27 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1824
1864
|
}
|
|
1825
1865
|
return null;
|
|
1826
1866
|
}
|
|
1867
|
+
/**
|
|
1868
|
+
* currentLabelStep is the current step that occurred during the progression of the steps. It can used to determine the game end.
|
|
1869
|
+
*/
|
|
1870
|
+
static get isLastGameStep() {
|
|
1871
|
+
var _a;
|
|
1872
|
+
let stepLabel = (_a = _GameStepManager.currentLabel) == null ? void 0 : _a.steps;
|
|
1873
|
+
if (stepLabel && _GameStepManager.currentLabelStepIndex === stepLabel.length) {
|
|
1874
|
+
if (this.openedLabels.length <= 1) {
|
|
1875
|
+
return true;
|
|
1876
|
+
} else {
|
|
1877
|
+
this.openedLabels.forEach((item) => {
|
|
1878
|
+
let label = getLabelInstanceByClassName(item.label);
|
|
1879
|
+
if (label && label.steps.length > item.currentStepIndex) {
|
|
1880
|
+
return false;
|
|
1881
|
+
}
|
|
1882
|
+
});
|
|
1883
|
+
return true;
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
return false;
|
|
1887
|
+
}
|
|
1827
1888
|
/**
|
|
1828
1889
|
* lastHistoryStep is the last history step that occurred during the progression of the steps.
|
|
1829
1890
|
*/
|
|
@@ -1891,7 +1952,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1891
1952
|
}
|
|
1892
1953
|
_GameStepManager._stepsHistory.push({
|
|
1893
1954
|
diff: data,
|
|
1894
|
-
currentLabel: _GameStepManager.
|
|
1955
|
+
currentLabel: _GameStepManager.currentLabelId,
|
|
1895
1956
|
dialoge,
|
|
1896
1957
|
choices: requiredChoices,
|
|
1897
1958
|
stepSha1: stepHistory,
|
|
@@ -1920,12 +1981,11 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1920
1981
|
* @returns
|
|
1921
1982
|
*/
|
|
1922
1983
|
static closeCurrentLabel() {
|
|
1923
|
-
if (!_GameStepManager.
|
|
1984
|
+
if (!_GameStepManager.currentLabelId) {
|
|
1924
1985
|
console.warn("[Pixi'VN] No label to close");
|
|
1925
1986
|
return;
|
|
1926
1987
|
}
|
|
1927
|
-
|
|
1928
|
-
if (!currentLabel) {
|
|
1988
|
+
if (!_GameStepManager.currentLabel) {
|
|
1929
1989
|
console.error("[Pixi'VN] Label not found");
|
|
1930
1990
|
return;
|
|
1931
1991
|
}
|
|
@@ -1984,13 +2044,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1984
2044
|
*/
|
|
1985
2045
|
static runCurrentStep() {
|
|
1986
2046
|
return __async(this, null, function* () {
|
|
1987
|
-
if (_GameStepManager.
|
|
2047
|
+
if (_GameStepManager.currentLabelId) {
|
|
1988
2048
|
let lasteStepsLength = _GameStepManager.currentLabelStepIndex;
|
|
1989
2049
|
if (lasteStepsLength === null) {
|
|
1990
2050
|
console.error("[Pixi'VN] currentLabelStepIndex is null");
|
|
1991
2051
|
return;
|
|
1992
2052
|
}
|
|
1993
|
-
let currentLabel =
|
|
2053
|
+
let currentLabel = _GameStepManager.currentLabel;
|
|
1994
2054
|
if (!currentLabel) {
|
|
1995
2055
|
console.error("[Pixi'VN] Label not found");
|
|
1996
2056
|
return;
|
|
@@ -2254,27 +2314,54 @@ var GameStepManager = _GameStepManager;
|
|
|
2254
2314
|
|
|
2255
2315
|
// src/classes/StoredClassModel.ts
|
|
2256
2316
|
var StoredClassModel = class {
|
|
2257
|
-
|
|
2258
|
-
|
|
2317
|
+
/**
|
|
2318
|
+
* @param categoryId The id of the category. For example if you are storing a character class, you can use "characters" as categoryId. so all instances of the character class will be stored in the "characters" category.
|
|
2319
|
+
* @param id The id of instance of the class. This id must be unique for the category.
|
|
2320
|
+
*/
|
|
2321
|
+
constructor(categoryId, id) {
|
|
2322
|
+
this.categoryId = categoryId;
|
|
2323
|
+
this._id = id;
|
|
2259
2324
|
}
|
|
2260
|
-
|
|
2261
|
-
|
|
2325
|
+
/**
|
|
2326
|
+
* Is id of the stored class. is unique for this class.
|
|
2327
|
+
*/
|
|
2328
|
+
get id() {
|
|
2329
|
+
return this._id;
|
|
2262
2330
|
}
|
|
2263
|
-
|
|
2264
|
-
|
|
2331
|
+
/**
|
|
2332
|
+
* Update a property in the storage.
|
|
2333
|
+
* @param propertyName The name of the property to set.
|
|
2334
|
+
* @param value The value to set. If is undefined, the property will be removed from the storage.
|
|
2335
|
+
*/
|
|
2336
|
+
setStorageProperty(propertyName, value) {
|
|
2337
|
+
let storage = GameStorageManager.getVariable(this.categoryId);
|
|
2265
2338
|
if (!storage) {
|
|
2266
2339
|
storage = {};
|
|
2267
2340
|
}
|
|
2268
|
-
storage
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2341
|
+
if (!storage.hasOwnProperty(this.id)) {
|
|
2342
|
+
storage[this.id] = {};
|
|
2343
|
+
}
|
|
2344
|
+
if (value === void 0 || value === null) {
|
|
2345
|
+
if (storage[this.id].hasOwnProperty(propertyName)) {
|
|
2346
|
+
delete storage[this.id][propertyName];
|
|
2347
|
+
}
|
|
2348
|
+
} else {
|
|
2349
|
+
storage[this.id] = __spreadProps(__spreadValues({}, storage[this.id]), { [propertyName]: value });
|
|
2350
|
+
}
|
|
2351
|
+
if (Object.keys(storage[this.id]).length === 0) {
|
|
2352
|
+
delete storage[this.id];
|
|
2275
2353
|
}
|
|
2276
|
-
|
|
2277
|
-
|
|
2354
|
+
GameStorageManager.setVariable(this.categoryId, storage);
|
|
2355
|
+
}
|
|
2356
|
+
/**
|
|
2357
|
+
* Get a property from the storage.
|
|
2358
|
+
* @param propertyName The name of the property to get.
|
|
2359
|
+
* @returns The value of the property. If the property is not found, returns undefined.
|
|
2360
|
+
*/
|
|
2361
|
+
getStorageProperty(propertyName) {
|
|
2362
|
+
let storage = GameStorageManager.getVariable(this.categoryId);
|
|
2363
|
+
if (storage && storage.hasOwnProperty(this.id) && storage[this.id].hasOwnProperty(propertyName)) {
|
|
2364
|
+
return storage[this.id][propertyName];
|
|
2278
2365
|
}
|
|
2279
2366
|
return void 0;
|
|
2280
2367
|
}
|
|
@@ -2283,7 +2370,7 @@ var StoredClassModel = class {
|
|
|
2283
2370
|
// src/classes/CharacterModelBase.ts
|
|
2284
2371
|
var CharacterModelBase2 = class extends StoredClassModel {
|
|
2285
2372
|
constructor(id, props) {
|
|
2286
|
-
super(GameStorageManager.keysSystem.
|
|
2373
|
+
super(GameStorageManager.keysSystem.CHARACTER_CATEGORY_KEY, id);
|
|
2287
2374
|
this.defaultName = "";
|
|
2288
2375
|
this.defaultName = props.name;
|
|
2289
2376
|
this.defaultSurname = props.surname;
|
|
@@ -2295,19 +2382,19 @@ var CharacterModelBase2 = class extends StoredClassModel {
|
|
|
2295
2382
|
return this.getStorageProperty("name") || this.defaultName;
|
|
2296
2383
|
}
|
|
2297
2384
|
set name(value) {
|
|
2298
|
-
this.
|
|
2385
|
+
this.setStorageProperty("name", value);
|
|
2299
2386
|
}
|
|
2300
2387
|
get surname() {
|
|
2301
2388
|
return this.getStorageProperty("surname") || this.defaultSurname;
|
|
2302
2389
|
}
|
|
2303
2390
|
set surname(value) {
|
|
2304
|
-
this.
|
|
2391
|
+
this.setStorageProperty("surname", value);
|
|
2305
2392
|
}
|
|
2306
2393
|
get age() {
|
|
2307
2394
|
return this.getStorageProperty("age") || this.defaultAge;
|
|
2308
2395
|
}
|
|
2309
2396
|
set age(value) {
|
|
2310
|
-
this.
|
|
2397
|
+
this.setStorageProperty("age", value);
|
|
2311
2398
|
}
|
|
2312
2399
|
get icon() {
|
|
2313
2400
|
return this._icon;
|
|
@@ -2411,6 +2498,7 @@ var Label = class {
|
|
|
2411
2498
|
getChoiceMenuOptions,
|
|
2412
2499
|
getDialogue,
|
|
2413
2500
|
getDialogueHistory,
|
|
2501
|
+
getFlag,
|
|
2414
2502
|
getSaveData,
|
|
2415
2503
|
getSaveJson,
|
|
2416
2504
|
getTexture,
|
|
@@ -2421,6 +2509,7 @@ var Label = class {
|
|
|
2421
2509
|
saveCharacter,
|
|
2422
2510
|
setChoiceMenuOptions,
|
|
2423
2511
|
setDialogue,
|
|
2512
|
+
setFlag,
|
|
2424
2513
|
showCanvasImages,
|
|
2425
2514
|
showImageWithDissolveTransition,
|
|
2426
2515
|
tickerDecorator
|