public override void Init()
    {
        if (containingAtom.type != "SessionPluginManager")
        {
            SuperController.LogError("Keybindings plugin can only be installed as a session plugin.");
            CreateTextField(new JSONStorableString("Error", "Keybindings plugin can only be installed as a session plugin."));
            enabledJSON.val = false;
            return;
        }

        _settings                = new KeybindingsSettings();
        _prefabManager           = new PrefabManager();
        _keyMapManager           = new KeyMapManager();
        _analogMapManager        = new AnalogMapManager();
        _selectionHistoryManager = new SelectionHistoryManager();
        _remoteCommandsManager   = new RemoteCommandsManager(this, _selectionHistoryManager);
        _globalCommands          = new GlobalCommands(this, containingAtom, _selectionHistoryManager, _remoteCommandsManager);
        _storage          = new KeybindingsStorage(this, _keyMapManager, _analogMapManager, _settings);
        _overlayReference = new KeybindingsOverlayReference();

        _analogHandler     = new AnalogHandler(_remoteCommandsManager, _analogMapManager, _settings);
        _normalModeHandler = new NormalModeHandler(this, _settings, _keyMapManager, _overlayReference, _remoteCommandsManager);
        _findModeHandler   = new FindModeHandler(this, _remoteCommandsManager, _overlayReference);

        SuperController.singleton.StartCoroutine(_prefabManager.LoadUIAssets());

        AcquireBuiltInCommands();
        _globalCommands.Init();
        AcquireAllAvailableBroadcastingPlugins();

        _storage.ImportDefaults();

        EnterNormalMode();
        // TODO: Map multiple bindings to the same action?

        _valid = true;
    }
Example #2
0
 public AnalogHandler(RemoteCommandsManager remoteCommandsManager, AnalogMapManager analogMapManager, IKeybindingsSettings settings)
 {
     _remoteCommandsManager = remoteCommandsManager;
     _analogMapManager      = analogMapManager;
     _settings = settings;
 }