From f9930589b2d2c882ca188bc9f4669b16c78852c0 Mon Sep 17 00:00:00 2001 From: VeX Harbinger Date: Thu, 29 Nov 2018 22:40:04 -0500 Subject: [PATCH] Fixed UI Background and sizing --- DrawPool/Core/DrawPoolHelpers.cs | 6 ++ DrawPool/Core/IRecruit.cs | 5 +- DrawPool/Core/Views.cs | 6 +- DrawPool/DisplayControl.cs | 20 ++-- DrawPool/DisplayControl.xaml | 24 +++-- DrawPool/DrawLogic/ElvenMinstrelControl.cs | 98 ++++++++++---------- DrawPool/DrawLogic/WitchWoodPiperControl.cs | 4 +- DrawPool/DrawPool.csproj | 9 +- DrawPool/DrawPoolPlugin.cs | 14 +-- DrawPool/DrawPoolWindow.cs | 2 +- DrawPool/DrawPoolWindow.xaml | 49 +++++----- DrawPool/InfoControl.xaml | 24 +++-- DrawPool/InfoControl.xaml.cs | 18 +--- DrawPool/Properties/AssemblyInfo.cs | 4 +- DrawPool/UserOptionsControl.xaml | 25 +++-- DrawPool/packages.config | 1 + images/DrawpoolOptions.png | Bin 104256 -> 63551 bytes images/MinstrelDisplaySample.png | Bin 332185 -> 331532 bytes images/PiperDisplaySample.png | Bin 444954 -> 345016 bytes 19 files changed, 162 insertions(+), 147 deletions(-) diff --git a/DrawPool/Core/DrawPoolHelpers.cs b/DrawPool/Core/DrawPoolHelpers.cs index 6824b91..1673a85 100644 --- a/DrawPool/Core/DrawPoolHelpers.cs +++ b/DrawPool/Core/DrawPoolHelpers.cs @@ -5,8 +5,14 @@ using Card = Hearthstone_Deck_Tracker.Hearthstone.Card; using Core = Hearthstone_Deck_Tracker.API.Core; + /// + /// Available Card(s) Helper(s) + /// public static class DrawPoolHelpers { + + + /// /// Fixes the card's "Is Created" indicator and merges them into one big pile. /// diff --git a/DrawPool/Core/IRecruit.cs b/DrawPool/Core/IRecruit.cs index 45ad730..46a8398 100644 --- a/DrawPool/Core/IRecruit.cs +++ b/DrawPool/Core/IRecruit.cs @@ -1,7 +1,8 @@ namespace DrawPool { - using Core = Hearthstone_Deck_Tracker.API.Core; - + /// + /// Interface for the Recruit mechanic, as opposed to a card draw + /// public interface IRecruit { string MechanicId { get; set; } diff --git a/DrawPool/Core/Views.cs b/DrawPool/Core/Views.cs index b6b104c..26b2dc0 100644 --- a/DrawPool/Core/Views.cs +++ b/DrawPool/Core/Views.cs @@ -6,17 +6,17 @@ public enum ViewModes { /// - /// The Witchwood Piper + /// The Options Config /// Options = 0, /// - /// The Witchwood Piper + /// The Elven Minstrel DrawPool /// ElvenMinstrel = 1, /// - /// The Witchwood Piper + /// The Witchwood Piper DrawPool /// WitchWoodPiper = 2 } diff --git a/DrawPool/DisplayControl.cs b/DrawPool/DisplayControl.cs index 4912290..258cc2a 100644 --- a/DrawPool/DisplayControl.cs +++ b/DrawPool/DisplayControl.cs @@ -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; + /// /// The Possible Draw List Display Control @@ -29,7 +31,7 @@ public partial class DisplayControl : UserControl /// /// The deck hash. /// - public int DeckHash => Core.Game.Player.Deck.GetHashCode(); + public int DeckHash => Hearthstone_Deck_Tracker.API.Core.Game.Player.Deck.GetHashCode(); /// /// Checks if the deck has changed, since the last check.. @@ -37,9 +39,9 @@ public partial class DisplayControl : UserControl /// True, if the deck has changed, since the last check. 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 diff --git a/DrawPool/DisplayControl.xaml b/DrawPool/DisplayControl.xaml index e600d5d..e45aedb 100644 --- a/DrawPool/DisplayControl.xaml +++ b/DrawPool/DisplayControl.xaml @@ -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"> - - - + + + + - + @@ -49,16 +57,14 @@ x:Name="lblProbability" Grid.Row="0" Grid.Column="0" - HorizontalAlignment="Left" - Foreground="White" /> + HorizontalAlignment="Left" /> - + \ No newline at end of file diff --git a/DrawPool/DrawLogic/ElvenMinstrelControl.cs b/DrawPool/DrawLogic/ElvenMinstrelControl.cs index 620bd82..d9d3b2f 100644 --- a/DrawPool/DrawLogic/ElvenMinstrelControl.cs +++ b/DrawPool/DrawLogic/ElvenMinstrelControl.cs @@ -7,7 +7,6 @@ using System.Linq; using System.Windows; using Card = Hearthstone_Deck_Tracker.Hearthstone.Card; - using Core = Hearthstone_Deck_Tracker.API.Core; /// /// Elven Minstrel Display Control @@ -24,13 +23,6 @@ public ElvenMinstrelControl() GameEvents.OnPlayerHandMouseOver.Add(PlayerHandMouseOver); } - /// - /// Gets or sets the minion count. - /// - /// The minion count. - internal int MinionCount() => this.QueryDeck.Sum(c => c.Count); - - /// /// The Deck object reference for the Cards data. /// @@ -43,6 +35,52 @@ public ElvenMinstrelControl() /// The list of Minions Grouped by their Counts, for statistical purposes internal List> GroupedMinion() => QueryDeck.GroupBy(c => c.Count).OrderByDescending(grp => grp.Count()).OrderBy(g => g.Key).ToList(); + /// + /// Gets or sets the minion count. + /// + /// The minion count. + internal int MinionCount() => this.QueryDeck.Sum(c => c.Count); + + /// + /// Queries the Deck for specific scoped Cards. + /// + /// The scoped list of Cards + public List 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() + .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; + } /// /// Gets the unique card identifier. @@ -55,9 +93,8 @@ public ElvenMinstrelControl() /// 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 = ""; @@ -107,46 +144,5 @@ public void PlayerHandMouseOver(Card card) ShowDisplay(new CurtainCall { CallingView = ViewModes.ElvenMinstrel, ShouldShow = true }, new EventArgs()); } } - - /// - /// Queries the Deck for specific scoped Cards. - /// - /// The scoped list of Cards - public List 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() - .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; - } } } \ No newline at end of file diff --git a/DrawPool/DrawLogic/WitchWoodPiperControl.cs b/DrawPool/DrawLogic/WitchWoodPiperControl.cs index 855ebc7..cb20a1d 100644 --- a/DrawPool/DrawLogic/WitchWoodPiperControl.cs +++ b/DrawPool/DrawLogic/WitchWoodPiperControl.cs @@ -48,7 +48,7 @@ public WitchWoodPiperControl() /// The scoped list of Cards internal List 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 @@ -74,7 +74,7 @@ internal List 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); diff --git a/DrawPool/DrawPool.csproj b/DrawPool/DrawPool.csproj index e89cab0..ada5c2a 100644 --- a/DrawPool/DrawPool.csproj +++ b/DrawPool/DrawPool.csproj @@ -41,11 +41,16 @@ ..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll + + ..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll + + + ..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll @@ -111,8 +116,8 @@ MSBuild:Compile - Designer MSBuild:Compile + Designer Designer @@ -124,8 +129,6 @@ if $(ConfigurationName) == Debug ( copy "$(TargetDir)$(ProjectName).*" "C:\Users\VeX\AppData\Roaming\HearthstoneDeckTracker\Plugins" /y -) else ( -copy "$(TargetPath)" "$(ProjectDir)\downloadable\" /y ) \ No newline at end of file diff --git a/DrawPool/DrawPoolPlugin.cs b/DrawPool/DrawPoolPlugin.cs index 48b9fbb..64837a1 100644 --- a/DrawPool/DrawPoolPlugin.cs +++ b/DrawPool/DrawPoolPlugin.cs @@ -7,7 +7,7 @@ using Settings = DrawPool.Properties.Settings; /// - /// The plug-in Instance + /// The DrawPool plug-in Instance /// /// public class DrawPoolPlugin : IPlugin @@ -30,9 +30,9 @@ public class DrawPoolPlugin : IPlugin public string ButtonText => "Settings"; /// - /// The description. + /// The plug-in description. /// - /// The description. + /// The plug-in description. public string Description => @"Helps to see scoped draw pools"; /// @@ -45,7 +45,7 @@ public class DrawPoolPlugin : IPlugin /// The plug-in name. /// /// The plug-in name. - public string Name => "Drawpool"; + public string Name => "DrawPool"; /// /// The version. @@ -60,7 +60,7 @@ private void AddMenuItem() { this.MenuItem = new MenuItem() { - Header = "Drawpool" + Header = Name }; this.MenuItem.Click += (sender, args) => @@ -103,10 +103,6 @@ public void OnButtonPress() public void OnLoad() { win = new DrawPoolWindow(); - //win.Initialized += (sender, e) => - //{ - // win.InitializeDrawPool(); - //}; win.InitializeDrawPool(); AddMenuItem(); } diff --git a/DrawPool/DrawPoolWindow.cs b/DrawPool/DrawPoolWindow.cs index 2b00b29..6d81ca6 100644 --- a/DrawPool/DrawPoolWindow.cs +++ b/DrawPool/DrawPoolWindow.cs @@ -145,7 +145,7 @@ public void InitializeOpts() } /// - /// Resets this instance. + /// Resets this window instance. /// public void Reset() { diff --git a/DrawPool/DrawPoolWindow.xaml b/DrawPool/DrawPoolWindow.xaml index 8f7efd1..83a1bb3 100644 --- a/DrawPool/DrawPoolWindow.xaml +++ b/DrawPool/DrawPoolWindow.xaml @@ -11,12 +11,13 @@ xmlns:metro="clr-namespace:MahApps.Metro;assembly=MahApps.Metro" xmlns:props="clr-namespace:DrawPool.Properties" xmlns:themes="clr-namespace:Hearthstone_Deck_Tracker.Utility.Themes;assembly=HearthstoneDeckTracker" - Title="Drawpool" - MinWidth="200" - MinHeight="150" + Title="DrawPool" + Width="Auto" + Height="Auto" MaxWidth="300" - Padding="0" - AutomationProperties.Name="Drawpool" + Padding="2" + AllowsTransparency="True" + AutomationProperties.Name="DrawPool" BorderThickness="1" Focusable="True" Grid.IsSharedSizeScope="True" @@ -42,7 +43,8 @@ TitleAlignment="Left" TitleCaps="False" Top="{Binding Source={x:Static props:Settings.Default}, Path=Top, Mode=TwoWay}" - Topmost="True"> + Topmost="True" + WindowStyle="None"> @@ -54,32 +56,37 @@ + - - - - - - - - - + + + + + + - - - - + Visibility="Collapsed" /> \ No newline at end of file diff --git a/DrawPool/InfoControl.xaml b/DrawPool/InfoControl.xaml index c103f99..a8c15e9 100644 --- a/DrawPool/InfoControl.xaml +++ b/DrawPool/InfoControl.xaml @@ -9,7 +9,9 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:props="clr-namespace:DrawPool.Properties" xmlns:sys="clr-namespace:System;assembly=mscorlib" - MinWidth="200" + Width="Auto" + Height="Auto" + MinWidth="100" MaxWidth="300" Margin="0" Padding="0" @@ -18,10 +20,20 @@ TextOptions.TextFormattingMode="Display" mc:Ignorable="d"> - + - - + + + + + + diff --git a/DrawPool/InfoControl.xaml.cs b/DrawPool/InfoControl.xaml.cs index 0d557f3..c4b6711 100644 --- a/DrawPool/InfoControl.xaml.cs +++ b/DrawPool/InfoControl.xaml.cs @@ -1,20 +1,6 @@ -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 DrawPool +namespace DrawPool { + using System.Windows.Controls; /// /// Interaction logic for InfoControl.xaml /// diff --git a/DrawPool/Properties/AssemblyInfo.cs b/DrawPool/Properties/AssemblyInfo.cs index e976069..ccd812a 100644 --- a/DrawPool/Properties/AssemblyInfo.cs +++ b/DrawPool/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.1.1")] -[assembly: AssemblyFileVersion("1.0.1.1")] +[assembly: AssemblyVersion("1.0.2.0")] +[assembly: AssemblyFileVersion("1.0.2.0")] diff --git a/DrawPool/UserOptionsControl.xaml b/DrawPool/UserOptionsControl.xaml index 7836b7b..436b8b7 100644 --- a/DrawPool/UserOptionsControl.xaml +++ b/DrawPool/UserOptionsControl.xaml @@ -10,17 +10,18 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:props="clr-namespace:DrawPool.Properties" xmlns:sys="clr-namespace:System;assembly=mscorlib" + Width="Auto" + Height="Auto" MinWidth="200" - MinHeight="150" - Margin="2" - Background="Transparent" + MinHeight="200" + FontSize="14" + FontWeight="SemiBold" Grid.IsSharedSizeScope="True" TextOptions.TextFormattingMode="Display" mc:Ignorable="d"> - + @@ -106,8 +107,8 @@ Minimum=".20" TickFrequency=".10" TickPlacement="BottomRight" - Ticks="0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0" - ToolTip="Sets the Drawpool window opacity" + Ticks="0.20, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0" + ToolTip="Sets the DrawPool window opacity" Value="{Binding Opacity, Mode=TwoWay, Source={x:Static props:Settings.Default}}"> @@ -116,7 +117,6 @@ -