UnityEngine.GUI.ModalWindow(int, UnityEngine.Rect, UnityEngine.GUI.WindowFunction, UnityEngine.GUIContent, UnityEngine.GUIStyle)

Here are the examples of the csharp api UnityEngine.GUI.ModalWindow(int, UnityEngine.Rect, UnityEngine.GUI.WindowFunction, UnityEngine.GUIContent, UnityEngine.GUIStyle) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

19 View Source File : Popup.cs
License : MIT License
Project Creator : Astropilot

public override void DoGUIWindow()
            {
                GUI.skin = InterfaceMaker.CustomSkin;

                if ((Event.current.type == EventType.Layout))
                {
                    _displayOptionsCopy = (string[])displayOptions.Clone();
                }

                GUI.ModalWindow(s_popupWindowId, GetWindowRect(), (id) =>
                {
                    _searchTerms = GUILayout.TextField(_searchTerms);

                    if (_displayOptionsCopy.Length == 0)
                    {
                        GUILayout.Label("No results has been found!", GUILayout.Width(150));
                    }
                    else
                    {
                        scrollPosition = GUILayout.BeginScrollView(scrollPosition);
                        for (var j = 0; j < _displayOptionsCopy.Length; ++j)
                        {
                            if (GUILayout.Button(_displayOptionsCopy[j], InterfaceMaker.CustomSkin.button))
                            {
                                result = j;
                            }
                        }
                        GUILayout.EndScrollView();
                    }

                    var ev = Event.current;
                    if ((ev.rawType == EventType.MouseDown) && !(new Rect(Vector2.zero, size).Contains(ev.mousePosition)))
                    {
                        result = -1;
                        ;
                    }
                }
                , label, InterfaceMaker.CustomSkin.GetStyle("popup"));
            }

19 View Source File : Popup.cs
License : MIT License
Project Creator : Astropilot

public virtual void DoGUIWindow()
            {
                GUI.skin = InterfaceMaker.CustomSkin;

                GUI.ModalWindow(s_popupWindowId, GetWindowRect(), (id) =>
                {
                    using (var sc = new GUILayout.ScrollViewScope(scrollPosition))
                    {
                        scrollPosition = sc.scrollPosition;

                        for (var j = 0; j < displayOptions.Length; ++j)
                        {
                            if (GUILayout.Button(displayOptions[j], InterfaceMaker.CustomSkin.button))
                            {
                                result = j;
                            }
                        }
                    }

                    var ev = Event.current;
                    if ((ev.rawType == EventType.MouseDown) && !(new Rect(Vector2.zero, size).Contains(ev.mousePosition)))
                    {
                        result = -1; ;
                    }
                }
                , label, InterfaceMaker.CustomSkin.GetStyle("popup"));
            }