Tac.PopupWindow.GetInstance C# (CSharp) Méthode

GetInstance() private static méthode

private static GetInstance ( ) : PopupWindow
Résultat PopupWindow
        private static PopupWindow GetInstance()
        {
            if (go == null)
            {
                go = new GameObject("TacPopupWindow");
                instance = go.AddComponent<PopupWindow>();
            }
            return instance;
        }

Usage Example

Exemple #1
0
        public static void Draw(string buttonText, Rect windowPos, Func <int, object, bool> popupDrawCallback, GUIStyle buttonStyle, object parameter, params GUILayoutOption[] options)
        {
            PopupWindow pw = PopupWindow.GetInstance();
            GUIContent  content;

            if (buttonText.Length == 1)
            {
                content = new GUIContent(buttonText, "Menu");
            }
            else
            {
                content = new GUIContent(buttonText);
            }
            var rect = GUILayoutUtility.GetRect(content, buttonStyle, options);

            if (GUI.Button(rect, content, buttonStyle))
            {
                pw.showPopup = true;

                var mouse = Input.mousePosition;
                pw.popupPos = new Rect(mouse.x - 10, Screen.height - mouse.y - 10, 10, 10);

                pw.callback  = popupDrawCallback;
                pw.parameter = parameter;
            }
        }
All Usage Examples Of Tac.PopupWindow::GetInstance