@drincs/pixi-vn 0.1.5 → 0.2.0
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 +109 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +107 -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,17 @@ 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) {
|
|
1874
|
+
return _GameStepManager.currentLabelStepIndex === stepLabel.length;
|
|
1875
|
+
}
|
|
1876
|
+
return false;
|
|
1877
|
+
}
|
|
1827
1878
|
/**
|
|
1828
1879
|
* lastHistoryStep is the last history step that occurred during the progression of the steps.
|
|
1829
1880
|
*/
|
|
@@ -1891,7 +1942,7 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1891
1942
|
}
|
|
1892
1943
|
_GameStepManager._stepsHistory.push({
|
|
1893
1944
|
diff: data,
|
|
1894
|
-
currentLabel: _GameStepManager.
|
|
1945
|
+
currentLabel: _GameStepManager.currentLabelId,
|
|
1895
1946
|
dialoge,
|
|
1896
1947
|
choices: requiredChoices,
|
|
1897
1948
|
stepSha1: stepHistory,
|
|
@@ -1920,12 +1971,11 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1920
1971
|
* @returns
|
|
1921
1972
|
*/
|
|
1922
1973
|
static closeCurrentLabel() {
|
|
1923
|
-
if (!_GameStepManager.
|
|
1974
|
+
if (!_GameStepManager.currentLabelId) {
|
|
1924
1975
|
console.warn("[Pixi'VN] No label to close");
|
|
1925
1976
|
return;
|
|
1926
1977
|
}
|
|
1927
|
-
|
|
1928
|
-
if (!currentLabel) {
|
|
1978
|
+
if (!_GameStepManager.currentLabel) {
|
|
1929
1979
|
console.error("[Pixi'VN] Label not found");
|
|
1930
1980
|
return;
|
|
1931
1981
|
}
|
|
@@ -1984,13 +2034,13 @@ var _GameStepManager = class _GameStepManager {
|
|
|
1984
2034
|
*/
|
|
1985
2035
|
static runCurrentStep() {
|
|
1986
2036
|
return __async(this, null, function* () {
|
|
1987
|
-
if (_GameStepManager.
|
|
2037
|
+
if (_GameStepManager.currentLabelId) {
|
|
1988
2038
|
let lasteStepsLength = _GameStepManager.currentLabelStepIndex;
|
|
1989
2039
|
if (lasteStepsLength === null) {
|
|
1990
2040
|
console.error("[Pixi'VN] currentLabelStepIndex is null");
|
|
1991
2041
|
return;
|
|
1992
2042
|
}
|
|
1993
|
-
let currentLabel =
|
|
2043
|
+
let currentLabel = _GameStepManager.currentLabel;
|
|
1994
2044
|
if (!currentLabel) {
|
|
1995
2045
|
console.error("[Pixi'VN] Label not found");
|
|
1996
2046
|
return;
|
|
@@ -2254,27 +2304,54 @@ var GameStepManager = _GameStepManager;
|
|
|
2254
2304
|
|
|
2255
2305
|
// src/classes/StoredClassModel.ts
|
|
2256
2306
|
var StoredClassModel = class {
|
|
2257
|
-
|
|
2258
|
-
|
|
2307
|
+
/**
|
|
2308
|
+
* @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.
|
|
2309
|
+
* @param id The id of instance of the class. This id must be unique for the category.
|
|
2310
|
+
*/
|
|
2311
|
+
constructor(categoryId, id) {
|
|
2312
|
+
this.categoryId = categoryId;
|
|
2313
|
+
this._id = id;
|
|
2259
2314
|
}
|
|
2260
|
-
|
|
2261
|
-
|
|
2315
|
+
/**
|
|
2316
|
+
* Is id of the stored class. is unique for this class.
|
|
2317
|
+
*/
|
|
2318
|
+
get id() {
|
|
2319
|
+
return this._id;
|
|
2262
2320
|
}
|
|
2263
|
-
|
|
2264
|
-
|
|
2321
|
+
/**
|
|
2322
|
+
* Update a property in the storage.
|
|
2323
|
+
* @param propertyName The name of the property to set.
|
|
2324
|
+
* @param value The value to set. If is undefined, the property will be removed from the storage.
|
|
2325
|
+
*/
|
|
2326
|
+
setStorageProperty(propertyName, value) {
|
|
2327
|
+
let storage = GameStorageManager.getVariable(this.categoryId);
|
|
2265
2328
|
if (!storage) {
|
|
2266
2329
|
storage = {};
|
|
2267
2330
|
}
|
|
2268
|
-
storage
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2331
|
+
if (!storage.hasOwnProperty(this.id)) {
|
|
2332
|
+
storage[this.id] = {};
|
|
2333
|
+
}
|
|
2334
|
+
if (value === void 0 || value === null) {
|
|
2335
|
+
if (storage[this.id].hasOwnProperty(propertyName)) {
|
|
2336
|
+
delete storage[this.id][propertyName];
|
|
2337
|
+
}
|
|
2338
|
+
} else {
|
|
2339
|
+
storage[this.id] = __spreadProps(__spreadValues({}, storage[this.id]), { [propertyName]: value });
|
|
2275
2340
|
}
|
|
2276
|
-
if (storage[this.id].
|
|
2277
|
-
|
|
2341
|
+
if (Object.keys(storage[this.id]).length === 0) {
|
|
2342
|
+
delete storage[this.id];
|
|
2343
|
+
}
|
|
2344
|
+
GameStorageManager.setVariable(this.categoryId, storage);
|
|
2345
|
+
}
|
|
2346
|
+
/**
|
|
2347
|
+
* Get a property from the storage.
|
|
2348
|
+
* @param propertyName The name of the property to get.
|
|
2349
|
+
* @returns The value of the property. If the property is not found, returns undefined.
|
|
2350
|
+
*/
|
|
2351
|
+
getStorageProperty(propertyName) {
|
|
2352
|
+
let storage = GameStorageManager.getVariable(this.categoryId);
|
|
2353
|
+
if (storage && storage.hasOwnProperty(this.id) && storage[this.id].hasOwnProperty(propertyName)) {
|
|
2354
|
+
return storage[this.id][propertyName];
|
|
2278
2355
|
}
|
|
2279
2356
|
return void 0;
|
|
2280
2357
|
}
|
|
@@ -2283,7 +2360,7 @@ var StoredClassModel = class {
|
|
|
2283
2360
|
// src/classes/CharacterModelBase.ts
|
|
2284
2361
|
var CharacterModelBase2 = class extends StoredClassModel {
|
|
2285
2362
|
constructor(id, props) {
|
|
2286
|
-
super(GameStorageManager.keysSystem.
|
|
2363
|
+
super(GameStorageManager.keysSystem.CHARACTER_CATEGORY_KEY, id);
|
|
2287
2364
|
this.defaultName = "";
|
|
2288
2365
|
this.defaultName = props.name;
|
|
2289
2366
|
this.defaultSurname = props.surname;
|
|
@@ -2295,19 +2372,19 @@ var CharacterModelBase2 = class extends StoredClassModel {
|
|
|
2295
2372
|
return this.getStorageProperty("name") || this.defaultName;
|
|
2296
2373
|
}
|
|
2297
2374
|
set name(value) {
|
|
2298
|
-
this.
|
|
2375
|
+
this.setStorageProperty("name", value);
|
|
2299
2376
|
}
|
|
2300
2377
|
get surname() {
|
|
2301
2378
|
return this.getStorageProperty("surname") || this.defaultSurname;
|
|
2302
2379
|
}
|
|
2303
2380
|
set surname(value) {
|
|
2304
|
-
this.
|
|
2381
|
+
this.setStorageProperty("surname", value);
|
|
2305
2382
|
}
|
|
2306
2383
|
get age() {
|
|
2307
2384
|
return this.getStorageProperty("age") || this.defaultAge;
|
|
2308
2385
|
}
|
|
2309
2386
|
set age(value) {
|
|
2310
|
-
this.
|
|
2387
|
+
this.setStorageProperty("age", value);
|
|
2311
2388
|
}
|
|
2312
2389
|
get icon() {
|
|
2313
2390
|
return this._icon;
|
|
@@ -2411,6 +2488,7 @@ var Label = class {
|
|
|
2411
2488
|
getChoiceMenuOptions,
|
|
2412
2489
|
getDialogue,
|
|
2413
2490
|
getDialogueHistory,
|
|
2491
|
+
getFlag,
|
|
2414
2492
|
getSaveData,
|
|
2415
2493
|
getSaveJson,
|
|
2416
2494
|
getTexture,
|
|
@@ -2421,6 +2499,7 @@ var Label = class {
|
|
|
2421
2499
|
saveCharacter,
|
|
2422
2500
|
setChoiceMenuOptions,
|
|
2423
2501
|
setDialogue,
|
|
2502
|
+
setFlag,
|
|
2424
2503
|
showCanvasImages,
|
|
2425
2504
|
showImageWithDissolveTransition,
|
|
2426
2505
|
tickerDecorator
|