Esempio n. 1
0
        public override EffectLayer Render(IGameState gamestate)
        {
            EffectLayer sc_assistant_layer = new EffectLayer("Shortcut Assistant");

            Keys[] heldKeys = Global.InputEvents.PressedKeys;

            Tree <Keys> _childKeys = Properties.ShortcutKeysTree;

            foreach (var key in heldKeys)
            {
                if (_childKeys != null)
                {
                    _childKeys = _childKeys.ContainsItem(Properties.MergeModifierKey ? KeyUtils.GetStandardKey(key) : key);
                }
            }

            if (_childKeys != null && _childKeys.Item != Keys.None)
            {
                Keys[] shortcutKeys;

                if (Properties.PresentationType == ShortcutAssistantPresentationType.ProgressiveSuggestion)
                {
                    shortcutKeys = _childKeys.GetChildren();
                }
                else
                {
                    shortcutKeys = _childKeys.GetAllChildren();
                }

                if (shortcutKeys.Length > 0)
                {
                    Devices.DeviceKeys[] selectedKeys = Utils.KeyUtils.GetDeviceKeys(shortcutKeys, true, !Console.NumberLock)
                                                        .Concat(Utils.KeyUtils.GetDeviceKeys(heldKeys, true)).ToArray();

                    if (Properties.DimBackground)
                    {
                        Devices.DeviceKeys[] backgroundKeys = Utils.KeyUtils.GetDeviceAllKeys().Except(selectedKeys).ToArray();
                        sc_assistant_layer.Set(backgroundKeys, Properties.DimColor);
                        //sc_assistant_layer.Fill(Properties.DimColor);
                    }

                    sc_assistant_layer.Set(selectedKeys, Properties.PrimaryColor);
                }
            }

            return(sc_assistant_layer);
        }