From fd32c44b8d012e3a123761b7654bedcdf18fecfb Mon Sep 17 00:00:00 2001 From: Mikita Date: Thu, 13 Jun 2024 11:07:54 +0300 Subject: [PATCH] add menu dummy json --- wrapper/Menu/DummyJson.ts | 24 ++++++++++++++++++++++++ wrapper/Menu/Node.ts | 8 ++++++++ 2 files changed, 32 insertions(+) create mode 100644 wrapper/Menu/DummyJson.ts diff --git a/wrapper/Menu/DummyJson.ts b/wrapper/Menu/DummyJson.ts new file mode 100644 index 0000000000..573628a5d4 --- /dev/null +++ b/wrapper/Menu/DummyJson.ts @@ -0,0 +1,24 @@ +import { Base, IMenu } from "./Base" + +export class DummyJson 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 + } +} diff --git a/wrapper/Menu/Node.ts b/wrapper/Menu/Node.ts index ac60eda000..e525638233 100644 --- a/wrapper/Menu/Node.ts +++ b/wrapper/Menu/Node.ts @@ -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" @@ -627,6 +628,13 @@ export class Node extends Base { return this.AddEntry(new ColorPicker(this, name, defaultColor, tooltip), priority) } + public AddDummyJson( + name: string, + defaultValue: T + ): DummyJson { + return this.AddEntry(new DummyJson(this, name, defaultValue), 0) + } + public AddParticlePicker( name: string, color: Color | number = new Color(0, 255, 0),