Example #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;
        }
Example #2
0
        public ModMenus(IModConsole console, IModEvents events, IModInputHandler inputHandler,
                        IModManifest owmlManifest, IOwmlConfig owmlConfig, IOwmlConfig owmlDefaultConfig)
        {
            MainMenu  = new ModMainMenu(console);
            PauseMenu = new ModPauseMenu(console);
            ModsMenu  = new ModsMenu(console, this, inputHandler);
            OwmlMenu  = new OwmlConfigMenu(console, owmlManifest, owmlConfig, owmlDefaultConfig);
            InputMenu = new ModInputMenu(console);
            InputCombinationElementMenu = new ModInputCombinationElementMenu(console, inputHandler);
            InputCombinationMenu        = new ModInputCombinationMenu(console);

            events.Subscribe <SettingsManager>(Common.Events.AfterStart);
            events.Subscribe <TitleScreenManager>(Common.Events.AfterStart);
            events.OnEvent += OnEvent;
        }