Skip to content

Commit

Permalink
Update d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
rexrainbow committed Sep 25, 2023
1 parent f579ee6 commit c05b302
Showing 1 changed file with 72 additions and 34 deletions.
106 changes: 72 additions & 34 deletions templates/ui/tweaker/Tweaker.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import BaseSizer from '../basesizer/BaseSizer';
import Sizer from '../sizer/Sizer';
import RoundRectangle from '../roundrectangle/RoundRectangle';
import CreateBackground from '../utils/build/CreateBackground';
Expand Down Expand Up @@ -45,51 +46,52 @@ declare namespace Tweaker {
}
}

interface IInputRowStyle {
background?: CreateBackground.IConfig,

interface IConfig extends Sizer.IConfig {
styles: {
itemWidth?: number,
title?: SimpleLabel.IConfig,

background?: CreateBackground.IConfig,
inputText?: InputText.IConfig,

inputRow?: {
background?: CreateBackground.IConfig,
inputTextArea?: InputTextArea.IConfig,

title?: SimpleLabel.IConfig,
slider?: {
track: RoundRectangle.IConfig,
indicator: RoundRectangle.IConfig,
thumb: RoundRectangle.IConfig,
},

inputText?: InputText.IConfig,
list?: {
label?: SimpleLabel.IConfig,

inputTextArea?: InputTextArea.IConfig,
button?: IInteractiveLabelConfig,
},

slider?: {
track: RoundRectangle.IConfig,
indicator: RoundRectangle.IConfig,
thumb: RoundRectangle.IConfig,
},
button?: IButtonConfig,

list?: {
label?: SimpleLabel.IConfig,
checkbox?: Checkbox.IConfig,

button?: IInteractiveLabelConfig,
},
toggleSwitch?: ToggleSwitch.IConfig,

button?: IButtonConfig,
colorInput?: ColorInput.IConfig,

checkbox?: Checkbox.IConfig,
proportion?: {
title?: number,
inputField?: number,
range?: {
slider?: number,
inputText?: number,
}
}
}

toggleSwitch?: ToggleSwitch.IConfig,
interface IConfig extends Sizer.IConfig {
styles: {
itemWidth?: number,

colorInput?: ColorInput.IConfig,
background?: CreateBackground.IConfig,

proportion?: {
title?: number,
inputField?: number,
range?: {
slider?: number,
inputText?: number,
}
}
},
inputRow?: IInputRowStyle,

folder?: {
title?: SimpleLabel.IConfig,
Expand Down Expand Up @@ -119,13 +121,40 @@ declare namespace Tweaker {
}
}

interface IInputHandlerConfig {
name?: string,

baseClass?: BaseSizer,

accept: (
config: IAddInputConfig,
value: unknown
) => boolean,

build: (
gameObject: BaseSizer,
style: IInputRowStyle
) => void,

setup?: (
gameObject: BaseSizer,
config: IAddInputConfig,
setDefaults: boolean,
) => void,

displayValue?: (
gameObject: BaseSizer,
value: unknown
) => void,

}

interface IAddInputConfig {
bindingTarget?: Object,
bindingKey?: string,
autoUpdate?: boolean,

view?: 'string' | 'textarea' | 'number' | 'range' | 'list' | 'buttons' | 'boolean' | 'color' |
((scene: Phaser.Scene, config: Object, style: Object) => Phaser.GameObjects.GameObject),
view?: string,

icon?: string,
iconFrame?: string,
Expand All @@ -135,8 +164,10 @@ declare namespace Tweaker {

orientation?: Sizer.OrientationTypes,

// range
min?: number, max?: number,

// list, buttons
options?: {
text: string,
value: any
Expand Down Expand Up @@ -200,13 +231,20 @@ declare class Tweaker extends Sizer {
config?: Tweaker.IConfig
);

registerInputHandler(
config: Tweaker.IInputHandlerConfig
): this;

removeInputHandler(
name: string
): this;

addInput(
object: Object,
key: string,
config?: Tweaker.IAddInputConfig
): this;


addInput(
config?: Tweaker.IAddInputConfig
): this;
Expand Down

0 comments on commit c05b302

Please sign in to comment.