Example #1
0
            public ButtonDescriptor(ButtonType buttonType, PopupWindowCallback pressedCallback = default)
            {
                if (pressedCallback == null)
                {
                    pressedCallback = DefaultCallback;
                }

                this.buttonType      = buttonType;
                this.pressedCallback = pressedCallback;
                switch (buttonType)
                {
                case ButtonType.Ok:
                    keyCodes = new KeyCode[] { KeyCode.Return, KeyCode.KeypadEnter };
                    text     = "Ok";
                    break;

                case ButtonType.Cancel:
                    keyCodes = new KeyCode[] { KeyCode.Escape };
                    text     = "Cancel";
                    break;

                default:
                    throw new System.ArgumentException("Invalid button type");
                }
            }
Example #2
0
            public ButtonDescriptor(string text, KeyCode keyCode, PopupWindowCallback pressedCallback = null)
            {
                if (pressedCallback == null)
                {
                    pressedCallback = DefaultCallback;
                }

                this.buttonType      = ButtonType.Custom;
                this.pressedCallback = pressedCallback;
                this.text            = text;
                this.keyCodes        = new KeyCode[] { keyCode };
            }
Example #3
0
        public static PopupWindow CreateCancelPopup(Transform parent, string title, string message, PopupWindowCallback onCancel)
        {
            var cancelDesc = new ButtonDescriptor(ButtonType.Cancel, onCancel);

            return(CreatePopupWindow(parent, title, message, cancelDesc));
        }
Example #4
0
        public static PopupWindow CreateOkPopup(Transform parent, string title, string message, PopupWindowCallback onOk)
        {
            var okDesc = new ButtonDescriptor(ButtonType.Ok, onOk);

            return(CreatePopupWindow(parent, title, message, okDesc));
        }