@drincs/pixi-vn 0.3.6 → 0.4.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 +1 -84
- package/dist/index.d.mts +106 -32
- package/dist/index.d.ts +106 -32
- package/dist/index.js +94 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +91 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,89 +9,6 @@ Pixi'VN is based on [Pixi.js](https://pixijs.com/), a modern 2D rendering engine
|
|
|
9
9
|
In addition to managing the Pixi.js "Canvas", Pixi'VN offers the possibility of adding an HTML Element with the same dimensions as the "Canvas" to add interactions with the user.
|
|
10
10
|
This allows the use of systems such as React, Vue, Angular, etc. to create much more complex interfaces with excellent performance.
|
|
11
11
|
|
|
12
|
-
## Why Pixi'VN?
|
|
13
|
-
|
|
14
|
-
The reason why Pixi'VN was born is that current systems for creating a visual novel are based on dated systems and have many shortcomings.
|
|
15
|
-
|
|
16
|
-
## Pivi'VN Templates
|
|
17
|
-
|
|
18
|
-
* [Pixi’VN template (React + Vite + MUI joy)](https://github.com/DRincs-Productions/pixi-vn-react-template)
|
|
19
|
-
|
|
20
|
-
## Get Started
|
|
21
|
-
|
|
22
|
-
### Installation
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
npm install @drincs/pixi-vn
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### Usage
|
|
29
|
-
|
|
30
|
-
For the following example, we will use React to create the interface and Pixi'VN to manage the visual novel.
|
|
31
|
-
|
|
32
|
-
```typescript
|
|
33
|
-
// main.tsx
|
|
34
|
-
|
|
35
|
-
import { GameWindowManager } from '@drincs/pixi-vn'
|
|
36
|
-
import { createRoot } from 'react-dom/client'
|
|
37
|
-
import App from './App'
|
|
38
|
-
import './index.css'
|
|
39
|
-
|
|
40
|
-
// Canvas setup with PIXI
|
|
41
|
-
const body = document.body
|
|
42
|
-
if (!body) {
|
|
43
|
-
throw new Error('body element not found')
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
GameWindowManager.initialize(body, 1920, 1080, {
|
|
47
|
-
backgroundColor: "#303030"
|
|
48
|
-
}).then(() => {
|
|
49
|
-
// React setup with ReactDOM
|
|
50
|
-
const root = document.getElementById('root')
|
|
51
|
-
if (!root) {
|
|
52
|
-
throw new Error('root element not found')
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
GameWindowManager.initializeHTMLLayout(root)
|
|
56
|
-
const reactRoot = createRoot(GameWindowManager.htmlLayout)
|
|
57
|
-
|
|
58
|
-
reactRoot.render(
|
|
59
|
-
<App />
|
|
60
|
-
)
|
|
61
|
-
})
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
This is the HTML file that will be used to load the application.
|
|
65
|
-
|
|
66
|
-
```html
|
|
67
|
-
<!-- index.html -->
|
|
68
|
-
<!doctype html>
|
|
69
|
-
<html lang="en">
|
|
70
|
-
<head>
|
|
71
|
-
<meta charset="UTF-8" />
|
|
72
|
-
<link rel="icon" type="image/svg+xml" href="/pixiVN.svg" />
|
|
73
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
74
|
-
<title>Pixi'VN</title>
|
|
75
|
-
</head>
|
|
76
|
-
<body>
|
|
77
|
-
<div id="root"></div>
|
|
78
|
-
<script type="module" src="/src/main.tsx"></script>
|
|
79
|
-
</body>
|
|
80
|
-
</html>
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
```css
|
|
84
|
-
/* index.css */
|
|
85
|
-
:root {
|
|
86
|
-
background-color: #242424;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
body {
|
|
90
|
-
margin: 0;
|
|
91
|
-
display: flex;
|
|
92
|
-
}
|
|
93
|
-
```
|
|
94
|
-
|
|
95
12
|
## Wiki
|
|
96
13
|
|
|
97
|
-
For more information, visit the [
|
|
14
|
+
For more information, visit the [Web Page](https://pixi-vn.web.app/)
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as pixi_js from 'pixi.js';
|
|
2
2
|
import { ContainerOptions, SpriteOptions, TextOptions, Container, Sprite, ContainerEvents, EventEmitter, Texture, TextureSourceLike, Text, UPDATE_PRIORITY, Ticker, TickerCallback, Application, ApplicationOptions } from 'pixi.js';
|
|
3
|
+
export { Assets } from 'pixi.js';
|
|
3
4
|
import deepDiff from 'deep-diff';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -300,8 +301,24 @@ type StorageElementInternalType = StorageElementPrimaryType | Record<string | nu
|
|
|
300
301
|
/**
|
|
301
302
|
* StorageElementType are all the types that can be stored in the storage
|
|
302
303
|
*/
|
|
303
|
-
type StorageElementType = StorageElementInternalType | Record<string | number | symbol, StorageElementInternalType
|
|
304
|
+
type StorageElementType = StorageElementInternalType | Record<string | number | symbol, StorageElementInternalType> | {
|
|
305
|
+
[key: string | number | symbol]: StorageElementType;
|
|
306
|
+
};
|
|
304
307
|
|
|
308
|
+
type DialogueData = {
|
|
309
|
+
/**
|
|
310
|
+
* The text of the dialogue.
|
|
311
|
+
*/
|
|
312
|
+
text: string;
|
|
313
|
+
/**
|
|
314
|
+
* The id of the character that is speaking.
|
|
315
|
+
*/
|
|
316
|
+
characterId?: string;
|
|
317
|
+
/**
|
|
318
|
+
* Other parameters that can be stored in the dialogue.
|
|
319
|
+
*/
|
|
320
|
+
oltherParams?: Record<string | number | symbol, StorageElementType>;
|
|
321
|
+
};
|
|
305
322
|
/**
|
|
306
323
|
* Base class for all dialogue models.
|
|
307
324
|
* You can extend this class, but it is not reccomended. You can use the oltherParams property to store any other data you need.
|
|
@@ -310,13 +327,13 @@ type StorageElementType = StorageElementInternalType | Record<string | number |
|
|
|
310
327
|
* setDialogue(new DialogueBaseModel("Hello World", character))
|
|
311
328
|
* ```
|
|
312
329
|
*/
|
|
313
|
-
declare class DialogueBaseModel<TCharacter extends CharacterBaseModel = CharacterBaseModel> {
|
|
330
|
+
declare class DialogueBaseModel<TCharacter extends CharacterBaseModel = CharacterBaseModel> implements DialogueData {
|
|
314
331
|
/**
|
|
315
332
|
* @param text The text of the dialogue.
|
|
316
333
|
* @param character The id of the character that is speaking.
|
|
317
334
|
* @param oltherParams Other parameters that can be stored in the dialogue.
|
|
318
335
|
*/
|
|
319
|
-
constructor(text: string, character
|
|
336
|
+
constructor(text: string | DialogueData, character?: string | TCharacter, oltherParams?: {
|
|
320
337
|
[key: string]: StorageElementType;
|
|
321
338
|
});
|
|
322
339
|
/**
|
|
@@ -333,6 +350,12 @@ declare class DialogueBaseModel<TCharacter extends CharacterBaseModel = Characte
|
|
|
333
350
|
oltherParams: {
|
|
334
351
|
[key: string]: StorageElementType;
|
|
335
352
|
};
|
|
353
|
+
/**
|
|
354
|
+
* Export the dialogue to a DialogueBaseData object.
|
|
355
|
+
*
|
|
356
|
+
* @returns The data of the dialogue.
|
|
357
|
+
*/
|
|
358
|
+
export(): DialogueData;
|
|
336
359
|
}
|
|
337
360
|
|
|
338
361
|
/**
|
|
@@ -521,11 +544,26 @@ declare class CanvasSprite<Memory extends SpriteOptions & ICanvasBaseMemory = IC
|
|
|
521
544
|
static from(source: Texture | TextureSourceLike, skipCache?: boolean): CanvasSprite<any>;
|
|
522
545
|
}
|
|
523
546
|
|
|
547
|
+
interface CanvasImageOptions extends SpriteOptions {
|
|
548
|
+
/**
|
|
549
|
+
* The image link to load in the canvas.
|
|
550
|
+
*/
|
|
551
|
+
textureImage?: string;
|
|
552
|
+
}
|
|
524
553
|
/**
|
|
525
554
|
* This class is a extension of the CanvasSprite class, it has the same properties and methods,
|
|
526
555
|
* but it has some features that make texture management easier.
|
|
527
556
|
* You need to use CanvasImage.load() to show the image in the canvas.
|
|
528
|
-
* This class is used for functions like addImage,
|
|
557
|
+
* This class is used for functions like addImage, loadImages and showImageWithDissolveTransition.
|
|
558
|
+
* @example
|
|
559
|
+
* ```typescript
|
|
560
|
+
* let alien = new CanvasImage({ textureImage: 'https://pixijs.com/assets/eggHead.png' })
|
|
561
|
+
* alien.anchor.set(0.5);
|
|
562
|
+
* alien.x = 100
|
|
563
|
+
* alien.y = 100
|
|
564
|
+
* await alien.load()
|
|
565
|
+
* GameWindowManager.addCanvasElement("alien", alien)
|
|
566
|
+
* ```
|
|
529
567
|
* @example
|
|
530
568
|
* ```typescript
|
|
531
569
|
* let alien = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
|
|
@@ -536,6 +574,7 @@ declare class CanvasSprite<Memory extends SpriteOptions & ICanvasBaseMemory = IC
|
|
|
536
574
|
* ```
|
|
537
575
|
*/
|
|
538
576
|
declare class CanvasImage extends CanvasSprite<ICanvasImageMemory> {
|
|
577
|
+
constructor(options?: CanvasImageOptions | Texture | undefined);
|
|
539
578
|
get memory(): ICanvasImageMemory;
|
|
540
579
|
set memory(memory: ICanvasImageMemory);
|
|
541
580
|
imageLink: string;
|
|
@@ -688,7 +727,7 @@ type TickerFadeAlphaProps = {
|
|
|
688
727
|
/**
|
|
689
728
|
* The speed of the fade
|
|
690
729
|
*/
|
|
691
|
-
speed
|
|
730
|
+
speed?: number;
|
|
692
731
|
/**
|
|
693
732
|
* The type of the fade
|
|
694
733
|
* @default "hide"
|
|
@@ -731,27 +770,9 @@ declare class TickerFadeAlpha extends TickerBase<TickerFadeAlphaProps> {
|
|
|
731
770
|
* @param args The arguments that are passed to the ticker
|
|
732
771
|
* @param tags The tags of the canvas element that are connected to this ticker
|
|
733
772
|
*/
|
|
734
|
-
fn(t: Ticker, args:
|
|
735
|
-
speed?: number;
|
|
736
|
-
type?: "hide" | "show";
|
|
737
|
-
limit?: number;
|
|
738
|
-
tagToRemoveAfter?: string[] | string;
|
|
739
|
-
startOnlyIfHaveTexture?: boolean;
|
|
740
|
-
}, tags: string[]): void;
|
|
773
|
+
fn(t: Ticker, args: TickerFadeAlphaProps, tags: string[]): void;
|
|
741
774
|
}
|
|
742
775
|
|
|
743
|
-
type TickerProgrationType = ITickerProgrationLinear | ITickerProgrationExponential;
|
|
744
|
-
type ITickerProgrationLinear = {
|
|
745
|
-
amt: number;
|
|
746
|
-
limit?: number;
|
|
747
|
-
type: "linear";
|
|
748
|
-
};
|
|
749
|
-
type ITickerProgrationExponential = {
|
|
750
|
-
percentage: number;
|
|
751
|
-
limit?: number;
|
|
752
|
-
type: "exponential";
|
|
753
|
-
};
|
|
754
|
-
|
|
755
776
|
/**
|
|
756
777
|
* is a string that represents a ticker id.
|
|
757
778
|
* It is used to GameWindowManager.tickers to get the ticker class.
|
|
@@ -913,6 +934,63 @@ interface ITickersSteps {
|
|
|
913
934
|
steps: (ITickersStep<any> | RepeatType | PauseType)[];
|
|
914
935
|
}
|
|
915
936
|
|
|
937
|
+
type TickerProgrationType = ITickerProgrationLinear | ITickerProgrationExponential;
|
|
938
|
+
type ITickerProgrationLinear = {
|
|
939
|
+
amt: number;
|
|
940
|
+
limit?: number;
|
|
941
|
+
type: "linear";
|
|
942
|
+
};
|
|
943
|
+
type ITickerProgrationExponential = {
|
|
944
|
+
percentage: number;
|
|
945
|
+
limit?: number;
|
|
946
|
+
type: "exponential";
|
|
947
|
+
};
|
|
948
|
+
|
|
949
|
+
type TickerMoveProps = {
|
|
950
|
+
/**
|
|
951
|
+
* The speed of the movement
|
|
952
|
+
* @default 0.1
|
|
953
|
+
*/
|
|
954
|
+
speed?: number;
|
|
955
|
+
/**
|
|
956
|
+
* The destination of the movement
|
|
957
|
+
*/
|
|
958
|
+
destination: {
|
|
959
|
+
y: number;
|
|
960
|
+
x: number;
|
|
961
|
+
};
|
|
962
|
+
/**
|
|
963
|
+
* The progression of the speed
|
|
964
|
+
*/
|
|
965
|
+
speedProgression?: TickerProgrationType;
|
|
966
|
+
/**
|
|
967
|
+
* If true, the rotation only starts if the canvas element have a texture
|
|
968
|
+
*/
|
|
969
|
+
startOnlyIfHaveTexture?: boolean;
|
|
970
|
+
};
|
|
971
|
+
|
|
972
|
+
/**
|
|
973
|
+
* A ticker that moves the canvas element of the canvas.
|
|
974
|
+
* @example
|
|
975
|
+
* ```typescript
|
|
976
|
+
* let alien = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
|
|
977
|
+
* GameWindowManager.addCanvasElement("alien", alien);
|
|
978
|
+
* const ticker = new TickerMove({
|
|
979
|
+
* speed: 0.1,
|
|
980
|
+
* destination: { x: 100, y: 100 },
|
|
981
|
+
* }),
|
|
982
|
+
* ```
|
|
983
|
+
*/
|
|
984
|
+
declare class TickerMove extends TickerBase<TickerMoveProps> {
|
|
985
|
+
/**
|
|
986
|
+
* The method that will be called every frame to move the canvas element of the canvas.
|
|
987
|
+
* @param t The ticker that is calling this method
|
|
988
|
+
* @param args The arguments that are passed to the ticker
|
|
989
|
+
* @param tags The tags of the canvas element that are connected to this ticker
|
|
990
|
+
*/
|
|
991
|
+
fn(t: Ticker, args: TickerMoveProps, tags: string[]): void;
|
|
992
|
+
}
|
|
993
|
+
|
|
916
994
|
type TickerRotateProps = {
|
|
917
995
|
/**
|
|
918
996
|
* The speed of the rotation
|
|
@@ -945,6 +1023,7 @@ type TickerRotateProps = {
|
|
|
945
1023
|
* clockwise: true,
|
|
946
1024
|
* }),
|
|
947
1025
|
* GameWindowManager.addTicker("alien", ticker)
|
|
1026
|
+
* ```
|
|
948
1027
|
*/
|
|
949
1028
|
declare class TickerRotate extends TickerBase<TickerRotateProps> {
|
|
950
1029
|
/**
|
|
@@ -953,12 +1032,7 @@ declare class TickerRotate extends TickerBase<TickerRotateProps> {
|
|
|
953
1032
|
* @param args The arguments that are passed to the ticker
|
|
954
1033
|
* @param tags The tags of the canvas element that are connected to this ticker
|
|
955
1034
|
*/
|
|
956
|
-
fn(t: Ticker, args:
|
|
957
|
-
speed?: number;
|
|
958
|
-
clockwise?: boolean;
|
|
959
|
-
speedProgression?: TickerProgrationType;
|
|
960
|
-
startOnlyIfHaveTexture?: boolean;
|
|
961
|
-
}, tags: string[]): void;
|
|
1035
|
+
fn(t: Ticker, args: TickerRotateProps, tags: string[]): void;
|
|
962
1036
|
}
|
|
963
1037
|
|
|
964
1038
|
type CanvasElementTagType = string;
|
|
@@ -1122,7 +1196,7 @@ declare function addImage(tag: string, imageUrl: string): CanvasImage;
|
|
|
1122
1196
|
* @param canvasImages is a list of images to show.
|
|
1123
1197
|
* @returns the list of images.
|
|
1124
1198
|
*/
|
|
1125
|
-
declare function
|
|
1199
|
+
declare function loadImages(canvasImages: CanvasImage[] | CanvasImage): Promise<CanvasImage[]>;
|
|
1126
1200
|
/**
|
|
1127
1201
|
* Remove a image from the canvas.
|
|
1128
1202
|
* @param tag is the unique tag of the image. You can use this tag to refer to this image
|
|
@@ -1679,4 +1753,4 @@ declare class GameWindowManager {
|
|
|
1679
1753
|
static import(data: object): void;
|
|
1680
1754
|
}
|
|
1681
1755
|
|
|
1682
|
-
export { CanvasBase, CanvasContainer, CanvasEvent, type CanvasEventNamesType, CanvasImage, CanvasSprite, CanvasText, CharacterBaseModel, type CharacterBaseModelProps, ChoiceMenuOptionLabel, type ChoiceMenuOptionsType, DialogueBaseModel, 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 StepLabelResultType, type StepLabelType, type StorageElementType, StoredClassModel, TickerBase, TickerFadeAlpha, type TickerFadeAlphaProps, type TickerProgrationType, TickerRotate, type TickerRotateProps, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getAllCharacters, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getSaveData, getSaveJson, getTexture, labelDecorator, loadSaveData, loadSaveJson, removeCanvasElement, saveCharacter, setChoiceMenuOptions, setDialogue, setFlag,
|
|
1756
|
+
export { CanvasBase, CanvasContainer, CanvasEvent, type CanvasEventNamesType, CanvasImage, CanvasSprite, CanvasText, CharacterBaseModel, type CharacterBaseModelProps, ChoiceMenuOptionLabel, type ChoiceMenuOptionsType, DialogueBaseModel, 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 StepLabelResultType, type StepLabelType, type StorageElementType, StoredClassModel, TickerBase, TickerFadeAlpha, type TickerFadeAlphaProps, TickerMove, type TickerProgrationType, TickerRotate, type TickerRotateProps, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getAllCharacters, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getSaveData, getSaveJson, getTexture, labelDecorator, loadImages, loadSaveData, loadSaveJson, removeCanvasElement, saveCharacter, setChoiceMenuOptions, setDialogue, setFlag, showImageWithDissolveTransition, tickerDecorator };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as pixi_js from 'pixi.js';
|
|
2
2
|
import { ContainerOptions, SpriteOptions, TextOptions, Container, Sprite, ContainerEvents, EventEmitter, Texture, TextureSourceLike, Text, UPDATE_PRIORITY, Ticker, TickerCallback, Application, ApplicationOptions } from 'pixi.js';
|
|
3
|
+
export { Assets } from 'pixi.js';
|
|
3
4
|
import deepDiff from 'deep-diff';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -300,8 +301,24 @@ type StorageElementInternalType = StorageElementPrimaryType | Record<string | nu
|
|
|
300
301
|
/**
|
|
301
302
|
* StorageElementType are all the types that can be stored in the storage
|
|
302
303
|
*/
|
|
303
|
-
type StorageElementType = StorageElementInternalType | Record<string | number | symbol, StorageElementInternalType
|
|
304
|
+
type StorageElementType = StorageElementInternalType | Record<string | number | symbol, StorageElementInternalType> | {
|
|
305
|
+
[key: string | number | symbol]: StorageElementType;
|
|
306
|
+
};
|
|
304
307
|
|
|
308
|
+
type DialogueData = {
|
|
309
|
+
/**
|
|
310
|
+
* The text of the dialogue.
|
|
311
|
+
*/
|
|
312
|
+
text: string;
|
|
313
|
+
/**
|
|
314
|
+
* The id of the character that is speaking.
|
|
315
|
+
*/
|
|
316
|
+
characterId?: string;
|
|
317
|
+
/**
|
|
318
|
+
* Other parameters that can be stored in the dialogue.
|
|
319
|
+
*/
|
|
320
|
+
oltherParams?: Record<string | number | symbol, StorageElementType>;
|
|
321
|
+
};
|
|
305
322
|
/**
|
|
306
323
|
* Base class for all dialogue models.
|
|
307
324
|
* You can extend this class, but it is not reccomended. You can use the oltherParams property to store any other data you need.
|
|
@@ -310,13 +327,13 @@ type StorageElementType = StorageElementInternalType | Record<string | number |
|
|
|
310
327
|
* setDialogue(new DialogueBaseModel("Hello World", character))
|
|
311
328
|
* ```
|
|
312
329
|
*/
|
|
313
|
-
declare class DialogueBaseModel<TCharacter extends CharacterBaseModel = CharacterBaseModel> {
|
|
330
|
+
declare class DialogueBaseModel<TCharacter extends CharacterBaseModel = CharacterBaseModel> implements DialogueData {
|
|
314
331
|
/**
|
|
315
332
|
* @param text The text of the dialogue.
|
|
316
333
|
* @param character The id of the character that is speaking.
|
|
317
334
|
* @param oltherParams Other parameters that can be stored in the dialogue.
|
|
318
335
|
*/
|
|
319
|
-
constructor(text: string, character
|
|
336
|
+
constructor(text: string | DialogueData, character?: string | TCharacter, oltherParams?: {
|
|
320
337
|
[key: string]: StorageElementType;
|
|
321
338
|
});
|
|
322
339
|
/**
|
|
@@ -333,6 +350,12 @@ declare class DialogueBaseModel<TCharacter extends CharacterBaseModel = Characte
|
|
|
333
350
|
oltherParams: {
|
|
334
351
|
[key: string]: StorageElementType;
|
|
335
352
|
};
|
|
353
|
+
/**
|
|
354
|
+
* Export the dialogue to a DialogueBaseData object.
|
|
355
|
+
*
|
|
356
|
+
* @returns The data of the dialogue.
|
|
357
|
+
*/
|
|
358
|
+
export(): DialogueData;
|
|
336
359
|
}
|
|
337
360
|
|
|
338
361
|
/**
|
|
@@ -521,11 +544,26 @@ declare class CanvasSprite<Memory extends SpriteOptions & ICanvasBaseMemory = IC
|
|
|
521
544
|
static from(source: Texture | TextureSourceLike, skipCache?: boolean): CanvasSprite<any>;
|
|
522
545
|
}
|
|
523
546
|
|
|
547
|
+
interface CanvasImageOptions extends SpriteOptions {
|
|
548
|
+
/**
|
|
549
|
+
* The image link to load in the canvas.
|
|
550
|
+
*/
|
|
551
|
+
textureImage?: string;
|
|
552
|
+
}
|
|
524
553
|
/**
|
|
525
554
|
* This class is a extension of the CanvasSprite class, it has the same properties and methods,
|
|
526
555
|
* but it has some features that make texture management easier.
|
|
527
556
|
* You need to use CanvasImage.load() to show the image in the canvas.
|
|
528
|
-
* This class is used for functions like addImage,
|
|
557
|
+
* This class is used for functions like addImage, loadImages and showImageWithDissolveTransition.
|
|
558
|
+
* @example
|
|
559
|
+
* ```typescript
|
|
560
|
+
* let alien = new CanvasImage({ textureImage: 'https://pixijs.com/assets/eggHead.png' })
|
|
561
|
+
* alien.anchor.set(0.5);
|
|
562
|
+
* alien.x = 100
|
|
563
|
+
* alien.y = 100
|
|
564
|
+
* await alien.load()
|
|
565
|
+
* GameWindowManager.addCanvasElement("alien", alien)
|
|
566
|
+
* ```
|
|
529
567
|
* @example
|
|
530
568
|
* ```typescript
|
|
531
569
|
* let alien = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
|
|
@@ -536,6 +574,7 @@ declare class CanvasSprite<Memory extends SpriteOptions & ICanvasBaseMemory = IC
|
|
|
536
574
|
* ```
|
|
537
575
|
*/
|
|
538
576
|
declare class CanvasImage extends CanvasSprite<ICanvasImageMemory> {
|
|
577
|
+
constructor(options?: CanvasImageOptions | Texture | undefined);
|
|
539
578
|
get memory(): ICanvasImageMemory;
|
|
540
579
|
set memory(memory: ICanvasImageMemory);
|
|
541
580
|
imageLink: string;
|
|
@@ -688,7 +727,7 @@ type TickerFadeAlphaProps = {
|
|
|
688
727
|
/**
|
|
689
728
|
* The speed of the fade
|
|
690
729
|
*/
|
|
691
|
-
speed
|
|
730
|
+
speed?: number;
|
|
692
731
|
/**
|
|
693
732
|
* The type of the fade
|
|
694
733
|
* @default "hide"
|
|
@@ -731,27 +770,9 @@ declare class TickerFadeAlpha extends TickerBase<TickerFadeAlphaProps> {
|
|
|
731
770
|
* @param args The arguments that are passed to the ticker
|
|
732
771
|
* @param tags The tags of the canvas element that are connected to this ticker
|
|
733
772
|
*/
|
|
734
|
-
fn(t: Ticker, args:
|
|
735
|
-
speed?: number;
|
|
736
|
-
type?: "hide" | "show";
|
|
737
|
-
limit?: number;
|
|
738
|
-
tagToRemoveAfter?: string[] | string;
|
|
739
|
-
startOnlyIfHaveTexture?: boolean;
|
|
740
|
-
}, tags: string[]): void;
|
|
773
|
+
fn(t: Ticker, args: TickerFadeAlphaProps, tags: string[]): void;
|
|
741
774
|
}
|
|
742
775
|
|
|
743
|
-
type TickerProgrationType = ITickerProgrationLinear | ITickerProgrationExponential;
|
|
744
|
-
type ITickerProgrationLinear = {
|
|
745
|
-
amt: number;
|
|
746
|
-
limit?: number;
|
|
747
|
-
type: "linear";
|
|
748
|
-
};
|
|
749
|
-
type ITickerProgrationExponential = {
|
|
750
|
-
percentage: number;
|
|
751
|
-
limit?: number;
|
|
752
|
-
type: "exponential";
|
|
753
|
-
};
|
|
754
|
-
|
|
755
776
|
/**
|
|
756
777
|
* is a string that represents a ticker id.
|
|
757
778
|
* It is used to GameWindowManager.tickers to get the ticker class.
|
|
@@ -913,6 +934,63 @@ interface ITickersSteps {
|
|
|
913
934
|
steps: (ITickersStep<any> | RepeatType | PauseType)[];
|
|
914
935
|
}
|
|
915
936
|
|
|
937
|
+
type TickerProgrationType = ITickerProgrationLinear | ITickerProgrationExponential;
|
|
938
|
+
type ITickerProgrationLinear = {
|
|
939
|
+
amt: number;
|
|
940
|
+
limit?: number;
|
|
941
|
+
type: "linear";
|
|
942
|
+
};
|
|
943
|
+
type ITickerProgrationExponential = {
|
|
944
|
+
percentage: number;
|
|
945
|
+
limit?: number;
|
|
946
|
+
type: "exponential";
|
|
947
|
+
};
|
|
948
|
+
|
|
949
|
+
type TickerMoveProps = {
|
|
950
|
+
/**
|
|
951
|
+
* The speed of the movement
|
|
952
|
+
* @default 0.1
|
|
953
|
+
*/
|
|
954
|
+
speed?: number;
|
|
955
|
+
/**
|
|
956
|
+
* The destination of the movement
|
|
957
|
+
*/
|
|
958
|
+
destination: {
|
|
959
|
+
y: number;
|
|
960
|
+
x: number;
|
|
961
|
+
};
|
|
962
|
+
/**
|
|
963
|
+
* The progression of the speed
|
|
964
|
+
*/
|
|
965
|
+
speedProgression?: TickerProgrationType;
|
|
966
|
+
/**
|
|
967
|
+
* If true, the rotation only starts if the canvas element have a texture
|
|
968
|
+
*/
|
|
969
|
+
startOnlyIfHaveTexture?: boolean;
|
|
970
|
+
};
|
|
971
|
+
|
|
972
|
+
/**
|
|
973
|
+
* A ticker that moves the canvas element of the canvas.
|
|
974
|
+
* @example
|
|
975
|
+
* ```typescript
|
|
976
|
+
* let alien = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
|
|
977
|
+
* GameWindowManager.addCanvasElement("alien", alien);
|
|
978
|
+
* const ticker = new TickerMove({
|
|
979
|
+
* speed: 0.1,
|
|
980
|
+
* destination: { x: 100, y: 100 },
|
|
981
|
+
* }),
|
|
982
|
+
* ```
|
|
983
|
+
*/
|
|
984
|
+
declare class TickerMove extends TickerBase<TickerMoveProps> {
|
|
985
|
+
/**
|
|
986
|
+
* The method that will be called every frame to move the canvas element of the canvas.
|
|
987
|
+
* @param t The ticker that is calling this method
|
|
988
|
+
* @param args The arguments that are passed to the ticker
|
|
989
|
+
* @param tags The tags of the canvas element that are connected to this ticker
|
|
990
|
+
*/
|
|
991
|
+
fn(t: Ticker, args: TickerMoveProps, tags: string[]): void;
|
|
992
|
+
}
|
|
993
|
+
|
|
916
994
|
type TickerRotateProps = {
|
|
917
995
|
/**
|
|
918
996
|
* The speed of the rotation
|
|
@@ -945,6 +1023,7 @@ type TickerRotateProps = {
|
|
|
945
1023
|
* clockwise: true,
|
|
946
1024
|
* }),
|
|
947
1025
|
* GameWindowManager.addTicker("alien", ticker)
|
|
1026
|
+
* ```
|
|
948
1027
|
*/
|
|
949
1028
|
declare class TickerRotate extends TickerBase<TickerRotateProps> {
|
|
950
1029
|
/**
|
|
@@ -953,12 +1032,7 @@ declare class TickerRotate extends TickerBase<TickerRotateProps> {
|
|
|
953
1032
|
* @param args The arguments that are passed to the ticker
|
|
954
1033
|
* @param tags The tags of the canvas element that are connected to this ticker
|
|
955
1034
|
*/
|
|
956
|
-
fn(t: Ticker, args:
|
|
957
|
-
speed?: number;
|
|
958
|
-
clockwise?: boolean;
|
|
959
|
-
speedProgression?: TickerProgrationType;
|
|
960
|
-
startOnlyIfHaveTexture?: boolean;
|
|
961
|
-
}, tags: string[]): void;
|
|
1035
|
+
fn(t: Ticker, args: TickerRotateProps, tags: string[]): void;
|
|
962
1036
|
}
|
|
963
1037
|
|
|
964
1038
|
type CanvasElementTagType = string;
|
|
@@ -1122,7 +1196,7 @@ declare function addImage(tag: string, imageUrl: string): CanvasImage;
|
|
|
1122
1196
|
* @param canvasImages is a list of images to show.
|
|
1123
1197
|
* @returns the list of images.
|
|
1124
1198
|
*/
|
|
1125
|
-
declare function
|
|
1199
|
+
declare function loadImages(canvasImages: CanvasImage[] | CanvasImage): Promise<CanvasImage[]>;
|
|
1126
1200
|
/**
|
|
1127
1201
|
* Remove a image from the canvas.
|
|
1128
1202
|
* @param tag is the unique tag of the image. You can use this tag to refer to this image
|
|
@@ -1679,4 +1753,4 @@ declare class GameWindowManager {
|
|
|
1679
1753
|
static import(data: object): void;
|
|
1680
1754
|
}
|
|
1681
1755
|
|
|
1682
|
-
export { CanvasBase, CanvasContainer, CanvasEvent, type CanvasEventNamesType, CanvasImage, CanvasSprite, CanvasText, CharacterBaseModel, type CharacterBaseModelProps, ChoiceMenuOptionLabel, type ChoiceMenuOptionsType, DialogueBaseModel, 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 StepLabelResultType, type StepLabelType, type StorageElementType, StoredClassModel, TickerBase, TickerFadeAlpha, type TickerFadeAlphaProps, type TickerProgrationType, TickerRotate, type TickerRotateProps, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getAllCharacters, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getSaveData, getSaveJson, getTexture, labelDecorator, loadSaveData, loadSaveJson, removeCanvasElement, saveCharacter, setChoiceMenuOptions, setDialogue, setFlag,
|
|
1756
|
+
export { CanvasBase, CanvasContainer, CanvasEvent, type CanvasEventNamesType, CanvasImage, CanvasSprite, CanvasText, CharacterBaseModel, type CharacterBaseModelProps, ChoiceMenuOptionLabel, type ChoiceMenuOptionsType, DialogueBaseModel, 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 StepLabelResultType, type StepLabelType, type StorageElementType, StoredClassModel, TickerBase, TickerFadeAlpha, type TickerFadeAlphaProps, TickerMove, type TickerProgrationType, TickerRotate, type TickerRotateProps, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getAllCharacters, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getSaveData, getSaveJson, getTexture, labelDecorator, loadImages, loadSaveData, loadSaveJson, removeCanvasElement, saveCharacter, setChoiceMenuOptions, setDialogue, setFlag, showImageWithDissolveTransition, tickerDecorator };
|