Beispiel #1
0
        public void Initialize(PopupInputMenu menu)
        {
            if (Menu != null)
            {
                return;
            }
            var parent     = menu.transform.parent.gameObject;
            var parentCopy = GameObject.Instantiate(parent);

            parentCopy.AddComponent <DontDestroyOnLoad>();
            _inputMenu = parentCopy.transform.GetComponentInChildren <PopupInputMenu>(true);
            GameObject.Destroy(_inputMenu.GetValue <Text>("_labelText").GetComponent <LocalizedText>());
            Initialize((Menu)_inputMenu);
        }
Beispiel #2
0
        public void Open(InputType inputType, string value)
        {
            _inputMenu.OnPopupConfirm += OnPopupConfirm;
            _inputMenu.OnPopupCancel  += OnPopupCancel;

            if (inputType == InputType.Number)
            {
                _inputMenu.OnInputPopupValidateChar += OnValidateCharNumber;
                _inputMenu.OnPopupValidate          += OnValidateNumber;
            }
            var message = inputType == InputType.Number ? "Write a number" : "Write some text";

            _inputMenu.EnableMenu(true);

            var okPrompt      = new ScreenPrompt(InputLibrary.confirm2, "OK");
            var cancelCommand = OWInput.UsingGamepad() ? InputLibrary.cancel : InputLibrary.escape;
            var cancelPrompt  = new ScreenPrompt(cancelCommand, "Cancel");

            _inputMenu.SetUpPopup(message, InputLibrary.confirm2, cancelCommand, okPrompt, cancelPrompt);
            _inputMenu.SetInputFieldPlaceholderText("");
            _inputMenu.GetInputField().text = value;
            _inputMenu.GetValue <Text>("_labelText").text = message;
        }