Skip to content

Commit

Permalink
Fixed UI Background and sizing
Browse files Browse the repository at this point in the history
  • Loading branch information
VeXHarbinger committed Nov 30, 2018
1 parent b1e35e8 commit f993058
Show file tree
Hide file tree
Showing 19 changed files with 162 additions and 147 deletions.
6 changes: 6 additions & 0 deletions DrawPool/Core/DrawPoolHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@
using Card = Hearthstone_Deck_Tracker.Hearthstone.Card;
using Core = Hearthstone_Deck_Tracker.API.Core;

/// <summary>
/// Available Card(s) Helper(s)
/// </summary>
public static class DrawPoolHelpers
{



/// <summary>
/// Fixes the card's "Is Created" indicator and merges them into one big pile.
/// </summary>
Expand Down
5 changes: 3 additions & 2 deletions DrawPool/Core/IRecruit.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
namespace DrawPool
{
using Core = Hearthstone_Deck_Tracker.API.Core;

/// <summary>
/// Interface for the Recruit mechanic, as opposed to a card draw
/// </summary>
public interface IRecruit
{
string MechanicId { get; set; }
Expand Down
6 changes: 3 additions & 3 deletions DrawPool/Core/Views.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
public enum ViewModes
{
/// <summary>
/// The Witchwood Piper
/// The Options Config
/// </summary>
Options = 0,

/// <summary>
/// The Witchwood Piper
/// The Elven Minstrel DrawPool
/// </summary>
ElvenMinstrel = 1,

/// <summary>
/// The Witchwood Piper
/// The Witchwood Piper DrawPool
/// </summary>
WitchWoodPiper = 2
}
Expand Down
20 changes: 11 additions & 9 deletions DrawPool/DisplayControl.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
namespace DrawPool
using System;
using System.Windows.Controls;
using Card = Hearthstone_Deck_Tracker.Hearthstone.Card;
using Core = Hearthstone_Deck_Tracker.API.Core;
using Helper = Hearthstone_Deck_Tracker.Helper;

namespace DrawPool
{
using System;
using System.Windows.Controls;
using Card = Hearthstone_Deck_Tracker.Hearthstone.Card;
using Core = Hearthstone_Deck_Tracker.API.Core;
using Helper = Hearthstone_Deck_Tracker.Helper;


/// <summary>
/// The Possible Draw List Display Control
Expand All @@ -29,17 +31,17 @@ public partial class DisplayControl : UserControl
/// <value>
/// The deck hash.
/// </value>
public int DeckHash => Core.Game.Player.Deck.GetHashCode();
public int DeckHash => Hearthstone_Deck_Tracker.API.Core.Game.Player.Deck.GetHashCode();

/// <summary>
/// Checks if the deck has changed, since the last check..
/// </summary>
/// <returns>True, if the deck has changed, since the last check.</returns>
internal bool CheckDeckChanged()
{
if (deckHash != Core.Game.Player.Deck.GetHashCode())
if (deckHash != Hearthstone_Deck_Tracker.API.Core.Game.Player.Deck.GetHashCode())
{
deckHash = Core.Game.Player.Deck.GetHashCode();
deckHash = Hearthstone_Deck_Tracker.API.Core.Game.Player.Deck.GetHashCode();
return true;
}
else
Expand Down
24 changes: 15 additions & 9 deletions DrawPool/DisplayControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:props="clr-namespace:DrawPool.Properties"
xmlns:themes="clr-namespace:Hearthstone_Deck_Tracker.Utility.Themes;assembly=HearthstoneDeckTracker"
Width="Auto"
Height="Auto"
VerticalAlignment="Top"
FontStretch="Normal"
FontFamily="pack://application:,,,/HearthstoneDeckTracker;component/Resources/#Chunkfive"
FontSize="20"
Grid.IsSharedSizeScope="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
TextOptions.TextFormattingMode="Display"
TextOptions.TextHintingMode="Fixed"
Visibility="Collapsed"
mc:Ignorable="d">
<UserControl.Background>
<SolidColorBrush Opacity="{Binding Source={x:Static props:Settings.Default}, Path=Opacity, Mode=OneWay}" Color="Gray" />
</UserControl.Background>
<UserControl.Resources>
<Style TargetType="Label">
<Setter Property="FontStretch" Value="Normal" />
Expand All @@ -35,11 +35,19 @@
<Setter Property="MinWidth" Value="100" />
</Style>
</UserControl.Resources>
<UserControl.Background>
<ImageBrush
AlignmentX="Left"
AlignmentY="Top"
ImageSource="pack://application:,,,/HearthstoneDeckTracker;component/Resources/tactile_noise.png"
TileMode="Tile" />
</UserControl.Background>
<StackPanel VerticalAlignment="Bottom" Visibility="Visible">
<hdtc:AnimatedCardList Name="CardList" Padding="2" />
<Grid Margin="0">

<Grid.RowDefinitions>
<RowDefinition Height="*" MinHeight="50" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
Expand All @@ -49,16 +57,14 @@
x:Name="lblProbability"
Grid.Row="0"
Grid.Column="0"
HorizontalAlignment="Left"
Foreground="White" />
HorizontalAlignment="Left" />
<Label
Name="lblDeckMix"
Grid.Row="0"
Grid.Column="1"
HorizontalAlignment="Right"
HorizontalContentAlignment="Right"
Foreground="White"
Grid.IsSharedSizeScope="True" />
</Grid>
</StackPanel>
</UserControl>
</UserControl>
98 changes: 47 additions & 51 deletions DrawPool/DrawLogic/ElvenMinstrelControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Linq;
using System.Windows;
using Card = Hearthstone_Deck_Tracker.Hearthstone.Card;
using Core = Hearthstone_Deck_Tracker.API.Core;

/// <summary>
/// Elven Minstrel <see cref="DisplayControl">Display Control</see>
Expand All @@ -24,13 +23,6 @@ public ElvenMinstrelControl()
GameEvents.OnPlayerHandMouseOver.Add(PlayerHandMouseOver);
}

/// <summary>
/// Gets or sets the minion count.
/// </summary>
/// <value>The minion count.</value>
internal int MinionCount() => this.QueryDeck.Sum(c => c.Count);


/// <summary>
/// The <see cref="PlayerCardList">Deck</see> object reference for the <see cref="Card">Cards</see> data.
/// </summary>
Expand All @@ -43,6 +35,52 @@ public ElvenMinstrelControl()
/// <returns>The list of Minions Grouped by their Counts, for statistical purposes</returns>
internal List<IGrouping<int, Card>> GroupedMinion() => QueryDeck.GroupBy(c => c.Count).OrderByDescending(grp => grp.Count()).OrderBy(g => g.Key).ToList();

/// <summary>
/// Gets or sets the minion count.
/// </summary>
/// <value>The minion count.</value>
internal int MinionCount() => this.QueryDeck.Sum(c => c.Count);

/// <summary>
/// Queries the <see cref="PlayerCardList">Deck</see> for specific scoped <see cref="Card">Cards</see>.
/// </summary>
/// <returns>The scoped list of <see cref="Card">Cards</see></returns>
public List<Card> BuildQueryDeck()
{
var playerDeck = Hearthstone_Deck_Tracker.API.Core.Game.Player
.PlayerCardList
.Where(c =>
c.Type == "Minion" &&
(c.Count - c.InHandCount) > 0
)
.OrderBy(c => c.Cost)
.ThenBy(c => c.Count)
.ThenBy(c => c.Name)
.ToList<Card>()
.FixCreatedCards();

var dups = playerDeck
.GroupBy(c => c.Id)
.Where(d => d.Count() > 1)
.ToList();

if (dups.Count >= 1)
{
foreach (var d in dups.ToList())
{
var count = 0;
Card first = d.First();
foreach (var i in d)
{
count += i.Count;
i.Count = 0;
}
first.Count = count;
}
}
playerDeck.RemoveAll(c => c.Count == 0);
return playerDeck;
}

/// <summary>
/// Gets the unique card identifier.
Expand All @@ -55,9 +93,8 @@ public ElvenMinstrelControl()
/// </summary>
public void DoMath()
{

// First, figure out our remaining card mix
lblDeckMix.Content = WriteDeckMix(MinionCount(), Core.Game.Player.DeckCount);
lblDeckMix.Content = WriteDeckMix(MinionCount(), Hearthstone_Deck_Tracker.API.Core.Game.Player.DeckCount);
if (MinionCount() >= 1)
{
lblProbability.Content = "";
Expand Down Expand Up @@ -107,46 +144,5 @@ public void PlayerHandMouseOver(Card card)
ShowDisplay(new CurtainCall { CallingView = ViewModes.ElvenMinstrel, ShouldShow = true }, new EventArgs());
}
}

/// <summary>
/// Queries the <see cref="PlayerCardList">Deck</see> for specific scoped <see cref="Card">Cards</see>.
/// </summary>
/// <returns>The scoped list of <see cref="Card">Cards</see></returns>
public List<Card> BuildQueryDeck()
{
var playerDeck = Hearthstone_Deck_Tracker.API.Core.Game.Player
.PlayerCardList
.Where(c =>
c.Type == "Minion" &&
(c.Count - c.InHandCount) > 0
)
.OrderBy(c => c.Cost)
.ThenBy(c => c.Count)
.ThenBy(c => c.Name)
.ToList<Card>()
.FixCreatedCards();

var dups = playerDeck
.GroupBy(c => c.Id)
.Where(d => d.Count() > 1)
.ToList();

if (dups.Count >= 1)
{
foreach (var d in dups.ToList())
{
var count = 0;
Card first = d.First();
foreach (var i in d)
{
count += i.Count;
i.Count = 0;
}
first.Count = count;
}
}
playerDeck.RemoveAll(c => c.Count == 0);
return playerDeck;
}
}
}
4 changes: 2 additions & 2 deletions DrawPool/DrawLogic/WitchWoodPiperControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public WitchWoodPiperControl()
/// <returns>The scoped list of <see cref="Card">Cards</see></returns>
internal List<Card> BuildQueryDeck()
{
var cd= Core.Game.Player.PlayerCardList
var cd= Hearthstone_Deck_Tracker.API.Core.Game.Player.PlayerCardList
.Where(
c => c.Type == "Minion"
&& (c.Count - c.InHandCount) > 0
Expand All @@ -74,7 +74,7 @@ internal List<Card> BuildQueryDeck()
public void DoMath()
{
lblProbability.Content = "";
lblDeckMix.Content = WriteDeckMix(MinionCount(), Core.Game.Player.DeckCount);
lblDeckMix.Content = WriteDeckMix(MinionCount(), Hearthstone_Deck_Tracker.API.Core.Game.Player.DeckCount);
if (QueryDeck.Count == 1 || QueryDeck.Count == MinionCount())
{
lblProbability.Content = WriteDrawProbability(1, MinionCount(), 1);
Expand Down
9 changes: 6 additions & 3 deletions DrawPool/DrawPool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,16 @@
<Reference Include="MahApps.Metro, Version=1.5.0.23, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
Expand Down Expand Up @@ -111,8 +116,8 @@
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="InfoControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UserOptionsControl.xaml">
<SubType>Designer</SubType>
Expand All @@ -124,8 +129,6 @@
<PropertyGroup>
<PostBuildEvent>if $(ConfigurationName) == Debug (
copy "$(TargetDir)$(ProjectName).*" "C:\Users\VeX\AppData\Roaming\HearthstoneDeckTracker\Plugins" /y
) else (
copy "$(TargetPath)" "$(ProjectDir)\downloadable\" /y
)</PostBuildEvent>
</PropertyGroup>
</Project>
14 changes: 5 additions & 9 deletions DrawPool/DrawPoolPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Settings = DrawPool.Properties.Settings;

/// <summary>
/// The plug-in Instance
/// The DrawPool plug-in Instance
/// </summary>
/// <seealso cref="Hearthstone_Deck_Tracker.Plugins.IPlugin" />
public class DrawPoolPlugin : IPlugin
Expand All @@ -30,9 +30,9 @@ public class DrawPoolPlugin : IPlugin
public string ButtonText => "Settings";

/// <summary>
/// The description.
/// The plug-in description.
/// </summary>
/// <value>The description.</value>
/// <value>The plug-in description.</value>
public string Description => @"Helps to see scoped draw pools";

/// <summary>
Expand All @@ -45,7 +45,7 @@ public class DrawPoolPlugin : IPlugin
/// The plug-in name.
/// </summary>
/// <value>The plug-in name.</value>
public string Name => "Drawpool";
public string Name => "DrawPool";

/// <summary>
/// The version.
Expand All @@ -60,7 +60,7 @@ private void AddMenuItem()
{
this.MenuItem = new MenuItem()
{
Header = "Drawpool"
Header = Name
};

this.MenuItem.Click += (sender, args) =>
Expand Down Expand Up @@ -103,10 +103,6 @@ public void OnButtonPress()
public void OnLoad()
{
win = new DrawPoolWindow();
//win.Initialized += (sender, e) =>
//{
// win.InitializeDrawPool();
//};
win.InitializeDrawPool();
AddMenuItem();
}
Expand Down
2 changes: 1 addition & 1 deletion DrawPool/DrawPoolWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public void InitializeOpts()
}

/// <summary>
/// Resets this instance.
/// Resets this window instance.
/// </summary>
public void Reset()
{
Expand Down
Loading

0 comments on commit f993058

Please sign in to comment.