Skip to content

Commit

Permalink
Implemented pets, and Hat 103
Browse files Browse the repository at this point in the history
  • Loading branch information
CarbonNeuron committed Jan 20, 2021
1 parent d586e59 commit e52952a
Show file tree
Hide file tree
Showing 20 changed files with 112 additions and 2 deletions.
28 changes: 28 additions & 0 deletions AUCapture-WPF/AUCapture-WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>

<ItemGroup>
<None Remove="Resources\Hats\103-1.png" />
<None Remove="Resources\Hats\94-1.png" />
<None Remove="Resources\Pets\1.png" />
<None Remove="Resources\Pets\10.png" />
<None Remove="Resources\Pets\11.png" />
<None Remove="Resources\Pets\2.png" />
<None Remove="Resources\Pets\3.png" />
<None Remove="Resources\Pets\4.png" />
<None Remove="Resources\Pets\5.png" />
<None Remove="Resources\Pets\6.png" />
<None Remove="Resources\Pets\7.png" />
<None Remove="Resources\Pets\8.png" />
<None Remove="Resources\Pets\9.png" />
</ItemGroup>

<ItemGroup>
<TrimmerRootAssembly Include="System.Runtime" />
<TrimmerRootAssembly Include="System.Runtime.Extensions" />
Expand Down Expand Up @@ -174,6 +190,7 @@
<Resource Include="Resources\Hats\91-1.png" />
<Resource Include="Resources\Hats\92-1.png" />
<Resource Include="Resources\Hats\93-1.png" />
<Resource Include="Resources\Hats\94-1.png" />
<Resource Include="Resources\Pants\0.png" />
<Resource Include="Resources\Pants\1.png" />
<Resource Include="Resources\Pants\10.png" />
Expand All @@ -190,6 +207,17 @@
<Resource Include="Resources\Pants\7.png" />
<Resource Include="Resources\Pants\8.png" />
<Resource Include="Resources\Pants\9.png" />
<Resource Include="Resources\Pets\1.png" />
<Resource Include="Resources\Pets\10.png" />
<Resource Include="Resources\Pets\11.png" />
<Resource Include="Resources\Pets\2.png" />
<Resource Include="Resources\Pets\3.png" />
<Resource Include="Resources\Pets\4.png" />
<Resource Include="Resources\Pets\5.png" />
<Resource Include="Resources\Pets\6.png" />
<Resource Include="Resources\Pets\7.png" />
<Resource Include="Resources\Pets\8.png" />
<Resource Include="Resources\Pets\9.png" />
<Resource Include="Resources\Players\aublack.png" />
<Resource Include="Resources\Players\aublackdead.png" />
<Resource Include="Resources\Players\aublue.png" />
Expand Down
5 changes: 5 additions & 0 deletions AUCapture-WPF/Controls/PlayerControl - No bindings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
../Resources/TestHats/48-1.png
</Image.Source>
</Image>
<Image Margin="0,0,0,0" Stretch="Uniform" VerticalAlignment="Bottom" Width="212" Panel.ZIndex="0">
<Image.Source>
../Resources/Pets/9.png
</Image.Source>
</Image>
</Grid>
</Viewbox>
<Viewbox Grid.Row="0" StretchDirection="DownOnly" Stretch="Uniform" VerticalAlignment="Center">
Expand Down
9 changes: 9 additions & 0 deletions AUCapture-WPF/Controls/PlayerControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<converters1:PantsConverter x:Key="PantsConverter" />
<converters1:HatToImage x:Key="HatToImage" />
<converters1:HatToZ x:Key="HatToZ" />
<converters1:PetToImageConverter x:Key="PetToIm" />
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />

