Skip to content

Commit

Permalink
Restore Legacy PD2 Layers
Browse files Browse the repository at this point in the history
  • Loading branch information
stuntguy3000 committed Sep 4, 2020
1 parent 7c54cc3 commit 9948521
Show file tree
Hide file tree
Showing 10 changed files with 638 additions and 97 deletions.
23 changes: 0 additions & 23 deletions Project-Aurora/Project-Aurora/Profiles/Payday 2/Control_PD2.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,6 @@
<Button x:Name="install_mod_button" Content="Install GSI for Payday 2" HorizontalAlignment="Left" Margin="10,145,0,0" VerticalAlignment="Top" Click="install_mod_button_Click" Width="160"/>
<CheckBox x:Name="game_enabled" Content="Enable Aurora to provide lighting effects with Payday 2" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Checked="game_enabled_Checked" Unchecked="game_enabled_Checked"/>
</Grid>
</TabItem>
<TabItem Header="Preview">
<Grid>
<Label Content="Level Phase:" HorizontalAlignment="Left" Margin="10,41,0,0" VerticalAlignment="Top"/>
<ComboBox x:Name="preview_levelphase" HorizontalAlignment="Left" Margin="90,43,0,0" VerticalAlignment="Top" Width="200" IsSynchronizedWithCurrentItem="True" SelectedIndex="0" ItemsSource="{u:EnumToItemsSource {x:Type e:LevelPhase}}" DisplayMemberPath="Text" SelectedValuePath="Value" SelectionChanged="preview_levelphase_SelectionChanged"/>
<Label Content="Health:" HorizontalAlignment="Left" Margin="10,103,0,0" VerticalAlignment="Top"/>
<Slider x:Name="preview_health_slider" HorizontalAlignment="Left" Margin="62,107,0,0" VerticalAlignment="Top" Width="114" Maximum="100" SmallChange="1" ValueChanged="preview_health_slider_ValueChanged"/>
<Label x:Name="preview_health_amount" Content="0%" HorizontalAlignment="Left" Margin="181,103,0,0" VerticalAlignment="Top"/>
<Label Content="Ammo:" HorizontalAlignment="Left" Margin="10,134,0,0" VerticalAlignment="Top"/>
<Slider x:Name="preview_ammo_slider" HorizontalAlignment="Left" Margin="62,138,0,0" VerticalAlignment="Top" Width="114" Maximum="100" SmallChange="1" ValueChanged="preview_ammo_slider_ValueChanged"/>
<Label x:Name="preview_ammo_amount" Content="0%" HorizontalAlignment="Left" Margin="181,134,0,0" VerticalAlignment="Top"/>
<Label Content="Suspicion:" HorizontalAlignment="Left" Margin="10,165,0,0" VerticalAlignment="Top"/>
<Slider x:Name="preview_suspicion_slider" HorizontalAlignment="Left" Margin="78,169,0,0" VerticalAlignment="Top" Width="98" Maximum="100" SmallChange="1" ValueChanged="preview_suspicion_slider_ValueChanged"/>
<Label x:Name="preview_suspicion_amount" Content="0%" HorizontalAlignment="Left" Margin="181,165,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.692,3.115"/>
<Label Content="Player State:" HorizontalAlignment="Left" Margin="10,72,0,0" VerticalAlignment="Top"/>
<ComboBox x:Name="preview_playerstate" HorizontalAlignment="Left" Margin="90,74,0,0" VerticalAlignment="Top" Width="200" IsSynchronizedWithCurrentItem="True" SelectedIndex="0" ItemsSource="{u:EnumToItemsSource {x:Type e:PlayerState}}" DisplayMemberPath="Text" SelectedValuePath="Value" SelectionChanged="preview_playerstate_SelectionChanged"/>
<CheckBox x:Name="preview_swansong" Content="Is player in Swan Song" HorizontalAlignment="Left" Margin="13,196,0,0" VerticalAlignment="Top" Checked="preview_swansong_Checked" Unchecked="preview_swansong_Checked"/>
<Label Content="Flashbang amount:" HorizontalAlignment="Left" Margin="10,216,0,0" VerticalAlignment="Top"/>
<Slider x:Name="preview_flashbang_slider" HorizontalAlignment="Left" Margin="126,222,0,0" VerticalAlignment="Top" Width="98" Maximum="100" SmallChange="1" ValueChanged="preview_flashbang_slider_ValueChanged"/>
<Label x:Name="preview_flashbang_amount" Content="0%" HorizontalAlignment="Left" Margin="229,218,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.692,3.115"/>
<Label Content="Game State:" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top"/>
<ComboBox x:Name="preview_gamestate" HorizontalAlignment="Left" Margin="90,12,0,0" VerticalAlignment="Top" Width="200" IsSynchronizedWithCurrentItem="True" SelectedIndex="0" ItemsSource="{u:EnumToItemsSource {x:Type e:GameStates}}" DisplayMemberPath="Text" SelectedValuePath="Value" SelectionChanged="preview_gamestate_SelectionChanged"/>
</Grid>
</TabItem>
</TabControl>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,80 +92,6 @@ private void install_mod_button_Click(object sender, RoutedEventArgs e)
}
}

