@drincs/pixi-vn 0.1.4 → 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/README.md CHANGED
@@ -14,7 +14,7 @@ This allows the use of systems such as React, Vue, Angular, etc. to create much
14
14
  ### Installation
15
15
 
16
16
  ```bash
17
- npm install pixi-vn
17
+ npm install @drincs/pixi-vn
18
18
  ```
19
19
 
20
20
  ### Usage
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.updateStorageProperty<string>("name", value)
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.updateStorageProperty<string>("surname", value)
54
+ * this.setStorageProperty<string>("surname", value)
55
55
  * }
56
56
  * }
57
57
  * ```
58
58
  */
59
59
  declare abstract class StoredClassModel {
60
- id: string;
61
- constructor(id: string);
62
- private get nameClass();
63
- updateStorageProperty<T>(key: string, value: T | undefined): void;
64
- getStorageProperty<T>(key: string): T | undefined;
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 {
@@ -859,7 +877,7 @@ interface ExportedStep {
859
877
  }
860
878
 
861
879
  interface ISaveData {
862
- version: string;
880
+ pixivn_version: string;
863
881
  stepData: ExportedStep;
864
882
  storageData: ExportedStorage;
865
883
  canvasData: ExportedCanvas;
@@ -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
- * currentLabel is the current label that occurred during the progression of the steps.
1125
+ * currentLabelId is the current label id that occurred during the progression of the steps.
1095
1126
  */
1096
- private static get currentLabel();
1127
+ private static get currentLabelId();
1097
1128
  /**
1098
- * is the current step index of the current label that occurred during the progression of the steps.
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
  */
@@ -1190,6 +1226,10 @@ declare class GameStepManager {
1190
1226
  */
1191
1227
  static goBack(navigate: (path: string) => void, steps?: number): void;
1192
1228
  private static goBackInternal;
1229
+ /**
1230
+ * Return true if it is possible to go back.
1231
+ */
1232
+ static get canGoBack(): boolean;
1193
1233
  /**
1194
1234
  * Add a label to the history.
1195
1235
  */
@@ -1224,7 +1264,8 @@ declare class GameStorageManager {
1224
1264
  LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY: string;
1225
1265
  CURRENT_MENU_OPTIONS_MEMORY_KEY: string;
1226
1266
  LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY: string;
1227
- CHARACTER_PREKEY: string;
1267
+ CHARACTER_CATEGORY_KEY: string;
1268
+ FLAGS_CATEGORY_KEY: string;
1228
1269
  };
1229
1270
  /**
1230
1271
  * Set a variable in the storage
@@ -1507,4 +1548,4 @@ declare class GameWindowManager {
1507
1548
  static import(data: object): void;
1508
1549
  }
1509
1550
 
1510
- 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.updateStorageProperty<string>("name", value)
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.updateStorageProperty<string>("surname", value)
54
+ * this.setStorageProperty<string>("surname", value)
55
55
  * }
56
56
  * }
57
57
  * ```
58
58
  */
59
59
  declare abstract class StoredClassModel {
60
- id: string;
61
- constructor(id: string);
62
- private get nameClass();
63
- updateStorageProperty<T>(key: string, value: T | undefined): void;
64
- getStorageProperty<T>(key: string): T | undefined;
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 {
@@ -859,7 +877,7 @@ interface ExportedStep {
859
877
  }
860
878
 
861
879
  interface ISaveData {
862
- version: string;
880
+ pixivn_version: string;
863
881
  stepData: ExportedStep;
864
882
  storageData: ExportedStorage;
865
883
  canvasData: ExportedCanvas;
@@ -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
- * currentLabel is the current label that occurred during the progression of the steps.
1125
+ * currentLabelId is the current label id that occurred during the progression of the steps.
1095
1126
  */
1096
- private static get currentLabel();
1127
+ private static get currentLabelId();
1097
1128
  /**
1098
- * is the current step index of the current label that occurred during the progression of the steps.
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
  */
@@ -1190,6 +1226,10 @@ declare class GameStepManager {
1190
1226
  */
1191
1227
  static goBack(navigate: (path: string) => void, steps?: number): void;
1192
1228
  private static goBackInternal;
1229
+ /**
1230
+ * Return true if it is possible to go back.
1231
+ */
1232
+ static get canGoBack(): boolean;
1193
1233
  /**
1194
1234
  * Add a label to the history.
1195
1235
  */
@@ -1224,7 +1264,8 @@ declare class GameStorageManager {
1224
1264
  LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY: string;
1225
1265
  CURRENT_MENU_OPTIONS_MEMORY_KEY: string;
1226
1266
  LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY: string;
1227
- CHARACTER_PREKEY: string;
1267
+ CHARACTER_CATEGORY_KEY: string;
1268
+ FLAGS_CATEGORY_KEY: string;
1228
1269
  };
1229
1270
  /**
1230
1271
  * Set a variable in the storage
@@ -1507,4 +1548,4 @@ declare class GameWindowManager {
1507
1548
  static import(data: object): void;
1508
1549
  }
1509
1550
 
1510
- 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 };