Ejemplo n.º 1
0
        private void DisplayRightPanel()
        {
            // Right panel: condition config
            GUILayout.BeginArea(_mainRect, GUI.skin.GetStyle("Box"));
            GUILayout.BeginVertical();
            int newIndexConditionType = GUILayout.Toolbar(_conditionIndexType, Enum.GetNames(typeof(TriggerConditionType)));

            if (newIndexConditionType != _conditionIndexType)
            {
                _partSelector.CancelSelect();
                _conditionIndexType = newIndexConditionType;
            }
            if (Event.current.type == EventType.Repaint)
            {
                RectOffset rctOff   = GUI.skin.button.margin;
                Rect       lastRect = GUILayoutUtility.GetLastRect();
                float      nextY    = lastRect.y + lastRect.height + rctOff.bottom;
                // position of area computed using Toolbar position
                _boxLeftPos = new Rect(rctOff.left,
                                       nextY + rctOff.top,
                                       _mainRect.width / 2 - rctOff.horizontal,
                                       _mainRect.height - (2 * nextY + rctOff.vertical));
                _boxRightPos = new Rect(_mainRect.width / 2 + rctOff.left,
                                        nextY + rctOff.top,
                                        _mainRect.width / 2 - rctOff.horizontal,
                                        _mainRect.height - (2 * nextY + rctOff.vertical));
            }
            switch ((TriggerConditionType)_conditionIndexType)
            {
            case TriggerConditionType.Part:
                DisplayPartConf();
                break;

            case TriggerConditionType.Flight:
                DisplayFlightConf();
                break;

            case TriggerConditionType.Timer:
                DisplayTimerConf();
                break;
            }
            GUILayout.FlexibleSpace();
            // APPLY / REMOVE
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Apply") && (_currentCondition != null))
            {
                if (_currentCondition.IsValid())
                {
                    _currentCondition.Acquit();
                    _currentCondition.UpdatePersistentData();
                    _conditions[_conditionIndex] = _currentCondition;
                }
            }
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Remove") && (_conditionIndex >= 0))
            {
                _conditions.RemoveAt(_conditionIndex);
                SelectCondition(-1);
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
            GUILayout.EndArea();
        }
Ejemplo n.º 2
0
 public void UpdatePersistentData()
 {
     _condition.UpdatePersistentData();
 }