Example #1
0
        public override void OnToolGUI(Event e)
        {
            base.OnToolGUI(e);

            if (SelectedSegmentId != 0)
            {
                cursorInSecondaryPanel = false;

                Color oldColor = GUI.color;
                GUI.color = GUI.color.WithAlpha(TrafficManagerTool.GetWindowAlpha());

                windowRect = GUILayout.Window(
                    255,
                    windowRect,
                    _guiVehicleRestrictionsWindowDelegate,
                    T("Dialog.Title:Vehicle restrictions"),
                    WindowStyle,
                    EmptyOptionsArray);
                cursorInSecondaryPanel = windowRect.Contains(Event.current.mousePosition);
                GUI.color = oldColor;
                // overlayHandleHovered = false;
            }

            // ShowSigns(false);
        }
Example #2
0
        private void GuiVehicleRestrictionsWindow(int num)
        {
            // use blue color when shift is pressed.
            Color oldColor = GUI.color;

            GUI.color = GUI.color.WithAlpha(TrafficManagerTool.GetWindowAlpha());
            if (RoadMode)
            {
                GUI.color = HighlightColor;
            }

            // uses pressed sprite when delete is pressed
            // uses blue color when shift is pressed.
            KeyCode  hotkey = KeyCode.Delete;
            GUIStyle style  = new GUIStyle("button");

            if (Input.GetKey(hotkey))
            {
                style.normal.background = style.active.background;
            }
            if (GUILayout.Button(
                    T("Button:Allow all vehicles") + " [delete]",
                    style,
                    EmptyOptionsArray) || Input.GetKeyDown(hotkey))
            {
                AllVehiclesFunc(true);
                if (RoadMode)
                {
                    ApplyRestrictionsToAllSegments();
                }
            }

            if (GUILayout.Button(T("Button:Ban all vehicles"), EmptyOptionsArray))
            {
                AllVehiclesFunc(false);
                if (RoadMode)
                {
                    ApplyRestrictionsToAllSegments();
                }
            }

            if (RoadMode)
            {
                GUI.color = oldColor;
            }

            if (GUILayout.Button(
                    T("Button:Apply to entire road"),
                    EmptyOptionsArray))
            {
                ApplyRestrictionsToAllSegments();
            }

            GUI.color = oldColor;
            DragWindow(ref windowRect);
        }