private void DisplayFlightConf() { if (_conditionFlight == null) { _conditionFlight = new TriggerConditionFlight(_vesselTriggers); } _currentCondition = _conditionFlight; // Left column GUILayout.BeginArea(_boxLeftPos); _scrollVectVessel = GUILayout.BeginScrollView(_scrollVectVessel, GUIStyle.none, GUIStyle.none); GUILayout.BeginVertical(); // Property GUILayout.BeginHorizontal(); GUILayout.Space(LEFT_MARGING); GUILayout.Label("Property to evaluate: "); GUILayout.EndHorizontal(); // Parameters if (_conditionFlight.Parameters != null) { for (int i = 0; i < _conditionFlight.Parameters.Length; i++) { TypedData param = _conditionFlight.Parameters[i]; if ((param != null) && param.Configurable) { GUILayout.BeginHorizontal(); GUILayout.Space(LEFT_MARGING); GUILayout.Label(param.Name); GUILayout.EndHorizontal(); } } } if (_conditionFlight.TargetValue != null) { // Comparator GUILayout.BeginHorizontal(); GUILayout.Space(LEFT_MARGING); GUILayout.Label("Comparator: "); GUILayout.EndHorizontal(); // Target GUILayout.BeginHorizontal(); GUILayout.Space(LEFT_MARGING); GUILayout.Label("Target value: "); GUILayout.EndHorizontal(); } GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.EndArea(); // Right column GUILayout.BeginArea(_boxRightPos); _scrollVectVessel = GUILayout.BeginScrollView(_scrollVectVessel); GUILayout.BeginVertical(); // Property GUILayout.BeginHorizontal(); int newPropertyIndex = _popupUI.GUILayoutPopup("popupFlightParam", TriggerConditionFlight.PropertyList, _conditionFlight.PropertyIndex); GUILayout.Space(RIGHT_MARGING); GUILayout.EndHorizontal(); // Parameters if (_conditionFlight.Parameters != null) { for (int i = 0; i < _conditionFlight.Parameters.Length; i++) { TypedData param = _conditionFlight.Parameters[i]; if ((param != null) && param.Configurable) { GUILayout.BeginHorizontal(); param.DisplayLayout(_popupUI); GUILayout.Space(RIGHT_MARGING); GUILayout.EndHorizontal(); } } } if (_conditionFlight.TargetValue != null) { TypedData target = _conditionFlight.TargetValue; // Comparator GUILayout.BeginHorizontal(); _conditionFlight.Comparator = (ComparatorType)_popupUI.GUILayoutPopup("popupFlightOper", target.ComparatorList, (int)_conditionFlight.Comparator); GUILayout.Space(RIGHT_MARGING); GUILayout.EndHorizontal(); // Target GUILayout.BeginHorizontal(); target.DisplayLayout(_popupUI); GUILayout.Space(RIGHT_MARGING); GUILayout.EndHorizontal(); } GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.EndArea(); if (Event.current.type == EventType.Repaint) { _conditionFlight.PropertyIndex = newPropertyIndex; } }
private void DisplayFlightConf() { if (_actionFlight == null) { _actionFlight = new TriggerActionFlight(_vesselTriggers); } _currentAction = _actionFlight; // Left column GUILayout.BeginArea(_boxLeftPos); _scrollVectVessel = GUILayout.BeginScrollView(_scrollVectVessel, GUIStyle.none, GUIStyle.none); GUILayout.BeginVertical(); // Action GUILayout.BeginHorizontal(); GUILayout.Space(LEFT_MARGING); GUILayout.Label("Action: "); GUILayout.EndHorizontal(); // Parameters if (_actionFlight.Parameters != null) { for (int i = 0; i < _actionFlight.Parameters.Length; i++) { TypedData param = _actionFlight.Parameters[i]; if ((param != null) && param.Configurable) { GUILayout.BeginHorizontal(); GUILayout.Space(LEFT_MARGING); GUILayout.Label(param.Name); GUILayout.EndHorizontal(); } } } GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.EndArea(); // Right column GUILayout.BeginArea(_boxRightPos); _scrollVectVessel = GUILayout.BeginScrollView(_scrollVectVessel); GUILayout.BeginVertical(); // Action GUILayout.BeginHorizontal(); int newActionIndex = _popupUI.GUILayoutPopup("popupFlightMetho", TriggerActionFlight.ActionList, _actionFlight.ActionIndex); GUILayout.Space(RIGHT_MARGING); GUILayout.EndHorizontal(); // Parameters if (_actionFlight.Parameters != null) { for (int i = 0; i < _actionFlight.Parameters.Length; i++) { TypedData param = _actionFlight.Parameters[i]; if ((param != null) && param.Configurable) { GUILayout.BeginHorizontal(); param.DisplayLayout(_popupUI); GUILayout.Space(RIGHT_MARGING); GUILayout.EndHorizontal(); } } } GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.EndArea(); if (Event.current.type == EventType.Repaint) { _actionFlight.ActionIndex = newActionIndex; } }
private void DisplayPartConf() { if (_eventPart == null) { _eventPart = new TriggerEvent(TriggerEventType.Part, _vesselTriggers); } _currentEvent = _eventPart; // Left column GUILayout.BeginArea(_boxLeftPos); _scrollVectPart = GUILayout.BeginScrollView(_scrollVectPart, GUIStyle.none, GUIStyle.none); GUILayout.BeginVertical(); // Part GUILayout.BeginHorizontal(); GUILayout.Space(LEFT_MARGING); GUILayout.Label("Part triggering the event: "); GUILayout.EndHorizontal(); // Property GUILayout.BeginHorizontal(); GUILayout.Space(LEFT_MARGING); GUILayout.Label("Property to trigger: "); GUILayout.EndHorizontal(); // Parameters if (((TriggerConditionPart)_eventPart.Condition).Parameters != null) { for (int i = 0; i < ((TriggerConditionPart)_eventPart.Condition).Parameters.Length; i++) { TypedData param = ((TriggerConditionPart)_eventPart.Condition).Parameters[i]; if ((param != null) && param.Configurable) { GUILayout.BeginHorizontal(); GUILayout.Space(LEFT_MARGING); GUILayout.Label(param.Name); GUILayout.EndHorizontal(); } } } if (((TriggerConditionPart)_eventPart.Condition).TargetValue != null) { // Comparator GUILayout.BeginHorizontal(); GUILayout.Space(LEFT_MARGING); GUILayout.Label("Comparator: "); GUILayout.EndHorizontal(); // Target GUILayout.BeginHorizontal(); GUILayout.Space(LEFT_MARGING); GUILayout.Label("Target value: "); GUILayout.EndHorizontal(); } GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.EndArea(); // Right column GUILayout.BeginArea(_boxRightPos); _scrollVectPart = GUILayout.BeginScrollView(_scrollVectPart); GUILayout.BeginVertical(); // Part GUILayout.BeginHorizontal(); _partSelector.DisplayLayout(((TriggerConditionPart)_eventPart.Condition).ConditionPart); GUILayout.Space(RIGHT_MARGING); GUILayout.EndHorizontal(); // Property GUILayout.BeginHorizontal(); int newPropertyIndex = _popupUI.GUILayoutPopup("popupPartParam", ((TriggerConditionPart)_eventPart.Condition).PropertyList, ((TriggerConditionPart)_eventPart.Condition).PropertyIndex); GUILayout.Space(RIGHT_MARGING); GUILayout.EndHorizontal(); // Parameters if (((TriggerConditionPart)_eventPart.Condition).Parameters != null) { for (int i = 0; i < ((TriggerConditionPart)_eventPart.Condition).Parameters.Length; i++) { TypedData param = ((TriggerConditionPart)_eventPart.Condition).Parameters[i]; if ((param != null) && param.Configurable) { GUILayout.BeginHorizontal(); param.DisplayLayout(_popupUI); GUILayout.Space(RIGHT_MARGING); GUILayout.EndHorizontal(); } } } if (((TriggerConditionPart)_eventPart.Condition).TargetValue != null) { TypedData target = ((TriggerConditionPart)_eventPart.Condition).TargetValue; // Comparator GUILayout.BeginHorizontal(); ((TriggerConditionPart)_eventPart.Condition).Comparator = (ComparatorType)_popupUI.GUILayoutPopup("popupPartOper", target.ComparatorList, (int)((TriggerConditionPart)_eventPart.Condition).Comparator); GUILayout.Space(RIGHT_MARGING); GUILayout.EndHorizontal(); // Target GUILayout.BeginHorizontal(); target.DisplayLayout(_popupUI); GUILayout.Space(RIGHT_MARGING); GUILayout.EndHorizontal(); } GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.EndArea(); if (Event.current.type == EventType.Repaint) { ((TriggerConditionPart)_eventPart.Condition).PropertyIndex = newPropertyIndex; } }