private void CreateInspector(BaseNode.NodeType type) { InspectorView inspectorView = Object.Instantiate(InspectorViewPrefab); inspectorView.GetComponent <RectTransform>().SetParent(GetComponent <RectTransform>(), worldPositionStays: false); inspector = InspectorControllerFactory.MakeController(inspectorView, GridController, type); inspector.Closed += InspectorClosed; }
public static IInspectorController MakeController(InspectorView view, IHexGridController grid, BaseNode.NodeType type) { IInspectorController result = null; switch (type) { case BaseNode.NodeType.Group: result = new GroupInspectorController(view, grid); break; case BaseNode.NodeType.Invokable: result = new InvokableInspectorController(view, grid); break; case BaseNode.NodeType.Tweakable: result = new TweakableInspectorController(view, grid); break; default: LogManager.GetCurrentClassLogger().Error("Cannot inspect node of type {0}", type); result = null; break; case BaseNode.NodeType.Watchable: break; } return(result); }