Ejemplo n.º 1
0
        private void DisplayFlightConf()
        {
            if (_eventFlight == null)
            {
                _eventFlight = new TriggerEvent(TriggerEventType.Flight, _vesselTriggers);
            }
            _currentEvent = _eventFlight;
            // 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 trigger: ");
            GUILayout.EndHorizontal();
            // Parameters
            if (((TriggerConditionFlight)_eventFlight.Condition).Parameters != null)
            {
                for (int i = 0; i < ((TriggerConditionFlight)_eventFlight.Condition).Parameters.Length; i++)
                {
                    TypedData param = ((TriggerConditionFlight)_eventFlight.Condition).Parameters[i];
                    if ((param != null) && param.Configurable)
                    {
                        GUILayout.BeginHorizontal();
                        GUILayout.Space(LEFT_MARGING);
                        GUILayout.Label(param.Name);
                        GUILayout.EndHorizontal();
                    }
                }
            }
            if (((TriggerConditionFlight)_eventFlight.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);
            _scrollVectVessel = GUILayout.BeginScrollView(_scrollVectVessel);
            GUILayout.BeginVertical();
            // Property
            GUILayout.BeginHorizontal();
            int newPropertyIndex = _popupUI.GUILayoutPopup("popupFlightParam", TriggerConditionFlight.PropertyList, ((TriggerConditionFlight)_eventFlight.Condition).PropertyIndex);

            GUILayout.Space(RIGHT_MARGING);
            GUILayout.EndHorizontal();
            // Parameters
            if (((TriggerConditionFlight)_eventFlight.Condition).Parameters != null)
            {
                for (int i = 0; i < ((TriggerConditionFlight)_eventFlight.Condition).Parameters.Length; i++)
                {
                    TypedData param = ((TriggerConditionFlight)_eventFlight.Condition).Parameters[i];
                    if ((param != null) && param.Configurable)
                    {
                        GUILayout.BeginHorizontal();
                        param.DisplayLayout(_popupUI);
                        GUILayout.Space(RIGHT_MARGING);
                        GUILayout.EndHorizontal();
                    }
                }
            }
            if (((TriggerConditionFlight)_eventFlight.Condition).TargetValue != null)
            {
                TypedData target = ((TriggerConditionFlight)_eventFlight.Condition).TargetValue;
                // Comparator
                GUILayout.BeginHorizontal();
                ((TriggerConditionFlight)_eventFlight.Condition).Comparator = (ComparatorType)_popupUI.GUILayoutPopup("popupFlightOper", target.ComparatorList, (int)((TriggerConditionFlight)_eventFlight.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)
            {
                ((TriggerConditionFlight)_eventFlight.Condition).PropertyIndex = newPropertyIndex;
            }
        }