Beispiel #1
0
        public void Open(string value, string comboName, IModInputCombinationMenu combinationMenu = null, IModInputCombinationElement element = null)
        {
            _combinationMenu            = combinationMenu;
            _element                    = element;
            _comboName                  = comboName;
            _inputMenu.OnPopupConfirm  += OnPopupConfirm;
            _inputMenu.OnPopupCancel   += OnPopupCancel;
            _inputMenu.OnPopupValidate += OnPopupValidate;

            const string message = "Press your combination";

            _inputMenu.EnableMenu(true, value);

            var okCommand = InputLibrary.confirm;
            var okPrompt  = new ScreenPrompt(okCommand, "OK");

            if (_cancelCommand == null)
            {
                _cancelCommand = new SingleAxisCommand();
                var cancelBindingGamepad  = new InputBinding(JoystickButton.Select);
                var cancelBindingKeyboard = new InputBinding(KeyCode.Escape);
                _cancelCommand.SetInputs(cancelBindingGamepad, cancelBindingKeyboard);
                var commandObject    = new GameObject();
                var commandComponent = commandObject.AddComponent <ModCommandUpdater>();
                commandComponent.Initialize(_cancelCommand);
            }
            var cancelPrompt = new ScreenPrompt(_cancelCommand, "Cancel");
            var resetPrompt  = new ScreenPrompt("Reset");

            _inputMenu.SetUpPopup(message, okCommand, _cancelCommand, null, okPrompt, cancelPrompt, resetPrompt);
            _inputMenu.GetValue <Text>("_labelText").text = message;
        }
        public void Initialize(Menu menu, IModInputCombinationElement combinationElementTemplate)
        {
            _combinationElementTemplate = combinationElementTemplate;

            base.Initialize(menu);

            Title = "Edit Combination";
        }
 public void RemoveCombinationElement(IModInputCombinationElement element)
 {
     CombinationElements.Remove(element);
     RemoveSelectable(element.Toggle.GetComponent <Selectable>());
 }