diff --git a/DrawPool.sln b/DrawPool.sln new file mode 100644 index 0000000..c4e7487 --- /dev/null +++ b/DrawPool.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27428.2043 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DrawPool", "DrawPool\DrawPool.csproj", "{456D95B9-55E4-4350-9AF5-E13EEA64FBCA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {456D95B9-55E4-4350-9AF5-E13EEA64FBCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {456D95B9-55E4-4350-9AF5-E13EEA64FBCA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {456D95B9-55E4-4350-9AF5-E13EEA64FBCA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {456D95B9-55E4-4350-9AF5-E13EEA64FBCA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7615A9F8-0DBE-4842-96EE-FD2E4B7A7342} + EndGlobalSection +EndGlobal diff --git a/DrawPool/Controls/OptionsViewControl.xaml b/DrawPool/Controls/OptionsViewControl.xaml new file mode 100644 index 0000000..aafd02f --- /dev/null +++ b/DrawPool/Controls/OptionsViewControl.xaml @@ -0,0 +1,68 @@ + + + + diff --git a/DrawPool/Controls/OptionsViewControl.xaml.cs b/DrawPool/Controls/OptionsViewControl.xaml.cs new file mode 100644 index 0000000..8f2c89a --- /dev/null +++ b/DrawPool/Controls/OptionsViewControl.xaml.cs @@ -0,0 +1,28 @@ +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.Controls +{ + /// + /// Interaction logic for OptionsViewControl.xaml + /// + public partial class OptionsViewControl : UserControl + { + public OptionsViewControl() + { + InitializeComponent(); + } + } +} diff --git a/DrawPool/Controls/ScopedDrawViewControl.xaml b/DrawPool/Controls/ScopedDrawViewControl.xaml new file mode 100644 index 0000000..296455a --- /dev/null +++ b/DrawPool/Controls/ScopedDrawViewControl.xaml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DrawPool/Controls/ScopedDrawViewControl.xaml.cs b/DrawPool/Controls/ScopedDrawViewControl.xaml.cs new file mode 100644 index 0000000..75e9ce3 --- /dev/null +++ b/DrawPool/Controls/ScopedDrawViewControl.xaml.cs @@ -0,0 +1,35 @@ +namespace DrawPool +{ + using DrawPool.Models; + 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; + + /// + /// Interaction logic for ScopedDrawViewControl.xaml + /// + public partial class ScopedDrawViewControl : UserControl + { + private DrawDataModel ddm; + + public ScopedDrawViewControl() + { + //InitializeComponent(); + } + + public DrawDataModel DrawData { get; set; } + + // + } +} \ No newline at end of file diff --git a/DrawPool/Core/IDraw.cs b/DrawPool/Core/IDraw.cs new file mode 100644 index 0000000..04e6aff --- /dev/null +++ b/DrawPool/Core/IDraw.cs @@ -0,0 +1,46 @@ +namespace DrawPool +{ + using System; + using System.Collections.Generic; + using Card = Hearthstone_Deck_Tracker.Hearthstone.Card; + using Core = Hearthstone_Deck_Tracker.API.Core; + + /// + /// Interface for a card that invokes a draw, as opposed to a mechanic + /// + public interface IDraw + { + /// + /// Gets the unique card identifier. + /// + /// The card identifier. + string CardId(); + + /// + /// Does the math. + /// + void DoMath(); + + /// + /// Loads the cards, sorts and filters as needed. + /// + void LoadCards(); + + /// + /// When the Player mouses over a in his hand. + /// + /// The . + void PlayerHandMouseOver(Card card); + + /// + /// Queries the Deck for specific scoped Cards. + /// + /// The scoped list of Cards + List QueryDeck(); + + /// + /// Resets this instance's lists. + /// + void Reset(); + } +} \ No newline at end of file diff --git a/DrawPool/Core/IRecruit.cs b/DrawPool/Core/IRecruit.cs new file mode 100644 index 0000000..45ad730 --- /dev/null +++ b/DrawPool/Core/IRecruit.cs @@ -0,0 +1,9 @@ +namespace DrawPool +{ + using Core = Hearthstone_Deck_Tracker.API.Core; + + public interface IRecruit + { + string MechanicId { get; set; } + } +} \ No newline at end of file diff --git a/DrawPool/Core/Views.cs b/DrawPool/Core/Views.cs new file mode 100644 index 0000000..8870957 --- /dev/null +++ b/DrawPool/Core/Views.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DrawPool +{ + /// + /// The list of possible Displays + /// + public enum ViewModes + { + /// + /// The Witchwood Piper + /// + Options = 0, + + /// + /// The Witchwood Piper + /// + ElvenMinstrel = 1, + + /// + /// The Witchwood Piper + /// + WitchWoodPiper = 2 + } +} \ No newline at end of file diff --git a/DrawPool/DisplayControl.cs b/DrawPool/DisplayControl.cs new file mode 100644 index 0000000..f7dbe6a --- /dev/null +++ b/DrawPool/DisplayControl.cs @@ -0,0 +1,56 @@ +namespace DrawPool +{ + using MahApps.Metro.Controls; + using System; + using System.Windows; + using System.Windows.Controls; + using Hearthstone_Deck_Tracker.Controls; + using System.Collections.Generic; + using System.Linq; + using Card = Hearthstone_Deck_Tracker.Hearthstone.Card; + using Core = Hearthstone_Deck_Tracker.API.Core; + using Helper = Hearthstone_Deck_Tracker.Helper; + using Hearthstone_Deck_Tracker; + using Hearthstone_Deck_Tracker.API; + using static Hearthstone_Deck_Tracker.Windows.MessageDialogs; + using Settings = DrawPool.Properties.Settings; + using System.ComponentModel; + using Hearthstone_Deck_Tracker.Hearthstone; + using System.Security.Cryptography; + using DrawPool.Models; + + public partial class DisplayControl : UserControl + { + /// + /// Occurs when [raise curtain] There is a display with data. + /// + public event EventHandler RaiseCurtain; + + /// + /// Calculates the Draw the probability. + /// + /// The pool size you will draw from. + /// The number of copies of a card. + /// The number of cards to draw. + /// The decimal place to round to. + /// The Draw the probability. + public Double DrawProbability(int poolsize, int copies = 1, int draw = 1, int dec = 0) + { + return Math.Round( + Helper.DrawProbability(copies, poolsize, draw) * 100, dec); + } + + /// + /// Checks the panel to see if there is data to display. + /// + /// The sender. + /// The instance containing the event data. + internal void ShowDisplay(object sender, EventArgs e) + { + if (this.RaiseCurtain != null && this.CardList.Items.Count > 0) + { + RaiseCurtain(sender, e); + } + } + } +} \ No newline at end of file diff --git a/DrawPool/DisplayControl.xaml b/DrawPool/DisplayControl.xaml new file mode 100644 index 0000000..f616bd6 --- /dev/null +++ b/DrawPool/DisplayControl.xaml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + diff --git a/DrawPool/DisplayControl.xaml.cs b/DrawPool/DisplayControl.xaml.cs new file mode 100644 index 0000000..ec7c376 --- /dev/null +++ b/DrawPool/DisplayControl.xaml.cs @@ -0,0 +1,38 @@ +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 +{ + /// + /// Interaction logic for DisplayControl.xaml + /// + public partial class DisplayControl : UserControl + { + public DisplayControl() + { + InitializeComponent(); + //System.Convert.ToDouble(0); + } + + /// + /// Resets this instance's lists. + /// + public void Reset() + { + CardList.Update(null, true); + this.Visibility = Visibility.Collapsed; + } + } +} \ No newline at end of file diff --git a/DrawPool/DrawLogic/ElvenMinstrelControl.cs b/DrawPool/DrawLogic/ElvenMinstrelControl.cs new file mode 100644 index 0000000..cdf7111 --- /dev/null +++ b/DrawPool/DrawLogic/ElvenMinstrelControl.cs @@ -0,0 +1,135 @@ +namespace DrawPool +{ + using MahApps.Metro.Controls; + using System; + using System.Windows; + using System.Windows.Controls; + using Hearthstone_Deck_Tracker.Controls; + using System.Collections.Generic; + using System.Linq; + using Card = Hearthstone_Deck_Tracker.Hearthstone.Card; + using Core = Hearthstone_Deck_Tracker.API.Core; + using Helper = Hearthstone_Deck_Tracker.Helper; + using Settings = DrawPool.Properties.Settings; + using Hearthstone_Deck_Tracker.API; + using DrawPool.Models; + + /// + /// Elven Minstrel Display Control + /// + /// + /// + internal class ElvenMinstrelControl : DisplayControl, IDraw + { + /// + /// Initializes a new instance of the class. + /// + public ElvenMinstrelControl() + { + GameEvents.OnPlayerHandMouseOver.Add(PlayerHandMouseOver); + } + + /// + /// Gets the unique card identifier. + /// + /// The card identifier. + public string CardId() => "LOOT_211"; + + /// + /// Does the math. + /// + public void DoMath() + { + int mc = countMinions(); + // First, figure out our remaining card mix + lblDeckMix.Content = $"{CardList.Items.Count}/{Hearthstone_Deck_Tracker.API.Core.Game.Player.DeckCount}"; + // Next, figure out our odds + lblProbability.Content = $"(1): {DrawProbability(mc, 1, 1)}% / (2): {DrawProbability(mc, 1, 2)}%"; + // Finally see if we have any large card counts + var match = CardList.Items.Cast() + .OrderByDescending(c => c.Card.Count) + .FirstOrDefault() + .Card; + + if (match.Count > 2) + { + lblProbability.Content += $" / ({match.Count}): {DrawProbability(mc, match.Count, 2)}%"; + } + } + + /// + /// Loads the list of Cards, by combining copies + /// + /// The List of Cards. + public void LoadCards() + { + CardList.Update(QueryDeck(), true); + } + + /// + /// When the Player mouses over a in his hand. + /// + /// The . + public void PlayerHandMouseOver(Card card) + { + if (card.Id == CardId()) + { + this.Visibility = Visibility.Visible; + LoadCards(); + DoMath(); + ShowDisplay(new CurtainCall { CallingView = ViewModes.ElvenMinstrel, ShouldShow = true }, new EventArgs()); + } + else + { + this.Visibility = Visibility.Collapsed; + } + } + + /// + /// Queries the Deck for specific scoped Cards. + /// + /// The scoped list of Cards + public List QueryDeck() + { + var playerDeck = Hearthstone_Deck_Tracker.API.Core.Game.Player + .PlayerCardList + .Where(c => + c.Type == "Minion" && + (c.Count - c.InHandCount) > 0 + ) + .ToList(); + + 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) + { + i.IsCreated = false; + count += i.Count; + i.Count = 0; + } + first.Count = count; + } + } + playerDeck.RemoveAll(c => c.Count == 0); + return playerDeck.ToList(); + } + + /// + /// Counts the minions available in the draw pool. + /// + /// + internal int countMinions() + { + return QueryDeck().Sum(c => c.Count); + } + } +} \ No newline at end of file diff --git a/DrawPool/DrawLogic/WhichwoodPiper.cs b/DrawPool/DrawLogic/WhichwoodPiper.cs new file mode 100644 index 0000000..2c067be --- /dev/null +++ b/DrawPool/DrawLogic/WhichwoodPiper.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DrawPool +{ + internal class WhichwoodPiper : IDraw + { + public string CardId { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + } +} \ No newline at end of file diff --git a/DrawPool/DrawLogic/WitchWoodPiperControl.cs b/DrawPool/DrawLogic/WitchWoodPiperControl.cs new file mode 100644 index 0000000..62059c7 --- /dev/null +++ b/DrawPool/DrawLogic/WitchWoodPiperControl.cs @@ -0,0 +1,113 @@ +namespace DrawPool +{ + using System; + using System.Windows; + using Hearthstone_Deck_Tracker.Controls; + using System.Collections.Generic; + using System.Linq; + using Card = Hearthstone_Deck_Tracker.Hearthstone.Card; + using Core = Hearthstone_Deck_Tracker.API.Core; + using DrawPool.Models; + using Hearthstone_Deck_Tracker.API; + using System.Windows.Controls; + + /// + /// WitchWood Piper Display Control + /// + /// + /// + internal class WitchWoodPiperControl : DisplayControl, IDraw + { + /// + /// Initializes a new instance of the class. + /// + public WitchWoodPiperControl() + { + GameEvents.OnPlayerHandMouseOver.Add(PlayerHandMouseOver); + } + + /// + /// Gets the unique card identifier. + /// + /// The card identifier. + public string CardId() => "GIL_584"; + + /// + /// Does the math. + /// + public void DoMath() + { + lblDeckMix.Content = $"{countMinions()}/{Hearthstone_Deck_Tracker.API.Core.Game.Player.DeckCount}"; + + if (CardList.Items.Count >= 1) + { + Card c1 = ((AnimatedCard)CardList.Items[0]).Card; + lblProbability.Content = $"({c1.Count}): 100%"; + if (CardList.Items.Count >= 2) + { + int mc = countMinions(); + Card c2 = ((AnimatedCard)CardList.Items[1]).Card; + lblProbability.Content = $"({c1.Count}): {DrawProbability(mc, c1.Count, 1)}%" + + $" / " + + $"({2}): " + + $"{DrawProbability(mc, 2, 1)}%"; + } + } + else + { + lblProbability.Content = ""; + } + } + + /// + /// Loads the cards, sorts and filters as needed. + /// + public void LoadCards() + { + this.CardList.Update(QueryDeck(), true); + } + + /// + /// When the Player mouses over a in his hand. + /// + /// The . + public void PlayerHandMouseOver(Card card) + { + if (card.Id == CardId()) + { + LoadCards(); + DoMath(); + ShowDisplay(new CurtainCall { CallingView = ViewModes.WitchWoodPiper, ShouldShow = true }, new EventArgs()); + } + else + { + this.Visibility = Visibility.Collapsed; + } + } + + /// + /// Queries the Deck for specific scoped Cards. + /// + /// The scoped list of Cards + public List QueryDeck() + { + return 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) + .GroupBy(c => c.Cost) + .First() + .ToList(); + } + + /// + /// Counts the minions available in the draw pool. + /// + /// + internal int countMinions() + { + return QueryDeck().Sum(c => c.Count); + } + } +} \ No newline at end of file diff --git a/DrawPool/DrawPool.csproj b/DrawPool/DrawPool.csproj new file mode 100644 index 0000000..2f0f985 --- /dev/null +++ b/DrawPool/DrawPool.csproj @@ -0,0 +1,126 @@ + + + + + Debug + AnyCPU + {456D95B9-55E4-4350-9AF5-E13EEA64FBCA} + Library + Properties + DrawPool + DrawPool + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + lib\HearthDb.dll + False + + + lib\HearthstoneDeckTracker.exe + False + + + ..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll + + + + + + + + + ..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll + True + + + + + + + + + + + + + + + + + DisplayControl.xaml + + + + + DrawPoolWindow.xaml + + + + + + + True + True + Settings.settings + + + UserOptionsControl.xaml + + + + + + Designer + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + + + + + + if $(ConfigurationName) == Debug ( + +copy "$(TargetDir)$(ProjectName).*" "C:\Users\Alex\AppData\Roaming\HearthstoneDeckTracker\Plugins" /y +"E:\Games\Hearthstone Deck Tracker\Hearthstone Deck Tracker.exe" +) else ( +copy "$(TargetPath)" "$(ProjectDir)\downloadable" /y +) + + \ No newline at end of file diff --git a/DrawPool/DrawPoolPlugin.cs b/DrawPool/DrawPoolPlugin.cs new file mode 100644 index 0000000..aa3909d --- /dev/null +++ b/DrawPool/DrawPoolPlugin.cs @@ -0,0 +1,127 @@ +namespace DrawPool +{ + using Hearthstone_Deck_Tracker.Plugins; + using MahApps.Metro.Controls; + using System; + using System.Reflection; + using System.Windows.Controls; + using Settings = DrawPool.Properties.Settings; + using Hearthstone_Deck_Tracker.API; + + /// + /// The plug-in Instance + /// + /// + public class DrawPoolPlugin : IPlugin + { + /// + /// The DrawPool Window reference + /// + private DrawPoolWindow win; + + /// + /// The author. + /// + /// The author. + public string Author => "VeX Harbinger"; + + /// + /// The button text. + /// + /// The button text. + public string ButtonText => "Settings"; + + /// + /// The description. + /// + /// The description. + public string Description => @"Helps to see scoped draw pools"; + + /// + /// Gets or sets the main Menu Item. + /// + /// The main Menu Item. + public MenuItem MenuItem { get; set; } = null; + + /// + /// The plug-in name. + /// + /// The plug-in name. + public string Name => "Drawpool"; + + /// + /// The version. + /// + /// The version. + public Version Version => Assembly.GetExecutingAssembly().GetName().Version; + + /// + /// Called when [button press]. + /// + public void OnButtonPress() + { + win.CurrentView = DrawPool.ViewModes.Options; + win.Show(); + } + + /// + /// Called when [load]. + /// + public void OnLoad() + { + win = new DrawPoolWindow(); + AddMenuItem(); + } + + /// + /// Called when [unload]. + /// + public void OnUnload() + { + win.Close(); + } + + /// + /// Called when [update]. + /// + public void OnUpdate() + { + } + + /// + /// Checks for default settings, or applies them if missing. + /// + protected void CheckForDefaultSettings() + { + if (Settings.Default == null) + { + Settings.Default.IsMinstrelEnabled = true; + Settings.Default.IsPiperEnabled = true; + Settings.Default.Scale = 100; + Settings.Default.Opacity = 100; + Settings.Default.Top = 400; + Settings.Default.Left = 300; + Settings.Default.Save(); + } + // Make Sure we save changes + Settings.Default.PropertyChanged += (sender, e) => Settings.Default.Save(); + } + + /// + /// Adds the menu item. + /// + private void AddMenuItem() + { + this.MenuItem = new MenuItem() + { + Header = "Drawpool" + }; + + this.MenuItem.Click += (sender, args) => + { + win.CurrentView = DrawPool.ViewModes.Options; + win.Show(); + }; + } + } +} \ No newline at end of file diff --git a/DrawPool/DrawPoolWindow.cs b/DrawPool/DrawPoolWindow.cs new file mode 100644 index 0000000..d02879e --- /dev/null +++ b/DrawPool/DrawPoolWindow.cs @@ -0,0 +1,166 @@ +namespace DrawPool +{ + using MahApps.Metro.Controls; + using System; + using System.Windows; + using Hearthstone_Deck_Tracker.API; + using Settings = DrawPool.Properties.Settings; + using Core = Hearthstone_Deck_Tracker.API.Core; + using System.ComponentModel; + using DrawPool.Models; + + /// + /// Logic related to the DrawPoolWindow data processing + /// + /// + /// + /// + public partial class DrawPoolWindow : MetroWindow + { + /// + /// Gets or sets the current display view. + /// + /// The current display view. + private static ViewModes currentView; + + /// + /// Gets or sets the currently displayed view. + /// + /// The currently displayed view. + public ViewModes CurrentView + { + get { return currentView; } + set + { + DisplayBox.FindChild(currentView.ToString()).Visibility = Visibility.Collapsed; + currentView = value; + DisplayBox.FindChild(currentView.ToString()).Visibility = Visibility.Visible; + } + } + + /// + /// Initializes the window. + /// + public void Initialize() + { + // Core.Game.PlayerMinionCount Helper.OptionsMain. GameEvents.OnPlayerCreateInDeck + // GameEvents.OnPlayerGet GameEvents.OnTurnStart + InitializeOpts(); + InitializeByCardModules(); + + // Game Triggers + GameEvents.OnGameStart.Add(Reset); + GameEvents.OnGameEnd.Add(Reset); + // User Triggers + GameEvents.OnMouseOverOff.Add(OnMouseOff); + + Core.Game.Player.PropertyChanged += DeckCountChanged; + Core.Game.Player.PropertyChanged += (sender, e) => + { + if (e.PropertyName == "Deck" || e.PropertyName == "DeckCount") + { + } + }; + } + + /// + /// Initializes the By Card modules. + /// + public void InitializeByCardModules() + { + if (Settings.Default.IsPiperEnabled) + { + var dc = new WitchWoodPiperControl() + { + Name = "WitchWoodPiper" + }; + dc.RaiseCurtain += new EventHandler(Display_Helper); + DisplayBox.Children.Add(dc); + } + if (Settings.Default.IsMinstrelEnabled) + { + var dc = new ElvenMinstrelControl() + { + Name = "ElvenMinstrel" + }; + dc.RaiseCurtain += new EventHandler(Display_Helper); + DisplayBox.Children.Add(dc); + } + } + + /// + /// Initializes the Options. + /// + public void InitializeOpts() + { + currentView = ViewModes.Options; + var uc = (UserOptionsControl)DisplayBox.FindChild(currentView.ToString()); + if (uc != null) + uc.WinPositionButtonClick += new EventHandler(WinPositionMode); + + uc.btnDone.Click += (sender, args) => + { + Settings.Default.Save(); + Display_Helper(new CurtainCall(), args); + }; + } + + /// + /// Resets this instance. + /// + public void Reset() + { + // ToDo : see how this loop needs to evolve with mechanics + foreach (var dc in DisplayBox.Children) + { + if (dc is IDraw) + { + ((IDraw)dc).Reset(); + } + } + Visibility = Visibility.Collapsed; + } + + /// + /// Helper event for the Display control. + /// + /// The source of the event. + /// The instance containing the event data. + protected void Display_Helper(object sender, EventArgs e) + { + CurtainCall cc = (CurtainCall)sender; + + if (cc.ShouldShow) + { + CurrentView = cc.CallingView; + Visibility = Visibility.Visible; + } + else + { + Visibility = Visibility.Collapsed; + } + } + + /// + /// Deck count changed. + /// + /// The sender. + /// + /// The instance containing the event data. + /// + private void DeckCountChanged(object sender, PropertyChangedEventArgs e) + { + if (e.PropertyName == "Deck" || e.PropertyName == "DeckCount") + { + } + } + + /// + /// Called when [mouse off]. + /// + private void OnMouseOff() + { + Visibility = Visibility.Collapsed; + } + } +} \ No newline at end of file diff --git a/DrawPool/DrawPoolWindow.xaml b/DrawPool/DrawPoolWindow.xaml new file mode 100644 index 0000000..6fe135a --- /dev/null +++ b/DrawPool/DrawPoolWindow.xaml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DrawPool/DrawPoolWindow.xaml.cs b/DrawPool/DrawPoolWindow.xaml.cs new file mode 100644 index 0000000..e674e19 --- /dev/null +++ b/DrawPool/DrawPoolWindow.xaml.cs @@ -0,0 +1,61 @@ +using DrawPool.Properties; +using MahApps.Metro.Controls; +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.Controls.Primitives; +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 +{ + /// + /// Interaction logic for DrawPoolWindow.xaml + /// + public partial class DrawPoolWindow : MetroWindow + { + /// + /// Initializes a new instance of the class. + /// + public DrawPoolWindow() + { + InitializeComponent(); + Initialize(); + Visibility = Visibility.Collapsed; + } + + /// + /// Gets or sets the win opacity and converts it to a double. + /// + /// The win opacity. + public double WinOpacity + { + get { return Settings.Default.Opacity; } + set + { + Settings.Default.Opacity = (value / 100); + Opacity = Settings.Default.Opacity; + } + } + + /// + /// The Window position/configuration mode handler. + /// + /// The sender. + /// The instance containing the event data. + private void WinPositionMode(object sender, EventArgs e) + { + ToggleButton btn = ((ToggleButton)sender); + IsWindowDraggable = btn.IsChecked.Value; + } + } +} \ No newline at end of file diff --git a/DrawPool/Models/DrawDataModel.cs b/DrawPool/Models/DrawDataModel.cs new file mode 100644 index 0000000..1cfe615 --- /dev/null +++ b/DrawPool/Models/DrawDataModel.cs @@ -0,0 +1,31 @@ +namespace DrawPool.Models +{ + using MahApps.Metro.Controls; + using System; + using System.Windows; + using System.Windows.Controls; + using Hearthstone_Deck_Tracker.Controls; + using System.Collections.Generic; + using System.Linq; + using Card = Hearthstone_Deck_Tracker.Hearthstone.Card; + using Core = Hearthstone_Deck_Tracker.API.Core; + using Helper = Hearthstone_Deck_Tracker.Helper; + using Hearthstone_Deck_Tracker; + using Hearthstone_Deck_Tracker.API; + using static Hearthstone_Deck_Tracker.Windows.MessageDialogs; + + public class CurtainCall + { + /// + /// Gets or sets the calling view, that is sending the data. + /// + /// The calling view. + public ViewModes CallingView { get; set; } + + /// + /// Gets or sets a value indicating whether [should show] the window or hide it. + /// + /// true if [should show]; the window otherwise, false hide it. + public bool ShouldShow { get; set; } = false; + } +} \ No newline at end of file diff --git a/DrawPool/Properties/AssemblyInfo.cs b/DrawPool/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..08caa00 --- /dev/null +++ b/DrawPool/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("DrawPool")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("DrawPool")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("456d95b9-55e4-4350-9af5-e13eea64fbca")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// 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.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DrawPool/Properties/Settings.Designer.cs b/DrawPool/Properties/Settings.Designer.cs new file mode 100644 index 0000000..0ce2546 --- /dev/null +++ b/DrawPool/Properties/Settings.Designer.cs @@ -0,0 +1,98 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace DrawPool.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.6.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool IsMinstrelEnabled { + get { + return ((bool)(this["IsMinstrelEnabled"])); + } + set { + this["IsMinstrelEnabled"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool IsPiperEnabled { + get { + return ((bool)(this["IsPiperEnabled"])); + } + set { + this["IsPiperEnabled"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("100")] + public double Scale { + get { + return ((double)(this["Scale"])); + } + set { + this["Scale"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("100")] + public double Opacity { + get { + return ((double)(this["Opacity"])); + } + set { + this["Opacity"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("100")] + public double Top { + get { + return ((double)(this["Top"])); + } + set { + this["Top"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("100")] + public double Left { + get { + return ((double)(this["Left"])); + } + set { + this["Left"] = value; + } + } + } +} diff --git a/DrawPool/Properties/Settings.settings b/DrawPool/Properties/Settings.settings new file mode 100644 index 0000000..d9f3e19 --- /dev/null +++ b/DrawPool/Properties/Settings.settings @@ -0,0 +1,24 @@ + + + + + + True + + + True + + + 100 + + + 100 + + + 100 + + + 100 + + + \ No newline at end of file diff --git a/DrawPool/UserOptionsControl.xaml b/DrawPool/UserOptionsControl.xaml new file mode 100644 index 0000000..76e48a1 --- /dev/null +++ b/DrawPool/UserOptionsControl.xaml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + +