Exemple #1
0
 /// <summary>
 /// Styled window
 /// </summary>
 /// <param name="id">Identifier.</param>
 /// <param name="screenRect">Screen rect.</param>
 /// <param name="func">Func.</param>
 /// <param name="title">Title.</param>
 /// <param name="options">Options.</param>
 public static Rect Window(int id, Rect screenRect, GUI.WindowFunction func, string title, params GUILayoutOption[] options)
 {
     // Fix rect width and height not being integers to avoid blurry font rendering
     screenRect.width  = (float)Math.Floor(screenRect.width);
     screenRect.height = (float)Math.Floor(screenRect.height);
     return(ClickThruBlocker.GUILayoutWindow(id, screenRect, func, title, Styles.window, options));
 }
 internal LayoutedWindow(GUI.WindowFunction f, Rect screenRect, GUIContent content, GUILayoutOption[] options, GUIStyle style)
 {
     m_Func       = f;
     m_ScreenRect = screenRect;
     m_Options    = options;
     m_Style      = style;
 }
Exemple #3
0
 public Window(string name, int window_id, Rect rect, GUI.WindowFunction function)
 {
     this.name      = name;
     this.rect      = rect;
     this.window_id = window_id;
     this.function  = function;
 }
 private void _ToListen(Regulus.Remoting.Soul.Native.Server server)
 {
     var stage = new HostListenStage(server);
     stage.DoneEvent += _ToSetting;
     _DrawWindow = stage.DrawWindow;
     _Machine.Push(stage);
 }
 private void _ToSetting()
 {
     var stage = new HostSettingStage();
     stage.DoneEvent += _ToListen;
     _DrawWindow = stage.DrawWindow;
     _Machine.Push(stage);
 }
Exemple #6
0
 public void ActivateDisplay(int id, Rect rect, GUI.WindowFunction window, GUIStyle style)
 {
     windowID       = id;
     displayRect    = rect;
     windowFunction = window;
     listStyle      = style;
 }
Exemple #7
0
 public void SetGUIPositions(GUI.WindowFunction OnWindow)
 {
     if (showMain)
     {
         MainGUIPos = GUILayout.Window(7349, MainGUIPos, DrawMainGUI, "Flight School");
     }
 }
        public static Rect GUIWindow(int id, Rect clientRect, GUI.WindowFunction func, GUIContent content)
        {
            r = GUI.Window(id, clientRect, func, content);

            return UpdateList(id, r, id.ToString());

        }
        /// <summary>
        /// Creates a new 'Sub Window' that acts like a window within this editor.
        /// Useful for quick-n-dirty solutions to things like movable controls,
        /// popup windows, dropdown lists, etc...
        /// </summary>
        /// <param name="position">The editor-relative position of the window.</param>
        /// <param name="updateHandler">A user-supplied method that is called each frame
        /// that the SubWindow is active.</param>
        /// <returns></returns>
        public SubWindow ShowSubwindow(int id, Rect position, GUI.WindowFunction updateHandler, SubWindow.WindowType type, GUIStyle style = null)
        {
            if (SubWindows.ContainsKey(id))
            {
                return(SubWindows[id]);
            }
            SubWindow sub = new SubWindow();

            sub.Position = GUI.Window(id, position, updateHandler, "", style);
            if (style != null)
            {
                sub.Style = style;
            }
            else
            {
                sub.Style = Skin.window;
            }
            sub.WindowId     = id;
            sub.HandleUpdate = updateHandler;
            sub.Type         = type;
            SubWindows[id]   = sub;

            //make sure to refocus controls so that
            //any delayed text boxes resets to current text
            GUI.FocusControl("");
            GUI.FocusWindow(id);

            return(sub);
        }
        public static Rect GUIWindow(int id, Rect clientRect, GUI.WindowFunction func, Texture image)
        {
            r = GUI.Window(id, clientRect, func, image);

            return UpdateList(id, r, id.ToString());

        }
        // Make an auto-sized draggable window...
        static Rect DoWindow(int id, Rect screenRect, GUI.WindowFunction func, GUIContent content, GUIStyle style, GUILayoutOption[] options)
        {
            GUIUtility.CheckOnGUI();
            LayoutedWindow lw = new LayoutedWindow(func, screenRect, content, options, style);

            return(GUI.Window(id, screenRect, lw.DoWindow, content, style));
        }
			internal LayoutedWindow(GUI.WindowFunction f, Rect _screenRect, GUIContent _content, GUILayoutOption[] _options, GUIStyle _style)
			{
				this.func = f;
				this.screenRect = _screenRect;
				this.options = _options;
				this.style = _style;
			}
        public VehicleRestrictionsTool(TrafficManagerTool mainTool)
            : base(mainTool)
        {
            _guiVehicleRestrictionsWindowDelegate = GuiVehicleRestrictionsWindow;

            currentRestrictedSegmentIds = new HashSet <ushort>();
        }
Exemple #14
0
 //
 void Awake()
 {
     if (_permanent)
     {
         DontDestroyOnLoad(gameObject);
     }
     if (Debug.isDebugBuild && _instance == null)
     {
         _instance = this;
         float w  = Screen.width / 15.0f;
         float h  = Screen.height / 15.0f;
         float sz = Mathf.Max(w, h);
         stateNext         = state_button;
         _buttonRect       = new Rect(0, 0, sz, sz);
         _touched          = 0.0f;
         _menuRect         = new Rect(0, 0, Screen.width, Screen.height * 0.9f);
         _delegatefunction = DefaultDelegate;
         windowTitle       = "DEBUG MENU";
         _ipaddr           = PlayerPrefs.GetString("LuaDebugMenu.ServerAddressString", "192.168.0.1");
         check_connection();
         default_tabs();
         StartCoroutine(proc_server());
     }
     else
     {
         Destroy(gameObject);
     }
 }
        void OnSceneGUI()
        {
            ShadowTextureRenderer shadowRenderer = target as ShadowTextureRenderer;

            if (shadowRenderer.shadowTexture == null || shadowRenderer.GetComponent <Projector>().material == null)
            {
                return;
            }

            if (m_lastPosition != shadowRenderer.transform.position || m_lastRotation != shadowRenderer.transform.rotation)
            {
                // This function call will have the following error on Unity 5.6.0:
                // Rendering camera 'XXXX', but calling code does not set it up as current camera (current camera: 'Main Camera') UnityEngine.Camera:Render()
                // But it seems like there are no way to avoid this error message.
                shadowRenderer.ForceRenderTexture();
                m_lastPosition = shadowRenderer.transform.position;
                m_lastRotation = shadowRenderer.transform.rotation;
            }

            if (m_blitMaterial == null)
            {
                m_blitMaterial = FindMaterial("DynamicShadowProjector/Blit/Blit");
            }
            int mipLevel = shadowRenderer.mipLevel + 1;
            int w        = shadowRenderer.textureWidth;
            int h        = shadowRenderer.textureHeight;

            for (int i = 1; i < mipLevel; ++i)
            {
                if ((w >> i) <= 4 || (h >> i) <= 4)
                {
                    mipLevel = i;
                    break;
                }
            }
            int   displayWidth  = 128;
            float mipBias       = Mathf.Log(displayWidth / w) / Mathf.Log(2.0f);
            int   displayHeight = h * displayWidth / w;
            int   marginSize    = 4;
            int   windowWidth   = mipLevel * (displayWidth + marginSize) + marginSize;
            int   windowHeight  = displayHeight + 2 * GUI.skin.window.border.bottom + marginSize;
            int   windowPosX    = Screen.width - windowWidth - 10;
            int   windowPosY    = Screen.height - windowHeight - GUI.skin.window.border.top - 10;

            GUI.WindowFunction func = id => {
                if (Event.current.type.Equals(EventType.Repaint))
                {
                    int x = marginSize;
                    int y = GUI.skin.window.border.top;
                    for (int i = 0; i < mipLevel; ++i)
                    {
                        m_blitMaterial.SetFloat("_MipLevel", i);
                        m_blitMaterial.SetFloat("_MipBias", mipBias + i);
                        Graphics.DrawTexture(new Rect(x, y, displayWidth, displayHeight), shadowRenderer.shadowTexture, m_blitMaterial);
                        x += displayWidth + marginSize;
                    }
                }
            };
            GUI.Window(0, new Rect(windowPosX, windowPosY, windowWidth, windowHeight), func, "Shadow Texture");
        }
        private void ShowInfluenceInfo(Vector3 layoutPosition)
        {
            var influence = _layout.GetInfluence(Convert(layoutPosition));

            GUI.WindowFunction windowFunc = id =>
            {
                GUILayout.Label("Absolute");
                var labelText = String.Join("\n",
                                            influence.Select(z => String.Format("[{0}] - {1}", z.Zone, z.Value)).ToArray());
                GUILayout.TextArea(labelText);

                if (_target.InfluenceLimit == 0)
                {
                    influence = influence.Pack(_target.InfluenceThreshold);
                }
                else
                {
                    influence = influence.Pack(_target.InfluenceLimit);
                }

                GUILayout.Label("Packed");
                labelText = String.Join("\n",
                                        influence.Select(z => String.Format("[{0}] - {1}", z.Zone, z.Value)).ToArray());
                GUILayout.TextArea(labelText);
            };

            Handles.BeginGUI();
            GUILayout.Window(5, new Rect(Vector2.zero, Vector2.one * 200), windowFunc, "Influence");
            Handles.EndGUI();
        }
 private void _ToSetting()
 {
     var stage = new LocalCreateAgentStage();
     stage.DoneEvent += _ToConnect;
     _DrawWindow = stage.DrawWindow;
     _Machine.Push(stage);
 }
 private void _ToGaming(IAgent agent)
 {
     var stage = new LocalGamingStage(agent, WorldPrefab, ControllerPrefab);
     stage.DoneEvent += _ToSetting;
     _DrawWindow = stage.DrawWindow;
     _Machine.Push(stage);
 }
 private void _ToConnect(string ip, int port)
 {
     var stage = new LocalConnectStage(ip , port);
     stage.DoneEvent += this._ToGaming;
     stage.FailEvent += _ToSetting;
     _DrawWindow = stage.DrawWindow;
     _Machine.Push(stage);
 }
 public Window()
 {
     soundAppear = SoundDefOf.DialogBoxAppear;
     soundClose  = SoundDefOf.Click;
     onGUIProfilerLabelCached      = "WindowOnGUI: " + GetType().Name;
     extraOnGUIProfilerLabelCached = "ExtraOnGUI: " + GetType().Name;
     innerWindowOnGUICached        = InnerWindowOnGUI;
 }
Exemple #21
0
 public void ActivateDisplay(int id, Rect buttonRect, Rect rect, GUI.WindowFunction func, GUIStyle style)
 {
     windowId       = id;
     btnRect        = buttonRect;
     displayRect    = rect;
     windowFunction = func;
     listStyle      = style;
 }
 public static Rect Window(int id, Rect clientRect, GUI.WindowFunction function, string title)
 {
     if (!ProceduralObjectsMod.UseUINightMode.value)
     {
         GUI.DrawTexture(new Rect(clientRect.x + 2, clientRect.y + 2, clientRect.width - 4, clientRect.height - 4), bckgTex, ScaleMode.StretchToFill);
     }
     return(GUI.Window(id, clientRect, function, title));
 }
 public static Rect DoWindow(int id, Rect rect, GUI.WindowFunction func, string text, GUIStyle style = null, params GUILayoutOption[] options)
 {
     if (!table.TryGetValue(id, out var window))
     {
         table[id] = window = new ResizableWindow_();
     }
     return(window.Do(id, rect, func, text, style, options));
 }
Exemple #24
0
        public static Rect Window(int id, Rect rect, GUI.WindowFunction windowFunc, string title)
        {
#if CPP
            return(GUI.Window(id, rect, windowFunc, GUIContent.Temp(title), GUI.skin.window));
#else
            return(GUI.Window(id, rect, windowFunc, title));
#endif
        }
Exemple #25
0
 public void ActivateDisplay(int id, Rect btnRect, Rect rect, GUI.WindowFunction func, GUIStyle style)
 {
     this.windowId       = id;
     this.btnRect        = btnRect;
     this.displayRect    = rect;
     this.windowFunction = func;
     this.listStyle      = style;
 }
Exemple #26
0
        public static void HookIfConfigured(GUI.WindowFunction function)
        {
            if (AutoTranslationPlugin.Current.PluginTextCaches.Count == 0)
            {
                return;
            }

            HookIfConfigured(function.Method);
        }
Exemple #27
0
 private bool DrawWindow(int id, Rect r, GUI.WindowFunction fun, string name)
 {
     GUI.Window(id, r, fun, name);
     if (Event.current.type == UnityEngine.EventType.MouseDown && r.Contains(Event.current.mousePosition))
     {
         return(true);
     }
     return(false);
 }
Exemple #28
0
            public static bool Prefix(int id, Rect screenRect, GUI.WindowFunction func, GUIContent content, GUIStyle style, Il2CppReferenceArray <GUILayoutOption> options, out Rect __result)
            {
                GUIUtility.CheckOnGUI();
                var @object = new LayoutedWindow(func, screenRect, content, options, style);

                __result = GUI.Window(id, screenRect, (GUI.WindowFunction)@object.DoWindow, content, style);

                return(false);
            }
Exemple #29
0
 private void OpenHintPanel(string content, GUI.WindowFunction func)
 {
     GUILayout.Window(0, hintPanelRect, _ =>
     {
         if (GUILayout.Button("确认"))
         {
         }
     }, content);
 }
Exemple #30
0
 void Init(string title, string msg, UIMessageBoxAction[] actions)
 {
     gameObject.name += "(" + title + ")";
     this.title       = title;
     this.msg         = msg;
     this.actions     = actions;
     windowFunc       = WindowFunc; // Cache this delegate that Unity asks for every frame
     open             = true;
 }
Exemple #31
0
    void Draw(Vector2 w, GUI.WindowFunction f)
    {
        w /= 2;
        Vector2 s  = new Vector2(Screen.width, Screen.height) / 2;
        Vector2 p1 = s - w;
        Vector2 p2 = s + w;

        gui.Window(100, Rect.MinMaxRect(p1.x, p1.y, p2.x, p2.y), f, "PopUp");
    }
Exemple #32
0
        static void OnSceneGUI(SceneView sceneView)
        {
            GUI.WindowFunction func = id =>
            {
                labelStyle = new GUIStyle(EditorStyles.label);
                labelStyle.normal.textColor = Color.white;
                labelStyle.wordWrap         = true;

                using (new EditorGUILayout.HorizontalScope())
                {
                    GUILayout.FlexibleSpace();

                    if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android)
                    {
                        selectedPlatformName = "Android";
                    }
                    else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows64)
                    {
                        selectedPlatformName = "PC";
                    }
                    else
                    {
                        selectedPlatformName = "Other";
                    }

                    EditorGUILayout.LabelField(selectedPlatformName, labelStyle);

                    GUILayout.FlexibleSpace();
                }

                using (new EditorGUILayout.HorizontalScope())
                {
                    if (GUILayout.Button("PC", GUILayout.Width(70)))
                    {
                        EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, BuildTarget.StandaloneWindows64);
                    }
                    if (GUILayout.Button("Android", GUILayout.Width(70)))
                    {
                        canUseAndroidPlatform = EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Android, BuildTarget.Android);
                    }
                }


                if (!canUseAndroidPlatform)
                {
                    EditorGUILayout.HelpBox("Need to install Unity's Android SDK", MessageType.Error);
                    if (GUILayout.Button("Open Build Settings"))
                    {
                        EditorUserBuildSettings.selectedBuildTargetGroup = BuildTargetGroup.Android;
                        EditorApplication.ExecuteMenuItem("File/Build Settings...");
                    }
                }
            };

            GUILayout.Window(1, windowSize, func, "Selected Platform");
        }
