public TriggerConditionFlight(VesselTriggers vesselTriggers) : base(vesselTriggers)
 {
     _type            = TriggerConditionType.Flight;
     _propertyIndex   = -1;
     _fieldInfo       = null;
     _propertyInfo    = null;
     _methodInfo      = null;
     _propertySource  = null;
     _methodParameter = null;
     _comparator      = ComparatorType.Equals;
     _targetValue     = null;
 }
Exemple #2
0
        public TypedDataArray(ParameterInfo[] paramInfo, object[] defaultValue)
        {
            _data         = new TypedData[paramInfo.Length];
            _configurable = false;
            int nbDefault = (defaultValue != null) ? defaultValue.Length : 0;

            for (int i = 0; i < paramInfo.Length; i++)
            {
                _data[i]      = new TypedData(paramInfo[i].Name, paramInfo[i].ParameterType, (i < nbDefault) ? defaultValue[i] : null);
                _configurable = _configurable || _data[i].Configurable;
            }
        }
Exemple #3
0
        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;
            }
        }
Exemple #4
0
        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;
            }
        }
Exemple #5
0
        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;
            }
        }
Exemple #6
0
 public TypedDataArray(string name, Type type)
 {
     _data         = new TypedData[1];
     _data[0]      = new TypedData(name, type);
     _configurable = true;
 }