private void preview_gamestate_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (IsLoaded)
{
(profile_manager.Config.Event._game_state as GameState_PD2).Game.State = (GSI.Nodes.GameStates)preview_gamestate.SelectedValue;
}
}

private void preview_levelphase_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (IsLoaded)
{
(profile_manager.Config.Event._game_state as GameState_PD2).Level.Phase = (GSI.Nodes.LevelPhase)preview_levelphase.SelectedValue;
}
}

private void preview_playerstate_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (IsLoaded)
{
(profile_manager.Config.Event._game_state as GameState_PD2).Players.LocalPlayer.State = (GSI.Nodes.PlayerState)preview_playerstate.SelectedValue;
}
}

private void preview_health_slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
int hp_val = (int)this.preview_health_slider.Value;
if (this.preview_health_amount is Label)
{
this.preview_health_amount.Content = hp_val + "%";
(profile_manager.Config.Event._game_state as GameState_PD2).Players.LocalPlayer.Health.Current = hp_val;
(profile_manager.Config.Event._game_state as GameState_PD2).Players.LocalPlayer.Health.Max = 100;
}
}

private void preview_ammo_slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
int ammo_val = (int)this.preview_ammo_slider.Value;
if (this.preview_ammo_amount is Label)
{
this.preview_ammo_amount.Content = ammo_val + "%";
(profile_manager.Config.Event._game_state as GameState_PD2).Players.LocalPlayer.Weapons.SelectedWeapon.Current_Clip = ammo_val;
(profile_manager.Config.Event._game_state as GameState_PD2).Players.LocalPlayer.Weapons.SelectedWeapon.Max_Clip = 100;
}
}

private void preview_suspicion_slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
float susp_val = (float)this.preview_suspicion_slider.Value;
if (this.preview_suspicion_amount is Label)
{
this.preview_suspicion_amount.Content = (int)susp_val + "%";
(profile_manager.Config.Event._game_state as GameState_PD2).Players.LocalPlayer.SuspicionAmount = susp_val / 100.0f;
}
}

private void preview_flashbang_slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
float flash_val = (float)this.preview_flashbang_slider.Value;
if (this.preview_flashbang_amount is Label)
{
this.preview_flashbang_amount.Content = (int)flash_val + "%";
(profile_manager.Config.Event._game_state as GameState_PD2).Players.LocalPlayer.FlashAmount = flash_val / 100.0f;
}
}

private void preview_swansong_Checked(object sender, RoutedEventArgs e)
{
if (IsLoaded && sender is CheckBox && (sender as CheckBox).IsChecked.HasValue)
{
(profile_manager.Config.Event._game_state as GameState_PD2).Players.LocalPlayer.IsSwanSong = (sender as CheckBox).IsChecked.Value;
}
}

