public override EffectLayer Render(IGameState gamestate) { EffectLayer layer = new EffectLayer(); if (isActive) { switch (Properties.AnimationType) { case TimerLayerAnimationType.OnOff: layer.Set(Properties.Sequence, Properties.SecondaryColor); break; case TimerLayerAnimationType.Fade: layer.Set(Properties.Sequence, ColorUtils.BlendColors(Properties.SecondaryColor, Properties.PrimaryColor, timer.InterpolationValue)); break; case TimerLayerAnimationType.Progress: case TimerLayerAnimationType.ProgressGradual: layer.PercentEffect(Properties.SecondaryColor, Properties.PrimaryColor, Properties.Sequence, timer.InterpolationValue, 1, Properties.AnimationType == TimerLayerAnimationType.Progress ? PercentEffectType.Progressive : PercentEffectType.Progressive_Gradual); break; } } else { layer.Set(Properties.Sequence, Properties.PrimaryColor); } return(layer); }
public override void UpdateLights(EffectFrame frame) { //if (Global.Configuration.volume_overlay_settings.enabled) //{ if (defaultDevice == null) { defaultDevice = devEnum.GetDefaultAudioEndpoint(DataFlow.Render, Role.Console); } Queue <EffectLayer> layers = new Queue <EffectLayer>(); if (Global.Configuration.volume_overlay_settings.dim_background) { layers.Enqueue(new EffectLayer("Overlay - Volume Base", Global.Configuration.volume_overlay_settings.dim_color)); } EffectLayer volume_bar = new EffectLayer("Overlay - Volume Bar"); float currentVolume = defaultDevice.AudioEndpointVolume.MasterVolumeLevelScalar; ColorSpectrum volume_spec = new ColorSpectrum(Global.Configuration.volume_overlay_settings.low_color, Global.Configuration.volume_overlay_settings.high_color); volume_spec.SetColorAt(0.75f, Global.Configuration.volume_overlay_settings.med_color); volume_bar.PercentEffect(volume_spec, Global.Configuration.volume_overlay_settings.sequence, currentVolume, 1.0f); layers.Enqueue(volume_bar); frame.AddOverlayLayers(layers.ToArray()); //} }
public override EffectLayer Render(IGameState state) { EffectLayer respawn_layer = new EffectLayer("Dota 2 - Respawn"); if (state is GameState_Dota2) { GameState_Dota2 dota2state = state as GameState_Dota2; if (dota2state.Player.Team != PlayerTeam.Undefined && dota2state.Player.Team != PlayerTeam.None && !dota2state.Hero.IsAlive) { double percent = (dota2state.Hero.SecondsToRespawn > 5 ? 0.0 : 1.0 - (dota2state.Hero.SecondsToRespawn / 5.0)); respawn_layer.Fill(Utils.ColorUtils.BlendColors(Color.Transparent, Properties.BackgroundColor, percent)); respawn_layer.PercentEffect(Properties.RespawningColor, Properties.RespawnColor, Properties.Sequence, percent, 1.0, PercentEffectType.AllAtOnce); } } return(respawn_layer); }
public EffectLayer UpdateLights(ScriptSettings settings, GameState state = null) { EffectLayer layer = new EffectLayer(this.ID); layer.PercentEffect(ForegroundColour, BackgroundColour, settings.Keys, DateTime.Now.Second, 60D); return(layer); }
public object UpdateLights(VariableRegistry settings, IGameState state = null) { if (defaultDevice == null) { defaultDevice = devEnum.GetDefaultAudioEndpoint(DataFlow.Render, Role.Console); } Queue <EffectLayer> layers = new Queue <EffectLayer>(); EffectLayer layer = new EffectLayer(this.ID); float currentVolume = defaultDevice.AudioEndpointVolume.MasterVolumeLevelScalar; layer.PercentEffect(Color.White, Color.Transparent, new KeySequence(new[] { DeviceKeys.F1, DeviceKeys.F2, DeviceKeys.F3, DeviceKeys.F4, DeviceKeys.F5, DeviceKeys.F6, DeviceKeys.F7, DeviceKeys.F8, DeviceKeys.F9, DeviceKeys.F10, }), currentVolume % 10D, 1.0f, PercentEffectType.Progressive); //layers.Enqueue(layer); EffectLayer layer_2 = new EffectLayer(this.ID + " 2"); layer_2.PercentEffect(Color.FromArgb(255, 0, 0, 0), Color.Transparent, new KeySequence(new[] { DeviceKeys.F1, DeviceKeys.F2, DeviceKeys.F3, DeviceKeys.F4, DeviceKeys.F5, DeviceKeys.F6, DeviceKeys.F7, DeviceKeys.F8, DeviceKeys.F9, DeviceKeys.F10, }), currentVolume % 10D - 0.1f, 1.0f, PercentEffectType.Progressive); //layers.Enqueue(layer_2); EffectLayer layerMain = layer + layer_2; layers.Enqueue(layerMain); return(layers.ToArray()); }
public object UpdateLights(VariableRegistry settings, IGameState state = null) { EffectLayer layer = new EffectLayer(this.ID); layer.PercentEffect(settings.GetVariable <RealColor>("foregroundColour").GetDrawingColor(), settings.GetVariable <RealColor>("backgroundColour").GetDrawingColor(), settings.GetVariable <KeySequence>("keys") ?? DefaultKeys, DateTime.Now.Second, 60D); return(layer); }
public object UpdateLights(VariableRegistry settings, IGameState state = null) { EffectLayer layer = new EffectLayer(this.ID); RealColor FG = settings.GetVariable <RealColor>("foregroundColour"); RealColor BG = settings.GetVariable <RealColor>("backgroundColour"); if (!this.threadRunning) { this.threadRunning = true; ThreadPool.QueueUserWorkItem(this.Battery); } if (this.batteryStatus.isCharging == true) { FG = settings.GetVariable <RealColor>("chargingColour"); BG = settings.GetVariable <RealColor>("chargingBGColour"); } layer.PercentEffect(FG.GetDrawingColor(), BG.GetDrawingColor(), settings.GetVariable <KeySequence>("keys") ?? DefaultKeys, this.batteryStatus.percentage, 100D, PercentEffectType.Progressive_Gradual); return(layer); }
public object UpdateLights(VariableRegistry settings, IGameState state = null) { Queue <EffectLayer> layers = new Queue <EffectLayer>(); EffectLayer layer = new EffectLayer(this.ID); layer.PercentEffect(Color.White, Color.Black, new KeySequence(new[] { DeviceKeys.F1, DeviceKeys.F2, DeviceKeys.F3, DeviceKeys.F4, DeviceKeys.F5, DeviceKeys.F6, DeviceKeys.F7, DeviceKeys.F8, DeviceKeys.F9, DeviceKeys.F10, DeviceKeys.F11, DeviceKeys.F12 }), DateTime.Now.Hour % 12D, 12D, PercentEffectType.Progressive); layers.Enqueue(layer); EffectLayer layer_2 = new EffectLayer(this.ID + " 2"); layer_2.PercentEffect(Color.White, Color.Transparent, new KeySequence(new[] { DeviceKeys.NUM_ONE, DeviceKeys.NUM_TWO, DeviceKeys.NUM_THREE, DeviceKeys.NUM_FOUR, DeviceKeys.NUM_FIVE, DeviceKeys.NUM_SIX, DeviceKeys.NUM_SEVEN, DeviceKeys.NUM_EIGHT, DeviceKeys.NUM_NINE, DeviceKeys.NUM_ZERO }), DateTime.Now.Second % 10D, 10D, PercentEffectType.Progressive); //layers.Enqueue(layer_2); EffectLayer layer_3 = new EffectLayer(this.ID + " 3"); layer_3.PercentEffect(Color.White, Color.Transparent, new KeySequence(new[] { DeviceKeys.ONE, DeviceKeys.TWO, DeviceKeys.THREE, DeviceKeys.FOUR, DeviceKeys.FIVE, DeviceKeys.SIX, DeviceKeys.SEVEN, DeviceKeys.EIGHT, DeviceKeys.NINE, DeviceKeys.ZERO }), DateTime.Now.Minute % 10f, 10D, PercentEffectType.Progressive); //layers.Enqueue(layer_3); EffectLayer layer_4 = new EffectLayer(this.ID + " 4"); layer_4.PercentEffect(Color.FromArgb(200, 255, 0, 0), Color.Transparent, new KeySequence(new[] { DeviceKeys.ONE, DeviceKeys.TWO, DeviceKeys.THREE, DeviceKeys.FOUR, DeviceKeys.FIVE, DeviceKeys.SIX }), DateTime.Now.Minute % 60D, 60D, PercentEffectType.Progressive); //layers.Enqueue(layer_4); EffectLayer layer_5 = new EffectLayer(this.ID + " 5"); layer_5.PercentEffect(Color.FromArgb(200, 255, 0, 0), Color.Transparent, new KeySequence(new[] { DeviceKeys.NUM_ONE, DeviceKeys.NUM_TWO, DeviceKeys.NUM_THREE, DeviceKeys.NUM_FOUR, DeviceKeys.NUM_FIVE, DeviceKeys.NUM_SIX }), DateTime.Now.Second % 60D, 60D, PercentEffectType.Progressive); //layers.Enqueue(layer_5); EffectLayer layer_sum34 = layer_3 + layer_4; layers.Enqueue(layer_sum34); EffectLayer layer_sum25 = layer_2 + layer_5; layers.Enqueue(layer_sum25); return(layers.ToArray()); }
public override EffectLayer Render(IGameState gamestate) { // Ensure the gamestate is for Minecraft, and store a casted reference to it if (!(gamestate is GameState_Minecraft)) { return(new EffectLayer()); } GameState_Minecraft state = gamestate as GameState_Minecraft; // Choose the main healthbar's color depending on whether the player is withered/poisoned/regen/normal. Color barColor = Properties.NormalHealthColor; // Default normal color if (Properties.EnableWitherHealthColor && state.Player.PlayerEffects.HasWither) // Wither takes priority over others { barColor = Properties.WitherHealthColor; } else if (Properties.EnablePoisonHealthColor && state.Player.PlayerEffects.HasPoison) // Poison 2nd priority { barColor = Properties.PoisonHealthColor; } else if (Properties.EnableRegenerationHealthColor && state.Player.PlayerEffects.HasRegeneration) // Regen 3rd priority { barColor = Properties.RegenerationHealthColor; } // Render the main healthbar, with the color decided above. EffectLayer layer = new EffectLayer() .PercentEffect(barColor, Properties.BackgroundColor, Properties.Sequence, state.Player.Health, state.Player.HealthMax, Settings.PercentEffectType.Progressive); // If absorption is enabled, overlay the absorption display on the top of the original healthbar if (Properties.EnableAbsorptionHealthColor) { layer.PercentEffect(Properties.AbsorptionHealthColor, Properties.BackgroundColor, Properties.Sequence, state.Player.Absorption, state.Player.AbsorptionMax, Properties.GradualProgress ? Settings.PercentEffectType.Progressive_Gradual : Settings.PercentEffectType.Progressive); } return(layer); }
public override EffectLayer Render(IGameState state) { EffectLayer percent_layer = new EffectLayer(); double value = 0; if (!double.TryParse(Properties._VariablePath, out value) && !string.IsNullOrWhiteSpace(Properties._VariablePath)) { try { value = Convert.ToDouble(Utils.GameStateUtils.RetrieveGameStateParameter(state, Properties._VariablePath)); } catch (Exception exc) { value = 0; } } double maxvalue = 0; if (!double.TryParse(Properties._MaxVariablePath, out maxvalue) && !string.IsNullOrWhiteSpace(Properties._MaxVariablePath)) { try { maxvalue = Convert.ToDouble(Utils.GameStateUtils.RetrieveGameStateParameter(state, Properties._MaxVariablePath)); } catch (Exception exc) { maxvalue = 0; } } percent_layer.PercentEffect(Properties.Gradient.GetColorSpectrum(), Properties.Sequence, value, maxvalue, Properties.PercentType, Properties.BlinkThreshold, Properties.BlinkDirection); return(percent_layer); }
public EffectLayer[] UpdateLights(ScriptSettings settings, IGameState state = null) { Queue <EffectLayer> layers = new Queue <EffectLayer>(); EffectLayer layer = new EffectLayer(this.ID); layer.PercentEffect(Color.Purple, Color.Green, new KeySequence(new[] { DeviceKeys.F12, DeviceKeys.F11, DeviceKeys.F10, DeviceKeys.F9, DeviceKeys.F8, DeviceKeys.F7, DeviceKeys.F6, DeviceKeys.F5, DeviceKeys.F4, DeviceKeys.F3, DeviceKeys.F2, DeviceKeys.F1 }), DateTime.Now.Second % 20D, 20D); layers.Enqueue(layer); EffectLayer layer_swirl = new EffectLayer(this.ID + " - Swirl"); layer_swirl.PercentEffect(Color.Blue, Color.Black, new KeySequence(new[] { DeviceKeys.NUM_ONE, DeviceKeys.NUM_FOUR, DeviceKeys.NUM_SEVEN, DeviceKeys.NUM_EIGHT, DeviceKeys.NUM_NINE, DeviceKeys.NUM_SIX, DeviceKeys.NUM_THREE, DeviceKeys.NUM_TWO }), DateTime.Now.Millisecond % 500D, 500D, PercentEffectType.Progressive_Gradual); layers.Enqueue(layer_swirl); EffectLayer layer_blinking = new EffectLayer(this.ID + " - Blinking Light"); ColorSpectrum blink_spec = new ColorSpectrum(Color.Red, Color.Black, Color.Red); Color blink_color = blink_spec.GetColorAt(DateTime.Now.Millisecond / 1000.0f); layer_blinking.Set(DeviceKeys.NUM_FIVE, blink_color); layers.Enqueue(layer_blinking); return(layers.ToArray()); }
public override void UpdateLights(EffectFrame frame) { previoustime = currenttime; currenttime = Utils.Time.GetMillisecondsSinceEpoch(); Queue <EffectLayer> layers = new Queue <EffectLayer>(); float time = (float)Math.Pow(Math.Sin(1.0D * (internalcounter++ / 10.0f)), 2.0d); EffectLayer cz_layer = new EffectLayer("Color Zones"); cz_layer.DrawColorZones((Global.Configuration.desktop_profile.Settings as DesktopSettings).lighting_areas.ToArray()); layers.Enqueue(cz_layer); if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).cpu_usage_enabled) { EffectLayer cpu = new EffectLayer("CPU"); if (currentCPUValue - previousCPUValue > 0.0f && transitionalCPUValue < currentCPUValue) { transitionalCPUValue += (currentCPUValue - previousCPUValue) / 100.0f; } else if (currentCPUValue - previousCPUValue < 0.0f && transitionalCPUValue > currentCPUValue) { transitionalCPUValue -= (previousCPUValue - currentCPUValue) / 100.0f; } else if (currentCPUValue - previousCPUValue == 0.0f && transitionalCPUValue != currentCPUValue) { transitionalCPUValue = currentCPUValue; } Color cpu_used = (Global.Configuration.desktop_profile.Settings as DesktopSettings).cpu_used_color; Color cpu_free = (Global.Configuration.desktop_profile.Settings as DesktopSettings).cpu_free_color; if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).cpu_free_color_transparent) { cpu_free = Color.FromArgb(0, cpu_used); } cpu.PercentEffect(cpu_used, cpu_free, (Global.Configuration.desktop_profile.Settings as DesktopSettings).cpu_sequence, transitionalCPUValue, 100.0f, (Global.Configuration.desktop_profile.Settings as DesktopSettings).cpu_usage_effect_type); layers.Enqueue(cpu); } if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).ram_usage_enabled) { EffectLayer memory = new EffectLayer("Memory"); double percentFree = ((double)memory_Available / (double)memory_Total); double percentOccupied = 1.0D - percentFree; Color ram_used = (Global.Configuration.desktop_profile.Settings as DesktopSettings).ram_used_color; Color ram_free = (Global.Configuration.desktop_profile.Settings as DesktopSettings).ram_free_color; if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).ram_free_color_transparent) { ram_free = Color.FromArgb(0, ram_used); } memory.PercentEffect(ram_used, ram_free, (Global.Configuration.desktop_profile.Settings as DesktopSettings).ram_sequence, percentOccupied, 1.0D, (Global.Configuration.desktop_profile.Settings as DesktopSettings).ram_usage_effect_type); layers.Enqueue(memory); } //Scripts before interactive and shortcut assistant layers Global.Configuration.desktop_profile.UpdateEffectScripts(layers); EffectLayer interactive_layer = new EffectLayer("Interactive Effects"); foreach (var input in input_list.ToArray()) { if (input == null) { continue; } try { if (input.type == input_item.input_type.Spectrum) { float transition_value = input.progress / Effects.canvas_width; if (transition_value > 1.0f) { continue; } Color color = input.spectrum.GetColorAt(transition_value); interactive_layer.Set(input.key, color); } else if (input.type == input_item.input_type.AnimationMix) { float time_value = input.progress / Effects.canvas_width; if (time_value > 1.0f) { continue; } input.animation.Draw(interactive_layer.GetGraphics(), time_value); } } catch (Exception exc) { Global.logger.LogLine("Interative layer exception, " + exc, Logging_Level.Error); } } for (int x = input_list.Count - 1; x >= 0; x--) { try { if (input_list[x].progress > Effects.canvas_width) { input_list.RemoveAt(x); } else { float trans_added = ((Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_speed * (getDeltaTime() * 5.0f)); input_list[x].progress += trans_added; } } catch (Exception exc) { Global.logger.LogLine("Interative layer exception, " + exc, Logging_Level.Error); } } layers.Enqueue(interactive_layer); if (Global.Configuration.time_based_dimming_enabled) { if ( Utils.Time.IsCurrentTimeBetween(Global.Configuration.time_based_dimming_start_hour, Global.Configuration.time_based_dimming_end_hour) ) { layers.Clear(); EffectLayer time_based_dim_layer = new EffectLayer("Time Based Dim"); time_based_dim_layer.Fill(Color.Black); layers.Enqueue(time_based_dim_layer); } } EffectLayer sc_assistant_layer = new EffectLayer("Shortcut Assistant"); if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).shortcuts_assistant_enabled) { if (Global.held_modified == Keys.LControlKey || Global.held_modified == Keys.RControlKey) { if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).shortcuts_assistant_bim_bg) { sc_assistant_layer.Fill(Color.FromArgb(169, 0, 0, 0)); } if (Global.held_modified == Keys.LControlKey) { sc_assistant_layer.Set(Devices.DeviceKeys.LEFT_CONTROL, (Global.Configuration.desktop_profile.Settings as DesktopSettings).ctrl_key_color); } else { sc_assistant_layer.Set(Devices.DeviceKeys.RIGHT_CONTROL, (Global.Configuration.desktop_profile.Settings as DesktopSettings).ctrl_key_color); } sc_assistant_layer.Set((Global.Configuration.desktop_profile.Settings as DesktopSettings).ctrl_key_sequence, (Global.Configuration.desktop_profile.Settings as DesktopSettings).ctrl_key_color); } else if (Global.held_modified == Keys.LMenu || Global.held_modified == Keys.RMenu) { if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).shortcuts_assistant_bim_bg) { sc_assistant_layer.Fill(Color.FromArgb(169, 0, 0, 0)); } if (Global.held_modified == Keys.LMenu) { sc_assistant_layer.Set(Devices.DeviceKeys.LEFT_ALT, (Global.Configuration.desktop_profile.Settings as DesktopSettings).alt_key_color); } else { sc_assistant_layer.Set(Devices.DeviceKeys.RIGHT_ALT, (Global.Configuration.desktop_profile.Settings as DesktopSettings).alt_key_color); } sc_assistant_layer.Set((Global.Configuration.desktop_profile.Settings as DesktopSettings).alt_key_sequence, (Global.Configuration.desktop_profile.Settings as DesktopSettings).alt_key_color); } else if (Global.held_modified == Keys.LWin || Global.held_modified == Keys.RWin) { if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).shortcuts_assistant_bim_bg) { sc_assistant_layer.Fill(Color.FromArgb(169, 0, 0, 0)); } if (Global.held_modified == Keys.LWin) { sc_assistant_layer.Set(Devices.DeviceKeys.LEFT_WINDOWS, (Global.Configuration.desktop_profile.Settings as DesktopSettings).win_key_color); } else { sc_assistant_layer.Set(Devices.DeviceKeys.RIGHT_WINDOWS, (Global.Configuration.desktop_profile.Settings as DesktopSettings).win_key_color); } sc_assistant_layer.Set((Global.Configuration.desktop_profile.Settings as DesktopSettings).win_key_sequence, (Global.Configuration.desktop_profile.Settings as DesktopSettings).win_key_color); } } layers.Enqueue(sc_assistant_layer); frame.AddLayers(layers.ToArray()); }
public override void UpdateLights(EffectFrame frame) { currenttime = Utils.Time.GetMillisecondsSinceEpoch(); Queue <EffectLayer> layers = new Queue <EffectLayer>(); //update background if ((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).bg_enabled) { EffectLayer bg_layer = new EffectLayer("Payday 2 - Background"); Color bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).ambient_color; if ((level_phase == LevelPhase.Assault || level_phase == LevelPhase.Winters) && game_state == GameStates.Ingame) { if (level_phase == LevelPhase.Assault) { bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).assault_color; } else if (level_phase == LevelPhase.Winters) { bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).winters_color; } double blend_percent = Math.Pow(Math.Sin(((currenttime % 1300L) / 1300.0D) * (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).assault_speed_mult * 2.0D * Math.PI), 2.0D); bg_color = Utils.ColorUtils.BlendColors((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).assault_fade_color, bg_color, blend_percent); if ((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).assault_animation_enabled) { Color effect_contours = Color.FromArgb(200, Color.Black); float animation_stage_yoffset = 20.0f; float animation_repeat_keyframes = 250.0f; //Effects.canvas_width * 2.0f; /* Effect visual: * * / / ---- / / * */ EffectColorFunction line1_col_func = new EffectColorFunction( new EffectLine(-1f, Effects.canvas_width + assault_yoffset + animation_stage_yoffset), new ColorSpectrum(effect_contours), 2); EffectColorFunction line2_col_func = new EffectColorFunction( new EffectLine(-1f, Effects.canvas_width + assault_yoffset + 9.0f + animation_stage_yoffset), new ColorSpectrum(effect_contours), 2); EffectColorFunction line3_col_func = new EffectColorFunction( new EffectLine(new EffectPoint(Effects.canvas_width + assault_yoffset + 17.0f + animation_stage_yoffset, Effects.canvas_height / 2.0f), new EffectPoint(Effects.canvas_width + assault_yoffset + 34.0f + animation_stage_yoffset, Effects.canvas_height / 2.0f), true), new ColorSpectrum(effect_contours), 6); EffectColorFunction line4_col_func = new EffectColorFunction( new EffectLine(-1f, Effects.canvas_width + assault_yoffset + 52.0f + animation_stage_yoffset), new ColorSpectrum(effect_contours), 2); EffectColorFunction line5_col_func = new EffectColorFunction( new EffectLine(-1f, Effects.canvas_width + assault_yoffset + 61.0f + animation_stage_yoffset), new ColorSpectrum(effect_contours), 2); assault_yoffset -= 0.50f; assault_yoffset = assault_yoffset % animation_repeat_keyframes; bg_layer.AddPostFunction(line1_col_func); bg_layer.AddPostFunction(line2_col_func); //bg_layer.AddPostFunction(line3_col_func); bg_layer.AddPostFunction(line4_col_func); bg_layer.AddPostFunction(line5_col_func); } bg_layer.Fill(bg_color); if ((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).bg_peripheral_use) { bg_layer.Set(Devices.DeviceKeys.Peripheral, bg_color); } } else if (level_phase == LevelPhase.Stealth && game_state == GameStates.Ingame) { if ((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).bg_show_suspicion) { double percentSuspicious = ((double)suspicion_amount / (double)1.0); ColorSpectrum suspicion_spec = new ColorSpectrum((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).low_suspicion_color, (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).high_suspicion_color); suspicion_spec.SetColorAt(0.5f, (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).medium_suspicion_color); Settings.KeySequence suspicionSequence = new Settings.KeySequence(new Settings.FreeFormObject(0, 0, 1.0f / (Effects.editor_to_canvas_width / Effects.canvas_width), 1.0f / (Effects.editor_to_canvas_height / Effects.canvas_height))); bg_layer.PercentEffect(suspicion_spec, suspicionSequence, percentSuspicious, 1.0D, (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).suspicion_effect_type); if ((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).bg_peripheral_use) { bg_layer.Set(Devices.DeviceKeys.Peripheral, suspicion_spec.GetColorAt((float)percentSuspicious)); } } } else if (level_phase == LevelPhase.Point_of_no_return && game_state == GameStates.Ingame) { ColorSpectrum no_return_spec = new ColorSpectrum(Color.Red, Color.Yellow); Color no_return_color = no_return_spec.GetColorAt(no_return_flashamount); no_return_flashamount -= 0.05f; if (no_return_flashamount < 0.0f) { no_return_flashamount = 0.0f; } bg_layer.Fill(no_return_color); if ((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).bg_peripheral_use) { bg_layer.Set(Devices.DeviceKeys.Peripheral, no_return_color); } } else { bg_layer.Fill(bg_color); if ((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).bg_peripheral_use) { bg_layer.Set(Devices.DeviceKeys.Peripheral, bg_color); } } layers.Enqueue(bg_layer); } if (game_state == GameStates.Ingame) { if ( player_state == PlayerState.Mask_Off || player_state == PlayerState.Standard || player_state == PlayerState.Jerry1 || player_state == PlayerState.Jerry2 || player_state == PlayerState.Tased || player_state == PlayerState.Bipod || player_state == PlayerState.Carry ) { //Update Health EffectLayer hpbar_layer = new EffectLayer("Payday 2 - HP Bar"); if ((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).health_enabled) { hpbar_layer.PercentEffect((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).healthy_color, (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).hurt_color, (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).health_sequence, (double)health, (double)health_max, (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).health_effect_type); } layers.Enqueue(hpbar_layer); //Update Health EffectLayer ammobar_layer = new EffectLayer("Payday 2 - Ammo Bar"); if ((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).ammo_enabled) { hpbar_layer.PercentEffect((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).ammo_color, (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).noammo_color, (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).ammo_sequence, (double)clip, (double)clip_max, (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).ammo_effect_type); } layers.Enqueue(ammobar_layer); } else if (player_state == PlayerState.Incapacitated || player_state == PlayerState.Bleed_out || player_state == PlayerState.Fatal) { int incapAlpha = (int)(down_time > 10 ? 0 : 255 * (1.0D - (double)down_time / 10.0D)); if (incapAlpha > 255) { incapAlpha = 255; } else if (incapAlpha < 0) { incapAlpha = 0; } Color incapColor = Color.FromArgb(incapAlpha, (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).downed_color); EffectLayer incap_layer = new EffectLayer("Payday 2 - Incapacitated", incapColor); incap_layer.Set(Devices.DeviceKeys.Peripheral, incapColor); layers.Enqueue(incap_layer); } else if (player_state == PlayerState.Arrested) { Color arrstedColor = (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).arrested_color; EffectLayer arrested_layer = new EffectLayer("Payday 2 - Arrested", arrstedColor); arrested_layer.Set(Devices.DeviceKeys.Peripheral, arrstedColor); layers.Enqueue(arrested_layer); } if (isSwanSong && (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).swansong_enabled) { EffectLayer swansong_layer = new EffectLayer("Payday 2 - Swansong"); double blend_percent = Math.Pow(Math.Cos((currenttime % 1300L) / 1300.0D * (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).swansong_speed_mult * 2.0D * Math.PI), 2.0D); Color swansongColor = Utils.ColorUtils.MultiplyColorByScalar((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).swansong_color, blend_percent); swansong_layer.Fill(swansongColor); if ((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).bg_peripheral_use) { swansong_layer.Set(Devices.DeviceKeys.Peripheral, swansongColor); } layers.Enqueue(swansong_layer); } //Update Flashed if (flashbang_amount > 0) { EffectLayer flashed_layer = new EffectLayer("Payday 2 - Flashed"); Color flash_color = Utils.ColorUtils.MultiplyColorByScalar(Color.White, flashbang_amount); flashed_layer.Fill(flash_color); layers.Enqueue(flashed_layer); } } //ColorZones EffectLayer cz_layer = new EffectLayer("Payday 2 - Color Zones"); cz_layer.DrawColorZones((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).lighting_areas.ToArray()); layers.Enqueue(cz_layer); //Scripts Global.Configuration.ApplicationProfiles[profilename].UpdateEffectScripts(layers, _game_state); frame.AddLayers(layers.ToArray()); lasttime = currenttime; }
public override void UpdateLights(EffectFrame frame) { Queue <EffectLayer> layers = new Queue <EffectLayer>(); //update background if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bg_team_enabled) { EffectLayer bg_layer = new EffectLayer("CSGO - Background"); Color bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ambient_color; if (current_team == PlayerTeam.T) { bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).t_color; } else if (current_team == PlayerTeam.CT) { bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ct_color; } if (current_team != PlayerTeam.Undefined) { if (dim_bg_at <= general_timer.ElapsedMilliseconds) { isDimming = true; bg_color = Utils.ColorUtils.MultiplyColorByScalar(bg_color, getDimmingValue()); } else { isDimming = false; dim_value = 1.0; } } bg_layer.Fill(bg_color); if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bg_peripheral_use) { bg_layer.Set(Devices.DeviceKeys.Peripheral, bg_color); } layers.Enqueue(bg_layer); } //Not initialized if (current_team != PlayerTeam.Undefined) { //Update Health EffectLayer hpbar_layer = new EffectLayer("CSGO - HP Bar"); if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).health_enabled) { hpbar_layer.PercentEffect((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).healthy_color, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).hurt_color, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).health_sequence, (double)health, (double)health_max, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).health_effect_type); } layers.Enqueue(hpbar_layer); //Update Ammo EffectLayer ammobar_layer = new EffectLayer("CSGO - Ammo Bar"); if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ammo_enabled) { ammobar_layer.PercentEffect((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ammo_color, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).noammo_color, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ammo_sequence, (double)clip, (double)clip_max, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ammo_effect_type); } layers.Enqueue(ammobar_layer); //Update Bomb if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_enabled) { EffectLayer bomb_effect_layer = new EffectLayer("CSGO - Bomb Effect"); Devices.DeviceKeys[] _bombkeys = (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_sequence.keys.ToArray(); if (bombstate == BombState.Planted) { if (!bombtimer.IsRunning) { bombtimer.Restart(); bombflashcount = 0; bombflashtime = 0; bombflashedat = 0; } double bombflashamount = 1.0; bool isCritical = false; if (bombtimer.ElapsedMilliseconds < 38000) { if (bombtimer.ElapsedMilliseconds >= bombflashtime) { bombflash = true; bombflashedat = bombtimer.ElapsedMilliseconds; bombflashtime = bombtimer.ElapsedMilliseconds + (1000 - (bombflashcount++ *13)); } bombflashamount = Math.Pow(Math.Sin((bombtimer.ElapsedMilliseconds - bombflashedat) / 80.0 + 0.25), 2.0); } else if (bombtimer.ElapsedMilliseconds >= 38000) { isCritical = true; bombflashamount = (double)bombtimer.ElapsedMilliseconds / 40000.0; } else if (bombtimer.ElapsedMilliseconds >= 45000) { bombtimer.Stop(); bombstate = BombState.Undefined; } if (!isCritical) { if (bombflashamount <= 0.05 && bombflash) { bombflash = false; } if (!bombflash) { bombflashamount = 0.0; } } if (!(Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_gradual) { bombflashamount = Math.Round(bombflashamount); } foreach (Devices.DeviceKeys key in _bombkeys) { if (isCritical) { Color bombcolor_critical = Utils.ColorUtils.MultiplyColorByScalar((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_primed_color, Math.Min(bombflashamount, 1.0)); bomb_effect_layer.Set(key, bombcolor_critical); if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_peripheral_use) { bomb_effect_layer.Set(Devices.DeviceKeys.Peripheral, bombcolor_critical); } } else { Color bombcolor = Utils.ColorUtils.MultiplyColorByScalar((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_flash_color, Math.Min(bombflashamount, 1.0)); bomb_effect_layer.Set(key, bombcolor); if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_peripheral_use) { bomb_effect_layer.Set(Devices.DeviceKeys.Peripheral, bombcolor); } } } } else if (bombstate == BombState.Defused) { bombtimer.Stop(); if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_display_winner_color) { foreach (Devices.DeviceKeys key in _bombkeys) { bomb_effect_layer.Set(key, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ct_color); } if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_peripheral_use) { bomb_effect_layer.Set(Devices.DeviceKeys.Peripheral, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ct_color); } } } else if (bombstate == BombState.Exploded) { bombtimer.Stop(); if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_display_winner_color) { foreach (Devices.DeviceKeys key in _bombkeys) { bomb_effect_layer.Set(key, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).t_color); } if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_peripheral_use) { bomb_effect_layer.Set(Devices.DeviceKeys.Peripheral, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).t_color); } } } else { bombtimer.Stop(); } layers.Enqueue(bomb_effect_layer); } } //Kills Indicator if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).kills_indicator && isLocal) { EffectLayer kills_indicator_layer = new EffectLayer("CSGO - Kills Indicator"); Devices.DeviceKeys[] _killsKeys = (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).kills_sequence.keys.ToArray(); for (int pos = 0; pos < _killsKeys.Length; pos++) { if (pos < roundKills.Count) { switch (roundKills[pos]) { case (RoundKillType.Regular): kills_indicator_layer.Set(_killsKeys[pos], (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).kills_regular_color); break; case (RoundKillType.Headshot): kills_indicator_layer.Set(_killsKeys[pos], (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).kills_headshot_color); break; } } } layers.Enqueue(kills_indicator_layer); } //ColorZones EffectLayer cz_layer = new EffectLayer("CSGO - Color Zones"); cz_layer.DrawColorZones((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).lighting_areas.ToArray()); layers.Enqueue(cz_layer); //Update Burning if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).burning_enabled && burnamount > 0) { EffectLayer burning_layer = new EffectLayer("CSGO - Burning"); double burning_percent = (double)burnamount / 255.0; Color burncolor = (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).burning_color; if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).burning_animation) { int red_adjusted = (int)((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).burning_color.R + (Math.Cos((general_timer.ElapsedMilliseconds + randomizer.Next(75)) / 75.0) * 0.15 * 255)); byte red = 0; if (red_adjusted > 255) { red = 255; } else if (red_adjusted < 0) { red = 0; } else { red = (byte)red_adjusted; } int green_adjusted = (int)((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).burning_color.G + (Math.Sin((general_timer.ElapsedMilliseconds + randomizer.Next(150)) / 75.0) * 0.15 * 255)); byte green = 0; if (green_adjusted > 255) { green = 255; } else if (green_adjusted < 0) { green = 0; } else { green = (byte)green_adjusted; } int blue_adjusted = (int)((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).burning_color.B + (Math.Cos((general_timer.ElapsedMilliseconds + randomizer.Next(225)) / 75.0) * 0.15 * 255)); byte blue = 0; if (blue_adjusted > 255) { blue = 255; } else if (blue_adjusted < 0) { blue = 0; } else { blue = (byte)blue_adjusted; } burncolor = Color.FromArgb(burnamount, red, green, blue); } burning_layer.Fill(burncolor); if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).burning_peripheral_use) { burning_layer.Set(Devices.DeviceKeys.Peripheral, burncolor); } layers.Enqueue(burning_layer); } //Update Flashed if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).flashbang_enabled && flashamount > 0) { EffectLayer flashed_layer = new EffectLayer("CSGO - Flashed"); double flash_percent = (double)flashamount / 255.0; Color flash_color = Color.FromArgb(flashamount, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).flash_color); flashed_layer.Fill(flash_color); if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).flashbang_peripheral_use) { flashed_layer.Set(Devices.DeviceKeys.Peripheral, flash_color); } layers.Enqueue(flashed_layer); } //Update Typing Keys if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).typing_enabled && current_activity == PlayerActivity.TextInput) { EffectLayer typing_keys_layer = new EffectLayer("CSGO - Typing Keys"); Devices.DeviceKeys[] _typingkeys = (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).typing_sequence.keys.ToArray(); foreach (Devices.DeviceKeys key in _typingkeys) { typing_keys_layer.Set(key, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).typing_color); } layers.Enqueue(typing_keys_layer); } if (general_timer.Elapsed.Seconds % this.updateRate == 0 && (general_timer.Elapsed.Seconds != this.lastUpdate)) { this.lastUpdate = general_timer.Elapsed.Seconds; } //Scripts Global.Configuration.ApplicationProfiles[profilename].UpdateEffectScripts(layers, _game_state); frame.AddLayers(layers.ToArray()); }
public override void UpdateLights(EffectFrame frame) { Queue <EffectLayer> layers = new Queue <EffectLayer>(); Process[] process_search = Process.GetProcessesByName("RocketLeague"); if (process_search.Length != 0) { using (MemoryReader memread = new MemoryReader(process_search[0])) { team = memread.ReadInt(pointers.Team.baseAddress, pointers.Team.pointers); team1_score = memread.ReadInt(pointers.Orange_score.baseAddress, pointers.Orange_score.pointers); //Orange Team team2_score = memread.ReadInt(pointers.Blue_score.baseAddress, pointers.Blue_score.pointers); //Blue Team boost_amount = memread.ReadFloat(pointers.Boost_amount.baseAddress, pointers.Boost_amount.pointers); } } if ((Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_enabled) { EffectLayer bg_layer = new EffectLayer("Rocket League - Background"); if (GameEvent_RocketLeague.team == 1 && (Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_use_team_color) { bg_layer.Fill((Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_team_1); } else if (GameEvent_RocketLeague.team == 0 && (Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_use_team_color) { bg_layer.Fill((Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_team_2); } else { bg_layer.Fill((Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_ambient_color); } if ((Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_show_team_score_split) { if (team1_score != 0 || team2_score != 0) { int total_score = team1_score + team2_score; LinearGradientBrush the__split_brush = new LinearGradientBrush( new Point(0, 0), new Point(Effects.canvas_biggest, 0), Color.Red, Color.Red); Color[] colors = new Color[] { (Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_team_1, //Orange (Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_team_1, //Orange "Line" (Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_team_2, //Blue "Line" (Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_team_2 //Blue }; int num_colors = colors.Length; float[] blend_positions = new float[num_colors]; if (team1_score > team2_score) { blend_positions[0] = 0.0f; blend_positions[1] = ((float)team1_score / (float)total_score) - 0.01f; blend_positions[2] = ((float)team1_score / (float)total_score) + 0.01f; blend_positions[3] = 1.0f; } else if (team1_score < team2_score) { blend_positions[0] = 0.0f; blend_positions[1] = (1.0f - ((float)team2_score / (float)total_score)) - 0.01f; blend_positions[2] = (1.0f - ((float)team2_score / (float)total_score)) + 0.01f; blend_positions[3] = 1.0f; } else { blend_positions[0] = 0.0f; blend_positions[1] = 0.49f; blend_positions[2] = 0.51f; blend_positions[3] = 1.0f; } ColorBlend color_blend = new ColorBlend(); color_blend.Colors = colors; color_blend.Positions = blend_positions; the__split_brush.InterpolationColors = color_blend; bg_layer.Fill(the__split_brush); } } layers.Enqueue(bg_layer); } if ((Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).boost_enabled) { EffectLayer boost_layer = new EffectLayer("Rocket League - Boost Indicator"); double percentOccupied = boost_amount; ColorSpectrum boost_spec = new ColorSpectrum((Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).boost_low, (Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).boost_high); boost_spec.SetColorAt(0.75f, (Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).boost_mid); boost_layer.PercentEffect(boost_spec, (Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).boost_sequence, percentOccupied, 1.0D, PercentEffectType.Progressive_Gradual); if ((Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).boost_peripheral_use) { boost_layer.Set(Devices.DeviceKeys.Peripheral, boost_spec.GetColorAt((float)Math.Round(percentOccupied, 1))); } layers.Enqueue(boost_layer); } //ColorZones EffectLayer cz_layer = new EffectLayer("Rocket League - Color Zones"); cz_layer.DrawColorZones((Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).lighting_areas.ToArray()); layers.Enqueue(cz_layer); //Scripts Global.Configuration.ApplicationProfiles[profilename].UpdateEffectScripts(layers); frame.AddLayers(layers.ToArray()); }
public override EffectLayer Render(IGameState state) { EffectLayer bg_layer = new EffectLayer("Payday 2 - Background"); if (state is GameState_PD2) { GameState_PD2 pd2 = (GameState_PD2)state; Color bg_color = Properties.AmbientColor; long currenttime = Utils.Time.GetMillisecondsSinceEpoch(); if ((pd2.Level.Phase == LevelPhase.Assault || pd2.Level.Phase == LevelPhase.Winters) && pd2.Game.State == GameStates.Ingame) { if (pd2.Level.Phase == LevelPhase.Assault) { bg_color = Properties.AssaultColor; } else if (pd2.Level.Phase == LevelPhase.Winters) { bg_color = Properties.WintersColor; } double blend_percent = Math.Pow(Math.Sin(((currenttime % 1300L) / 1300.0D) * Properties.AssaultSpeedMultiplier * 2.0D * Math.PI), 2.0D); bg_color = Utils.ColorUtils.BlendColors(Properties.AssaultFadeColor, bg_color, blend_percent); if (Properties.AssaultAnimationEnabled) { Color effect_contours = Color.FromArgb(200, Color.Black); float animation_stage_yoffset = 20.0f; float animation_repeat_keyframes = 250.0f; //Effects.canvas_width * 2.0f; /* Effect visual: * * / / ---- / / * */ /* * !!!NOTE: TO BE REWORKED INTO ANIMATIONS!!! * * EffectColorFunction line1_col_func = new EffectColorFunction( * new EffectLine(-1f, Effects.canvas_width + assault_yoffset + animation_stage_yoffset), * new ColorSpectrum(effect_contours), * 2); * * EffectColorFunction line2_col_func = new EffectColorFunction( * new EffectLine(-1f, Effects.canvas_width + assault_yoffset + 9.0f + animation_stage_yoffset), * new ColorSpectrum(effect_contours), * 2); * * EffectColorFunction line3_col_func = new EffectColorFunction( * new EffectLine(new EffectPoint(Effects.canvas_width + assault_yoffset + 17.0f + animation_stage_yoffset, Effects.canvas_height / 2.0f), new EffectPoint(Effects.canvas_width + assault_yoffset + 34.0f + animation_stage_yoffset, Effects.canvas_height / 2.0f), true), * new ColorSpectrum(effect_contours), * 6); * * EffectColorFunction line4_col_func = new EffectColorFunction( * new EffectLine(-1f, Effects.canvas_width + assault_yoffset + 52.0f + animation_stage_yoffset), * new ColorSpectrum(effect_contours), * 2); * * EffectColorFunction line5_col_func = new EffectColorFunction( * new EffectLine(-1f, Effects.canvas_width + assault_yoffset + 61.0f + animation_stage_yoffset), * new ColorSpectrum(effect_contours), * 2); * * assault_yoffset -= 0.50f; * assault_yoffset = assault_yoffset % animation_repeat_keyframes; * * bg_layer.AddPostFunction(line1_col_func); * bg_layer.AddPostFunction(line2_col_func); * //bg_layer.AddPostFunction(line3_col_func); * bg_layer.AddPostFunction(line4_col_func); * bg_layer.AddPostFunction(line5_col_func); * */ } bg_layer.Fill(bg_color); if (Properties.PeripheralUse) { bg_layer.Set(Devices.DeviceKeys.Peripheral, bg_color); } } else if (pd2.Level.Phase == LevelPhase.Stealth && pd2.Game.State == GameStates.Ingame) { if (Properties.ShowSuspicion) { double percentSuspicious = ((double)pd2.Players.LocalPlayer.SuspicionAmount / (double)1.0); ColorSpectrum suspicion_spec = new ColorSpectrum(Properties.LowSuspicionColor, Properties.HighSuspicionColor); suspicion_spec.SetColorAt(0.5f, Properties.MediumSuspicionColor); Settings.KeySequence suspicionSequence = new Settings.KeySequence(new Settings.FreeFormObject(0, 0, 1.0f / (Effects.editor_to_canvas_width / Effects.canvas_width), 1.0f / (Effects.editor_to_canvas_height / Effects.canvas_height))); bg_layer.PercentEffect(suspicion_spec, suspicionSequence, percentSuspicious, 1.0D, Properties.SuspicionEffectType); if (Properties.PeripheralUse) { bg_layer.Set(Devices.DeviceKeys.Peripheral, suspicion_spec.GetColorAt((float)percentSuspicious)); } } } else if (pd2.Level.Phase == LevelPhase.Point_of_no_return && pd2.Game.State == GameStates.Ingame) { ColorSpectrum no_return_spec = new ColorSpectrum(Color.Red, Color.Yellow); if (pd2.Level.NoReturnTime != no_return_timeleft) { no_return_timeleft = pd2.Level.NoReturnTime; no_return_flashamount = 1.0f; } Color no_return_color = no_return_spec.GetColorAt(no_return_flashamount); no_return_flashamount -= 0.05f; if (no_return_flashamount < 0.0f) { no_return_flashamount = 0.0f; } bg_layer.Fill(no_return_color); if (Properties.PeripheralUse) { bg_layer.Set(Devices.DeviceKeys.Peripheral, no_return_color); } } else { bg_layer.Fill(bg_color); if (Properties.PeripheralUse) { bg_layer.Set(Devices.DeviceKeys.Peripheral, bg_color); } } } return(bg_layer); }