Ejemplo n.º 1
0
        protected override void OnBeforeInitialModuleScreenSetAsRoot()
        {
            if (!_initialized)
            {
                _initialized = true;
                if (HotKeyManager.Create("SimpleTroopSpawner") is { } hkm)
                {
                    hkm.Add <SpawnTroops>();
                    hkm.Build();
                }
            }

            base.OnBeforeInitialModuleScreenSetAsRoot();
        }
Ejemplo n.º 2
0
        protected override void OnBeforeInitialModuleScreenSetAsRoot()
        {
            base.OnBeforeInitialModuleScreenSetAsRoot();

            var hkm = HotKeyManager.Create("MyMod");

            if (hkm is not null)
            {
                var hk = hkm.Add <TestKey1>();
                hk.Predicate        = () => _campaignIsStarted;
                hk.OnReleasedEvent += () => InformationManager.DisplayMessage(new InformationMessage("Test Key Released!", Colors.Magenta));
                hkm.Build();
            }
        }
Ejemplo n.º 3
0
        protected override void OnBeforeInitialModuleScreenSetAsRoot()
        {
            base.OnBeforeInitialModuleScreenSetAsRoot();

            try
            {
                if (_hotkeyManager == null)
                {
                    _hotkeyManager = HotKeyManager.Create("mbbannerlord.autorun");
                    _hotkeyManager.Add <AutoRunHotKey>();
                    _hotkeyManager.Build();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed initializing auto-run hotkey:\n" + ex.ToString());
            }
        }