Initial commit
This commit is contained in:
18
C#/TSEngine/Core/Components/componentManager.ts
Normal file
18
C#/TSEngine/Core/Components/componentManager.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace TSE {
|
||||
|
||||
export class ComponentManager {
|
||||
|
||||
private static _registeredBuilders: {[type: string]: IComponentBuilder} = {};
|
||||
|
||||
public static registerBuilder(builder: IComponentBuilder): void {
|
||||
ComponentManager._registeredBuilders[builder.type] = builder;
|
||||
}
|
||||
|
||||
public static extractComponent(json: any): BaseComponent {
|
||||
if (ComponentManager._registeredBuilders[json?.type] === undefined) return undefined;
|
||||
return ComponentManager._registeredBuilders[json.type].buildFromJson(json);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user