private void get_lib_button_Click(object sender, RoutedEventArgs e)
{
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(@"https://modworkshop.net/mod/14924"));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using Aurora.Settings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Aurora.Profiles.Payday_2.Layers
{
/// <summary>
/// Interaction logic for Control_CSGOBackgroundLayer.xaml
/// </summary>
public partial class Control_PD2BackgroundLayer : UserControl
{
private bool settingsset = false;
private bool profileset = false;

public Control_PD2BackgroundLayer()
{
InitializeComponent();
}

public Control_PD2BackgroundLayer(PD2BackgroundLayerHandler datacontext)
{
this.DataContext = datacontext.Properties;
InitializeComponent();
}


internal void SetProfile(Application profile)
{
}

private void UserControl_Loaded(object sender, RoutedEventArgs e)
{

this.Loaded -= UserControl_Loaded;
}

private void sldAssaultSpeed_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
this.lblAssaultSpeed.Content = $"x {sldAssaultSpeed.Value.ToString("0.00")}";
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Aurora.Profiles.Payday_2.Layers"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:Controls="clr-namespace:Aurora.Controls" x:Class="Aurora.Profiles.Payday_2.Layers.Control_PD2FlashbangLayer"
mc:Ignorable="d" Loaded="UserControl_Loaded">
<Grid>
<xctk:ColorPicker x:Name="ColorPicker_Flashbang" Margin="93,0,0,0" Height="20" VerticalAlignment="Top" HorizontalAlignment="Left" Width="151" UsingAlphaChannel="True" ColorMode="ColorCanvas" SelectedColorChanged="ColorPicker_Flashbang_SelectedColorChanged" />
<Label HorizontalAlignment="Left" Padding="0" Content="Flashbang Color:" VerticalAlignment="Top" Margin="0,2,0,0"/>
</Grid>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using Aurora.Settings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Aurora.Profiles.Payday_2.Layers
{
/// <summary>
/// Interaction logic for Control_PD2FlashbangLayer.xaml
/// </summary>
public partial class Control_PD2FlashbangLayer : UserControl
{
private bool settingsset = false;

public Control_PD2FlashbangLayer()
{
InitializeComponent();
}

public Control_PD2FlashbangLayer(PD2FlashbangLayerHandler datacontext)
{
InitializeComponent();

this.DataContext = datacontext;
}

public void SetSettings()
{
if (this.DataContext is PD2FlashbangLayerHandler && !settingsset)
{
this.ColorPicker_Flashbang.SelectedColor = Utils.ColorUtils.DrawingColorToMediaColor((this.DataContext as PD2FlashbangLayerHandler).Properties._FlashbangColor ?? System.Drawing.Color.Empty);

settingsset = true;
}
}

internal void SetProfile(Application profile)
{
}

private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
SetSettings();

this.Loaded -= UserControl_Loaded;
}

private void ColorPicker_Flashbang_SelectedColorChanged(object sender, RoutedPropertyChangedEventArgs<Color?> e)
{
if (IsLoaded && settingsset && this.DataContext is PD2FlashbangLayerHandler && sender is Xceed.Wpf.Toolkit.ColorPicker && (sender as Xceed.Wpf.Toolkit.ColorPicker).SelectedColor.HasValue)
(this.DataContext as PD2FlashbangLayerHandler).Properties._FlashbangColor = Utils.ColorUtils.MediaColorToDrawingColor((sender as Xceed.Wpf.Toolkit.ColorPicker).SelectedColor.Value);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using Aurora.Settings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Aurora.Profiles.Payday_2.Layers
{
/// <summary>
/// Interaction logic for Control_PD2StatesLayer.xaml
/// </summary>
public partial class Control_PD2StatesLayer : UserControl
{
private bool settingsset = false;
private bool profileset = false;

public Control_PD2StatesLayer()
{
InitializeComponent();
}

public Control_PD2StatesLayer(PD2StatesLayerHandler datacontext)
{
this.DataContext = datacontext.Properties;
InitializeComponent();
}


internal void SetProfile(Application profile)
{
}

private void UserControl_Loaded(object sender, RoutedEventArgs e)
{

this.Loaded -= UserControl_Loaded;
}

private void sldSwanSongSpeed_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
this.lblSwanSongSpeed.Content = $"x {sldSwanSongSpeed.Value.ToString("0.00")}";
}
}
}
Loading

0 comments on commit 9948521

Please sign in to comment.