public override void UpdateLights(EffectFrame frame) { //Update wrapper lighting UpdateWrapperLights(frame); Queue <EffectLayer> layers = new Queue <EffectLayer>(); //ColorZones EffectLayer cz_layer = new EffectLayer("BF3 - Color Zones"); cz_layer.DrawColorZones((Global.Configuration.ApplicationProfiles[profilename].Settings as BF3Settings).lighting_areas.ToArray()); layers.Enqueue(cz_layer); //Scripts Global.Configuration.ApplicationProfiles[profilename].UpdateEffectScripts(layers, _game_state); frame.AddLayers(layers.ToArray()); }
public override void UpdateLights(EffectFrame frame) { //Update wrapper lighting UpdateWrapperLights(frame); Queue <EffectLayer> layers = new Queue <EffectLayer>(); //ColorZones if (!((Global.Configuration.ApplicationProfiles[profilename].Settings as LoLSettings).disable_cz_on_dark && last_fill_color.Equals(Color.Black))) { EffectLayer cz_layer = new EffectLayer("League - Color Zones"); cz_layer.DrawColorZones((Global.Configuration.ApplicationProfiles[profilename].Settings as LoLSettings).lighting_areas.ToArray()); layers.Enqueue(cz_layer); } //Scripts Global.Configuration.ApplicationProfiles[profilename].UpdateEffectScripts(layers, _game_state); frame.AddLayers(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) { Queue <EffectLayer> layers = new Queue <EffectLayer>(); EffectLayer cz_layer = new EffectLayer("Color Zones"); ColorZone[] zones = { }; if (Global.Configuration.additional_profiles.ContainsKey(profilename)) { if (!(Global.Configuration.nighttime_enabled && Utils.Time.IsCurrentTimeBetween(Global.Configuration.nighttime_start_hour, Global.Configuration.nighttime_start_minute, Global.Configuration.nighttime_end_hour, Global.Configuration.nighttime_end_minute)) ) { zones = (Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).lighting_areas_day.ToArray(); } else { zones = (Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).lighting_areas_night.ToArray(); } } cz_layer.DrawColorZones(zones.ToArray()); layers.Enqueue(cz_layer); //Scripts Global.Configuration.additional_profiles[profilename].UpdateEffectScripts(layers); EffectLayer sc_assistant_layer = new EffectLayer("Shortcut Assistant"); if (Global.Configuration.additional_profiles.ContainsKey(profilename) && (Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).shortcuts_assistant_enabled) { if (Global.held_modified == Keys.LControlKey || Global.held_modified == Keys.RControlKey) { if (Global.held_modified == Keys.LControlKey) { sc_assistant_layer.Set(Devices.DeviceKeys.LEFT_CONTROL, (Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).ctrl_key_color); } else { sc_assistant_layer.Set(Devices.DeviceKeys.RIGHT_CONTROL, (Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).ctrl_key_color); } sc_assistant_layer.Set((Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).ctrl_key_sequence, (Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).ctrl_key_color); } else if (Global.held_modified == Keys.LMenu || Global.held_modified == Keys.RMenu) { if (Global.held_modified == Keys.LMenu) { sc_assistant_layer.Set(Devices.DeviceKeys.LEFT_ALT, (Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).alt_key_color); } else { sc_assistant_layer.Set(Devices.DeviceKeys.RIGHT_ALT, (Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).alt_key_color); } sc_assistant_layer.Set((Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).alt_key_sequence, (Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).alt_key_color); } } layers.Enqueue(sc_assistant_layer); frame.AddLayers(layers.ToArray()); }
public override void UpdateLights(EffectFrame frame) { Queue <EffectLayer> layers = new Queue <EffectLayer>(); if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_color_enabled) { EffectLayer bg_layer = new EffectLayer("GTA 5 - Background"); Color bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_ambient; switch (curr_state) { case PlayerState.PlayingSP_Trevor: bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_trevor; break; case PlayerState.PlayingSP_Franklin: bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_franklin; break; case PlayerState.PlayingSP_Michael: bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_michael; break; case PlayerState.PlayingSP_Chop: bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_chop; break; case PlayerState.PlayingMP: bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_online; break; case PlayerState.PlayingMP_Mission: bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_online_mission; break; case PlayerState.PlayingMP_HeistFinale: bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_online_heistfinale; break; case PlayerState.PlayingMP_Spectator: bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_online_spectator; break; case PlayerState.PlayingRace_Gold: bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_race_gold; break; case PlayerState.PlayingRace_Silver: bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_race_silver; break; case PlayerState.PlayingRace_Bronze: bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_race_bronze; break; default: bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_ambient; break; } bg_layer.Fill(bg_color); if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_peripheral_use) { bg_layer.Set(Devices.DeviceKeys.Peripheral, bg_color); } layers.Enqueue(bg_layer); } if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_enabled && have_cops) { EffectLayer sirens_layer = new EffectLayer("GTA 5 - Police Sirens"); Color lefts = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).left_siren_color; Color rights = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).right_siren_color; KeySequence left_siren_ks = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).left_siren_sequence; KeySequence right_siren_ks = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).right_siren_sequence; //Switch sirens switch ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_type) { case GTA5_PoliceEffects.Alt_Full: switch (siren_keyframe % 2) { case 1: rights = lefts; break; default: lefts = rights; break; } siren_keyframe = siren_keyframe % 2; if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_peripheral_use) { sirens_layer.Set(Devices.DeviceKeys.Peripheral, lefts); } break; case GTA5_PoliceEffects.Alt_Half: switch (siren_keyframe % 2) { case 1: rights = lefts; lefts = Color.Black; if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_peripheral_use) { sirens_layer.Set(Devices.DeviceKeys.Peripheral, rights); } break; default: lefts = rights; rights = Color.Black; if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_peripheral_use) { sirens_layer.Set(Devices.DeviceKeys.Peripheral, lefts); } break; } siren_keyframe = siren_keyframe % 2; break; case GTA5_PoliceEffects.Alt_Full_Blink: switch (siren_keyframe % 4) { case 2: rights = lefts; break; case 0: lefts = rights; break; default: lefts = Color.Black; rights = Color.Black; break; } siren_keyframe = siren_keyframe % 4; if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_peripheral_use) { sirens_layer.Set(Devices.DeviceKeys.Peripheral, lefts); } break; case GTA5_PoliceEffects.Alt_Half_Blink: switch (siren_keyframe % 8) { case 6: rights = lefts; lefts = Color.Black; if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_peripheral_use) { sirens_layer.Set(Devices.DeviceKeys.Peripheral, rights); } break; case 4: rights = lefts; lefts = Color.Black; if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_peripheral_use) { sirens_layer.Set(Devices.DeviceKeys.Peripheral, rights); } break; case 2: lefts = rights; rights = Color.Black; if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_peripheral_use) { sirens_layer.Set(Devices.DeviceKeys.Peripheral, lefts); } break; case 0: lefts = rights; rights = Color.Black; if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_peripheral_use) { sirens_layer.Set(Devices.DeviceKeys.Peripheral, lefts); } break; default: rights = Color.Black; lefts = Color.Black; if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_peripheral_use) { sirens_layer.Set(Devices.DeviceKeys.Peripheral, lefts); } break; } siren_keyframe = siren_keyframe % 8; break; default: switch (siren_keyframe % 2) { case 1: Color tempc = rights; rights = lefts; lefts = tempc; break; default: break; } siren_keyframe = siren_keyframe % 2; if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_peripheral_use) { sirens_layer.Set(Devices.DeviceKeys.Peripheral, lefts); } break; } sirens_layer.Set(left_siren_ks, lefts); sirens_layer.Set(right_siren_ks, rights); layers.Enqueue(sirens_layer); } //ColorZones EffectLayer cz_layer = new EffectLayer("GTA 5 - Color Zones"); cz_layer.DrawColorZones((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).lighting_areas.ToArray()); layers.Enqueue(cz_layer); EffectLayer debug_layer = new EffectLayer("GTA 5 - Debug"); if (special_mode == 16711939) { debug_layer.Set(Devices.DeviceKeys.SPACE, Color.Red); } else if (special_mode == 16775939) { debug_layer.Set(Devices.DeviceKeys.SPACE, Color.Blue); } layers.Enqueue(debug_layer); //Scripts Global.Configuration.ApplicationProfiles[profilename].UpdateEffectScripts(layers, _game_state); 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()); }