public override EffectLayer Render(IGameState state) { GameState_EliteDangerous gameState = state as GameState_EliteDangerous; GSI.Nodes.Controls controls = (state as GameState_EliteDangerous).Controls; EffectLayer keyBindsLayer = new EffectLayer("Elite: Dangerous - Key Binds"); HashSet <DeviceKeys> leftoverBlendStates = new HashSet <DeviceKeys>(keyBlendStates.Keys); long currentTime = Utils.Time.GetMillisecondsSinceEpoch(); if (gameState.Journal.fsdWaitingCooldown && gameState.Status.IsFlagSet(Flag.FSD_COOLDOWN)) { gameState.Journal.fsdWaitingCooldown = false; } if (gameState.Journal.fsdWaitingSupercruise && gameState.Status.IsFlagSet(Flag.SUPERCRUISE)) { gameState.Journal.fsdWaitingSupercruise = false; } Color newKeyColor; Dictionary <DeviceKeys, Color> smoothColorSets = new Dictionary <DeviceKeys, Color>(); foreach (ControlGroupSet controlGroupSet in controlGroupSets) { if (!controlGroupSet.IsSatisfied(gameState)) { continue; } foreach (ControlGroup controlGroup in controlGroupSet.controlGroups) { if (!controlGroup.IsSatisfied(gameState)) { continue; } foreach (string command in controlGroup.commands) { if (!controls.commandToBind.ContainsKey(command)) { continue; } bool keyWithEffect = KeyPresets.KEY_EFFECTS.ContainsKey(command); foreach (Bind.Mapping mapping in controls.commandToBind[command].mappings) { bool allModifiersPressed = true; foreach (DeviceKeys modifierKey in mapping.modifiers) { SetKey(keyBindsLayer, modifierKey, Properties.ShipStuffColor); leftoverBlendStates.Remove(modifierKey); if (Array.IndexOf( Global.InputEvents.PressedKeys, KeyUtils.GetFormsKey(modifierKey) ) == -1) { allModifiersPressed = false; break; } } if (!allModifiersPressed) { continue; } newKeyColor = Properties.GetColorByGroupName( controlGroup.colorGroupName ?? CommandColors.GetColorGroupForCommand(command) ); if (keyWithEffect) { SetKey(keyBindsLayer, mapping.key, KeyPresets.KEY_EFFECTS[command](newKeyColor, gameState, currentTime)); } else { smoothColorSets[mapping.key] = newKeyColor; } leftoverBlendStates.Remove(mapping.key); } } } } //Apply smooth transitions for keys foreach (KeyValuePair <DeviceKeys, Color> smoothKey in smoothColorSets) { SetKeySmooth(keyBindsLayer, smoothKey.Key, smoothKey.Value); } //Fade out inactive keys foreach (DeviceKeys key in leftoverBlendStates) { SetKeySmooth(keyBindsLayer, key, Color.Empty); } return(keyBindsLayer); }