using UnityEngine; namespace Simulator.Data { public class ComponentUIBinder { private ProgressPopupView _progressPopupView; private SourceProperty _sourceProperty; private SinkProperty _sinkProperty; private RackProperty _rackProperty; private QueueProperty _queueProperty; private ASRSProperty _asrsProperty; private RobotArmProperty _robotArmProperty; private ProcessorProperty _processorProperty; private ConveyorProperty _conveyorProperty; private NodeProperty _nodeProperty; public void Initialize() { _progressPopupView = Object.FindAnyObjectByType(FindObjectsInactive.Include); _sourceProperty = Object.FindAnyObjectByType(); _sinkProperty = Object.FindAnyObjectByType(); _rackProperty = Object.FindAnyObjectByType(); _queueProperty = Object.FindAnyObjectByType(); _asrsProperty = Object.FindAnyObjectByType(); _robotArmProperty = Object.FindAnyObjectByType(); _processorProperty = Object.FindAnyObjectByType(); _conveyorProperty = Object.FindAnyObjectByType(); _nodeProperty = Object.FindAnyObjectByType(); } public void BindStandardComponent(ComponentBase component) { switch (component.componentType) { case ComponentType.Source: if (_sourceProperty != null) component.onComponentClicked += _sourceProperty.SetPropertyWindow; if (_progressPopupView != null) component.onComponentClicked += _progressPopupView.Show; break; case ComponentType.Sink: if (_sinkProperty != null) component.onComponentClicked += _sinkProperty.SetPropertyWindow; if (_progressPopupView != null) component.onComponentClicked += _progressPopupView.Show; break; case ComponentType.Processor: if (_processorProperty != null) component.onComponentClicked += _processorProperty.SetPropertyWindow; if (_progressPopupView != null) component.onComponentClicked += _progressPopupView.Show; break; case ComponentType.Rack: if (_rackProperty != null) component.onComponentClicked += _rackProperty.SetPropertyWindow; break; case ComponentType.Queue: if (_queueProperty != null) component.onComponentClicked += _queueProperty.SetPropertyWindow; break; case ComponentType.ASRS: if (_asrsProperty != null) component.onComponentClicked += _asrsProperty.SetPropertyWindow; break; case ComponentType.RobotArm: if (_robotArmProperty != null) component.onComponentClicked += _robotArmProperty.SetPropertyWindow; break; case ComponentType.Worker: break; } } public void BindConveyor(ConveyorComponent conveyor) { if (_conveyorProperty != null) conveyor.onConveyorClicked += _conveyorProperty.SetPropertyWindow; } public void BindNode(NodeComponent node) { if (_nodeProperty != null) node.onConveyorClicked += _nodeProperty.SetPropertyWindow; } } }