コード例 #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");
                }
            }
コード例 #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 };
            }
コード例 #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));
        }
コード例 #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));
        }