Exemple #33
0
        public static Rect DoWindow(int id, Rect rect, GUI.WindowFunction func, string text, GUILayoutOption[] options)
        {
            _ResizableWindow window;

            if (!_table.TryGetValue(id, out window))
            {
                _table[id] = window = new _ResizableWindow();
            }
            return(window.Do(id, rect, func, text, options));
        }
Exemple #34
0
 //We have to initialize the Window! Giving it importand information.
 protected void initializeWindow(string window_title, Rect window_Rect, int window_id, GUI.WindowFunction window_Func, float transparantcy_Alpha = 0.90f, bool show_window = true, KeyCode show_Hide_Key = KeyCode.None)
 {
     windowTitle        = window_title;
     windowRect         = window_Rect;
     windowId           = window_id;
     hideShowKey        = show_Hide_Key;
     windowFunc         = window_Func;
     bShowWindow        = show_window;
     transparantcyAlpha = transparantcy_Alpha;
 }
Exemple #35
0
        public static void DrawWindow(int windowId, WindowSettings window, GUI.WindowFunction func)
        {
            Rect rect = window.rect;

            if (window.isMinimized)
            {
                rect.height = 30;
            }
            GUILayout.Window(windowId, rect, func, GUIContent.none);
        }
        /// <summary>
        /// Creates a new 'Sub Window' that acts like a window within this editor.
        /// Useful for quick-n-dirty solutions to things like movable controls,
        /// popup windows, dropdown lists, etc...
        /// </summary>
        /// <param name="position">The editor-relative position of the window.</param>
        /// <param name="updateHandler">A user-supplied method that is called each frame
        /// that the SubWindow is active.</param>
        /// <returns></returns>
        public SubWindow ShowSubwindow(Rect position, GUI.WindowFunction updateHandler, SubWindow.WindowType type, GUIStyle style = null)
        {
            var win = ShowSubwindow(WindowId, position, updateHandler, type, style);

            while (SubWindows.ContainsKey(WindowId))
            {
                WindowId++;
            }
            return(win);
        }
 public DialogHelper() {
     drawWindowDelegate = DrawWindow;
     drawWindowFunction = new GUI.WindowFunction(drawWindowDelegate);
 }
Exemple #38
0
 public MapEditorWindow(WindowType type, Rect coords, GUI.WindowFunction renderFunction, string windowTitle, string buttonName)
 {
     Type = type;
     Coords = coords;
     Showing = true;
     RenderFunction = renderFunction;
     WindowTitle = windowTitle;
     ButtonName = buttonName;
 }
Exemple #39
0
 void Start()
 {
     windowFunction1 = DoMyWindow1;
 }
Exemple #40
0
 public DebugWindowInfo(string title, Rect rect, GUI.WindowFunction drawFunc)
 {
     Title = title;
     Rect = rect;
     DrawFunc = drawFunc;
 }
Exemple #41
0
 public DebugWindowInfo(string title, Rect rect, GUI.WindowFunction drawFunc, bool enabled, GUI.WindowFunction disableFunc)
 {
     Title = title;
     Rect = rect;
     DrawFunc = drawFunc;
     Enabled = enabled;
     DisableFunc = disableFunc;
 }
        private void CreateUIObjects()
        {
            windowFunc = new GUI.WindowFunction(WindowGUI);

            windowStyle = new GUIStyle(HighLogic.Skin.window)
            {
                fontSize = HighLogic.Skin.label.fontSize
            };

            areaStyle = new GUIStyle(HighLogic.Skin.textArea);

            labelStyle = new GUIStyle(HighLogic.Skin.label)
            {
                fontStyle = FontStyle.Normal,
                alignment = TextAnchor.MiddleLeft,
                padding = new RectOffset(0, 0, 0, 0),
                margin = new RectOffset(0, 0, 1, 1)
            };

            dataStyle = new GUIStyle(HighLogic.Skin.label)
            {
                fontStyle = FontStyle.Normal,
                alignment = TextAnchor.MiddleRight,
                padding = new RectOffset(0, 0, 0, 0),
                margin = new RectOffset(0, 0, 1, 1)
            };

            badDataStyle = new GUIStyle(HighLogic.Skin.label)
            {
                fontStyle = FontStyle.Normal,
                alignment = TextAnchor.MiddleRight,
                normal = { textColor = new Color(1.0f, 0.5f, 0.5f) },
                focused = { textColor = new Color(1.0f, 0.5f, 0.5f) },
                padding = new RectOffset(0, 0, 0, 0),
                margin = new RectOffset(0, 0, 1, 1)
            };

            buttonStyle = new GUIStyle(HighLogic.Skin.button)
            {
                padding = new RectOffset(0, 0, 0, 0),
                margin = new RectOffset(0, 0, 0, 0),
                border = new RectOffset(1, 0, 0, 0)
            };
        }
	public CustomGUIWindow(Rect windowRect, GUI.WindowFunction _windowDrawHandler, string windowTitle) {
		windowId = this.GetInstanceID();
		windowDrawHandler = _windowDrawHandler;
		title = windowTitle;
	}
Exemple #44
0
    // Use this for initialization
    void Start()
    {
        windowFunction = runThis;
        //get no.of floors
          //  print(floorsList.Length);

        //read all values and save to "floorsWithObjects" dictionary
        readAllValues(floorsList);
    }
Exemple #45
0
 // Use this for initialization
 void Start()
 {
     index = 0;
     windowFunction = DoMyWindow;
     windowFunction2 = DOTypes;
     windowFunction3 = DoWoodFloor;
     windowFunction4 = DOFLoortypes;
     windowFunction5 = OpenMenu;
 }
 internal LayoutedWindow(GUI.WindowFunction f, Rect screenRect, GUIContent content, GUILayoutOption[] options, GUIStyle style)
 {
     this.m_Func = f;
     this.m_ScreenRect = screenRect;
     this.m_Options = options;
     this.m_Style = style;
 }
 void Start()
 {
     windowFunction = setNewgameButton;
 }
Exemple #48
0
 // Use this for initialization
 void Start()
 {
     windowFunction = DoMyWindow;
 }
 private void _InitialWindow()
 {
     _DrawWindow = Local._EmptyDraw;
 }
 public Menu(string title, GUI.WindowFunction function)
 {
     this.title = title;
     this.function = function;
 }
Exemple #51
0
 internal void ShowWindow(Rect rect, GUI.WindowFunction winFun, string title, string paramName)
 {
     if (!popupWindowIsOpened)
     {
         popupWindowIsOpened = true;
         popupWindowParamName = paramName;
         popupWindowTitle = title;
         popupWindowFunction = winFun;
         popupWindowRect = rect;
     }
     popupWindowRect = GUI.Window(6, popupWindowRect, popupWindowFunction, popupWindowTitle);
     GUI.BringWindowToFront(6);
 }
 public DialogHelper()
 {
     this.drawWindowDelegate = new Action<int>(this.DrawWindow);
     this.drawWindowFunction = new GUI.WindowFunction(this.drawWindowDelegate.Invoke);
 }