</UserControl.Resources>
Expand Down Expand Up @@ -52,6 +53,14 @@
</MultiBinding>
</Image.Source>
</Image>
<Image Margin="0,0,0,0" Stretch="Uniform" VerticalAlignment="Bottom" Width="212" Panel.ZIndex="0">
<Image.Source>
<MultiBinding Converter="{StaticResource PetToIm}">
<Binding ElementName="PlayerControlWindow" Path="PlayerPetID"></Binding>
<Binding ElementName="PlayerControlWindow" Path="AliveStatus"></Binding>
</MultiBinding>
</Image.Source>
</Image>
</Grid>
</Viewbox>
<Viewbox Grid.ColumnSpan="2" Grid.Row="0" StretchDirection="DownOnly" Stretch="Uniform" VerticalAlignment="Center">
Expand Down
10 changes: 10 additions & 0 deletions AUCapture-WPF/Controls/PlayerControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public partial class PlayerControl : UserControl
DependencyProperty.Register("PlayerHatID",
typeof(uint), typeof(PlayerControl));

public static readonly DependencyProperty PlayerPetDependencyProperty =
DependencyProperty.Register("PlayerPetID",
typeof(uint), typeof(PlayerControl));

public static readonly DependencyProperty PlayerPantsDependencyProperty =
DependencyProperty.Register("PlayerPantsID",
typeof(uint), typeof(PlayerControl));
Expand All @@ -45,6 +49,12 @@ public uint PlayerHatID
get => (uint)GetValue(PlayerHatDependencyProperty);
set => SetValue(PlayerHatDependencyProperty, value);
}

public uint PlayerPetID
{
get => (uint)GetValue(PlayerHatDependencyProperty);
set => SetValue(PlayerHatDependencyProperty, value);
}
public uint PlayerPantsID
{
get => (uint)GetValue(PlayerPantsDependencyProperty);
Expand Down
46 changes: 46 additions & 0 deletions AUCapture-WPF/Converters/PetToImageConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media.Imaging;

namespace AUCapture_WPF.Converters
{
class PetToImageConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
var petID = values[0] as uint? ?? 0;
var alive = values[1] as bool? ?? false;
if (!alive)
{
return new BitmapImage();
}

try
{
return new BitmapImage(new Uri($"pack://application:,,,/Resources/Pets/{petID}.png"));
}
catch (Exception e)
{
try
{
return new BitmapImage();
}
catch (Exception er)
{
return new BitmapImage();
}
}

}

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
2 changes: 1 addition & 1 deletion AUCapture-WPF/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
<DataTemplate>
<controls:PlayerControl PlayerName="{Binding Name}" Color="{Binding Color}"
AliveStatus="{Binding Alive}" PlayerPantsID="{Binding PantsID}"
PlayerHatID="{Binding HatID}" />
PlayerHatID="{Binding HatID}" PlayerPetID="{Binding PetID}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
Expand Down
3 changes: 2 additions & 1 deletion AUCapture-WPF/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,12 @@ private void OnPlayerCosmeticChanged(object? sender, PlayerCosmeticChangedEventA
if (context.Players.Any(x => x.Name == e.Name))
{
var player = context.Players.First(x => x.Name == e.Name);
Console.WriteLine("Cosmetic change");
Console.WriteLine("Cosmetic change "+JsonConvert.SerializeObject(e));
Dispatcher.Invoke((Action) (() =>
{
player.HatID = e.HatId;
player.PantsID = e.SkinId;
player.PetID = e.PetId;
}));
}

Expand Down
11 changes: 11 additions & 0 deletions AUCapture-WPF/Models/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ public uint PantsID

}
}
private uint _petID;
public uint PetID
{
get => _petID;
set
{
_petID = value;
OnPropertyChanged();

}
}
private PlayerColor _color;

public PlayerColor Color
Expand Down
Binary file added AUCapture-WPF/Resources/Hats/94-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AUCapture-WPF/Resources/Pets/1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AUCapture-WPF/Resources/Pets/10.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AUCapture-WPF/Resources/Pets/11.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AUCapture-WPF/Resources/Pets/2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AUCapture-WPF/Resources/Pets/3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AUCapture-WPF/Resources/Pets/4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AUCapture-WPF/Resources/Pets/5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AUCapture-WPF/Resources/Pets/6.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AUCapture-WPF/Resources/Pets/7.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AUCapture-WPF/Resources/Pets/8.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AUCapture-WPF/Resources/Pets/9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e52952a

Please sign in to comment.