-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update dependencies and refactor interface imports for improved struc…
…ture
- Loading branch information
1 parent
2e6aeab
commit 48d2c16
Showing
10 changed files
with
136 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { CharacterInterface } from "@drincs/pixi-vn/dist/override"; | ||
import { CharacterInterface } from "@drincs/pixi-vn"; | ||
|
||
export default interface CharacterBaseInterface extends CharacterInterface { | ||
id: string | ||
id: string; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
declare module "@drincs/pixi-vn" { | ||
/** | ||
* CharacterInterface is the interface that character must implement or extend. | ||
* So if you want to create your own Character, you must override this interface, implement or extend it and extend the {@link CharacterStoredClass} class. | ||
* You can override this interface to add your own props. | ||
* @example | ||
* ```typescript | ||
* // pixi-vn.d.ts | ||
* declare module '@drincs/pixi-vn' { | ||
* interface CharacterInterface { | ||
* name: string | ||
* surname?: string | ||
* age?: number | ||
* icon?: string | ||
* color?: string | ||
* } | ||
* } | ||
* // You Character class | ||
* export class Character extends CharacterStoredClass implements CharacterInterface { | ||
* constructor(id: string, props: CharacterProps) { | ||
* super(id) | ||
* this.defaultName = props.name | ||
* this.defaultSurname = props.surname | ||
* this.defaultAge = props.age | ||
* this._icon = props.icon | ||
* this._color = props.color | ||
* } | ||
* private defaultName: string = "" | ||
* get name(): string { | ||
* return this.getStorageProperty<string>("name") || this.defaultName | ||
* } | ||
* set name(value: string | undefined) { | ||
* this.setStorageProperty<string>("name", value) | ||
* } | ||
* private defaultSurname?: string | ||
* get surname(): string | undefined { | ||
* return this.getStorageProperty<string>("surname") || this.defaultSurname | ||
* } | ||
* set surname(value: string | undefined) { | ||
* this.setStorageProperty<string>("surname", value) | ||
* } | ||
* private defaultAge?: number | undefined | ||
* get age(): number | undefined { | ||
* return this.getStorageProperty<number>("age") || this.defaultAge | ||
* } | ||
* set age(value: number | undefined) { | ||
* this.setStorageProperty<number>("age", value) | ||
* } | ||
* private _icon?: string | ||
* get icon(): string | undefined { | ||
* return this._icon | ||
* } | ||
* private _color?: string | undefined | ||
* get color(): string | undefined { | ||
* return this._color | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
interface CharacterInterface { | ||
/** | ||
* The name of the character. | ||
*/ | ||
name: string; | ||
/** | ||
* The surname of the character. | ||
*/ | ||
surname?: string; | ||
/** | ||
* The age of the character. | ||
*/ | ||
age?: number; | ||
/** | ||
* The icon of the character. | ||
*/ | ||
readonly icon?: string; | ||
/** | ||
* The color of the character. | ||
*/ | ||
readonly color?: string; | ||
} | ||
/** | ||
* StepLabelPropsType is the type of the props that will be passed to the StepLabel. | ||
* You can override this interface to add your own props. | ||
* @example | ||
* ```typescript | ||
* // pixi-vn.d.ts | ||
* declare module '@drincs/pixi-vn' { | ||
* interface StepLabelProps { | ||
* navigate: (route: string) => void, | ||
* [key: string]: any | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
interface StepLabelProps { | ||
[key: string]: any; | ||
} | ||
/** | ||
* StepLabelResultType is the return type of the StepLabel function. | ||
* It can be useful for returning to the information calling function to perform other operations that cannot be performed within the StepLabel. | ||
* You can override this interface to add your own return types. | ||
* @example | ||
* ```typescript | ||
* // pixi-vn.d.ts | ||
* declare module '@drincs/pixi-vn' { | ||
* interface StepLabelResult { | ||
* newRoute?: string, | ||
* [key: string]: any | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
interface StepLabelResult { | ||
[key: string]: any; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
import { StepLabelProps, StepLabelResult } from '@drincs/pixi-vn/dist/override'; | ||
import { StepLabelProps, StepLabelResult } from "@drincs/pixi-vn"; | ||
|
||
export type StepLabelResultType = StepLabelResult | void | ||
export type StepLabelPropsType<T extends {} = {}> = StepLabelProps & T | ||
export type StepLabelResultType = StepLabelResult | void; | ||
export type StepLabelPropsType<T extends {} = {}> = StepLabelProps & T; | ||
|
||
/** | ||
* StepLabel is a function that will be executed as the game continues. | ||
*/ | ||
export type StepLabelType<T extends {} = {}> = ((props: StepLabelPropsType<T>, info: { | ||
/** | ||
* The id of the label. | ||
*/ | ||
labelId: string | ||
}) => StepLabelResultType | Promise<StepLabelResultType>) | ||
export type StepLabelType<T extends {} = {}> = ( | ||
props: StepLabelPropsType<T>, | ||
info: { | ||
/** | ||
* The id of the label. | ||
*/ | ||
labelId: string; | ||
} | ||
) => StepLabelResultType | Promise<StepLabelResultType>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters