1- import * as THREE from "three" ;
1+ import {
2+ ControlsSchema ,
3+ ControlEntry ,
4+ BooleanSettingsControl ,
5+ ColorSettingsControl ,
6+ TextSettingsControl ,
7+ NumberSettingControl ,
8+ SelectSettingControl ,
9+ Vector3SettingControl ,
10+ TextSetSettingControl ,
11+ NoControl ,
12+ } from "../../Types" ;
13+ import { Components } from "../../Components" ;
14+ import { ConfigManager } from "../index" ;
215
3- export interface BooleanSettingsControl {
4- type : "Boolean" ;
5- value : boolean ;
6- }
7-
8- export interface ColorSettingsControl {
9- type : "Color" ;
10- opacity : number ;
11- value : THREE . Color ;
12- }
13-
14- export interface TextSettingsControl {
15- type : "Text" ;
16- value : string ;
17- }
18-
19- export interface NumberSettingControl {
20- type : "Number" ;
21- interpolable : boolean ;
22- min ?: number ;
23- max ?: number ;
24- value : number ;
25- }
26-
27- export interface SelectSettingControl {
28- type : "Select" ;
29- multiple : boolean ;
30- options : Set < string > ;
31- value : string ;
32- }
33-
34- export interface Vector3SettingControl {
35- type : "Vector3" ;
36- value : THREE . Vector3 ;
37- }
38-
39- export interface TextSetSettingControl {
40- type : "TextSet" ;
41- value : Set < string > ;
42- }
43-
44- export interface NoControl {
45- type : "None" ;
46- value : any ;
47- }
48-
49- type ControlEntry =
50- | BooleanSettingsControl
51- | ColorSettingsControl
52- | TextSettingsControl
53- | NumberSettingControl
54- | SelectSettingControl
55- | Vector3SettingControl
56- | TextSetSettingControl
57- | NoControl ;
58-
59- interface ControlsSchema {
60- [ name : string ] : ControlEntry | ControlsSchema ;
61- }
62-
63- export abstract class ConfigManager < T , U extends ControlsSchema > {
16+ export abstract class Configurator < T , U extends ControlsSchema > {
6417 protected abstract _config : U ;
6518
6619 protected _component : T ;
6720
21+ name : string ;
22+
6823 get controls ( ) : U {
6924 const copy : any = { } ;
7025 for ( const name in this . _config ) {
@@ -74,8 +29,11 @@ export abstract class ConfigManager<T, U extends ControlsSchema> {
7429 return copy as U ;
7530 }
7631
77- constructor ( component : T ) {
32+ constructor ( component : T , components : Components , name : string ) {
7833 this . _component = component ;
34+ this . name = name ;
35+ const configManager = components . get ( ConfigManager ) ;
36+ configManager . list . add ( this ) ;
7937 }
8038
8139 copyEntry ( controlEntry : ControlEntry ) : ControlEntry {
0 commit comments