Skip to content

Commit

Permalink
add menu dummy json
Browse files Browse the repository at this point in the history
  • Loading branch information
Bulb4 committed Jun 13, 2024
1 parent 8988af6 commit fd32c44
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
24 changes: 24 additions & 0 deletions wrapper/Menu/DummyJson.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Base, IMenu } from "./Base"

export class DummyJson<T> extends Base {
public value: T

constructor(
parent: IMenu,
name: string,
public readonly defaultValue: T
) {
super(parent, name, "")
this.value = defaultValue
}

public get ConfigValue() {
return this.value
}
public set ConfigValue(value) {
if (this.ShouldIgnoreNewConfigValue) {
return
}
this.value = value
}
}
8 changes: 8 additions & 0 deletions wrapper/Menu/Node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Base, IMenu } from "./Base"
import { Button } from "./Button"
import { ColorPicker } from "./ColorPicker"
import { Dropdown } from "./Dropdown"
import { DummyJson } from "./DummyJson"
import { DynamicImageSelector } from "./DynamicImageSelector"
import { ImageSelector } from "./ImageSelector"
import { IMenuParticlePicker } from "./ITypes"
Expand Down Expand Up @@ -627,6 +628,13 @@ export class Node extends Base {
return this.AddEntry(new ColorPicker(this, name, defaultColor, tooltip), priority)
}

public AddDummyJson<T>(
name: string,
defaultValue: T
): DummyJson<T> {
return this.AddEntry(new DummyJson(this, name, defaultValue), 0)
}

public AddParticlePicker(
name: string,
color: Color | number = new Color(0, 255, 0),
Expand Down

0 comments on commit fd32c44

Please sign in to comment.