Ejemplo n.º 1
0
        public void DoWindow(int windowID)
        {
            if (Event.current.isMouse && (Event.current.button == 0) && (Event.current.type == EventType.MouseUp))
            {
                _popupUI.CloseAll();
            }

            GUILayout.BeginVertical();
            // fake label to get position
            GUILayout.Label(" ");
            if (Event.current.type == EventType.Repaint)
            {
                RectOffset rctOff   = GUI.skin.button.margin;
                Rect       lastRect = GUILayoutUtility.GetLastRect();
                _listRect.y      = lastRect.y;
                _mainRect.y      = lastRect.y;
                _listRect.height = _windowSize.y - 3 * lastRect.y - 3 * rctOff.vertical;
                _mainRect.height = _windowSize.y - 3 * lastRect.y - 3 * rctOff.vertical;
            }

            DisplayLeftPanel();

            if (_conditionIndex >= 0)
            {
                DisplayRightPanel();
            }

            GUILayout.FlexibleSpace();
            // Condition combination
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            _conditions.Combination = (ConditionCombination)_popupUI.GUILayoutPopup("CondCombination", Enum.GetNames(typeof(ConditionCombination)), (int)_conditions.Combination);
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            // OK / CANCEL
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("OK")) // TODO
            {
                _triggerToConfigure.TriggerConditions = _conditions;
                Close();
            }
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Cancel"))
            {
                Close();
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
            GUI.DragWindow(new Rect(0, 0, 10000, 10000));

            // Tooltip
            if ((GUI.tooltip != "") && (Event.current.type == EventType.Repaint))
            {
                GUIContent content = new GUIContent(GUI.tooltip);
                GUI.Label(new Rect(Event.current.mousePosition, GUI.skin.box.CalcSize(content)), content);
            }
        }
Ejemplo n.º 2
0
        public void DoWindow(int windowID)
        {
            if (Event.current.isMouse && (Event.current.button == 0) && (Event.current.type == EventType.MouseUp))
            {
                _popupUI.CloseAll();
            }
            GUILayout.BeginVertical();
            int newIndexEvent = GUILayout.Toolbar(_eventIndexType, Enum.GetNames(typeof(TriggerEventType)));

            if (newIndexEvent != _eventIndexType)
            {
                _partSelector.CancelSelect();
                _eventIndexType = newIndexEvent;
            }
            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,
                                       _windowSize.x / 2 - rctOff.horizontal,
                                       _windowSize.y - (2 * nextY + rctOff.vertical));
                _boxRightPos = new Rect(_windowSize.x / 2 + rctOff.left,
                                        nextY + rctOff.top,
                                        _windowSize.x / 2 - rctOff.horizontal,
                                        _windowSize.y - (2 * nextY + rctOff.vertical));
            }
            switch ((TriggerEventType)_eventIndexType)
            {
            case TriggerEventType.Part:
                DisplayPartConf();
                break;

            case TriggerEventType.Flight:
                DisplayFlightConf();
                break;

            case TriggerEventType.Timer:
                DisplayTimerConf();
                break;
            }
            GUILayout.FlexibleSpace();
            // OK / CANCEL
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("OK") && (_currentEvent != null))
            {
                if (_currentEvent.IsValid())
                {
                    _currentEvent.UpdatePersistentData();
                    _triggerToConfigure.TriggerEvent = _currentEvent;
                    Close();
                }
            }
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Cancel"))
            {
                Close();
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
            GUI.DragWindow(new Rect(0, 0, 10000, 10000));

            // Tooltip
            if ((GUI.tooltip != "") && (Event.current.type == EventType.Repaint))
            {
                GUIContent content = new GUIContent(GUI.tooltip);
                GUI.Label(new Rect(Event.current.mousePosition, GUI.skin.box.CalcSize(content)), content);
            }
        }