diff --git a/SpellSchoolCounter/SpellSchoolCounter/SchoolCountWidget.xaml b/SpellSchoolCounter/SpellSchoolCounter/SchoolCountWidget.xaml deleted file mode 100644 index 2ce180b..0000000 --- a/SpellSchoolCounter/SpellSchoolCounter/SchoolCountWidget.xaml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - diff --git a/SpellSchoolCounter/SpellSchoolCounter/SchoolCountWidget.xaml.cs b/SpellSchoolCounter/SpellSchoolCounter/SchoolCountWidget.xaml.cs deleted file mode 100644 index fe47c24..0000000 --- a/SpellSchoolCounter/SpellSchoolCounter/SchoolCountWidget.xaml.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.Collections.Generic; -using System.Diagnostics; -using System.Windows; -using System.Windows.Controls; -using Hearthstone_Deck_Tracker.API; -using Hearthstone_Deck_Tracker.Hearthstone; - -namespace SpellSchoolCounter -{ - - public partial class SchoolCountWidget - { - - public SchoolCountWidget() - { - InitializeComponent(); - Debug.WriteLine("________________________________________ini component____________________________________________________"); - } - - public void Update(List cards) - { - // hide if card list is empty - this.Visibility = cards.Count <= 0 ? Visibility.Hidden : Visibility.Visible; - this.ItemsSource = cards; - Debug.WriteLine("______________________________________________________________________________________________"); - Debug.WriteLine("_________________________________________Update_____________________________________________________"); - Debug.WriteLine(cards.Count); - Debug.WriteLine("______________________________________________________________________________________________"); - UpdatePosition(); - } - - public void UpdatePosition() - { - Canvas.SetTop(this, Core.OverlayWindow.Height * 5 / 100); - Canvas.SetRight(this, Core.OverlayWindow.Width * 20 / 100); - } - - public void Show() - { - this.Visibility = Visibility.Visible; - } - - public void Hide() - { - this.Visibility = Visibility.Hidden; - } - } -} \ No newline at end of file diff --git a/SpellSchoolCounter/SpellSchoolCounter/SchoolCounterWidget.xaml b/SpellSchoolCounter/SpellSchoolCounter/SchoolCounterWidget.xaml new file mode 100644 index 0000000..fcb8183 --- /dev/null +++ b/SpellSchoolCounter/SpellSchoolCounter/SchoolCounterWidget.xaml @@ -0,0 +1,19 @@ + + + + + + + + + + \ No newline at end of file diff --git a/SpellSchoolCounter/SpellSchoolCounter/SchoolCounterWidget2.xaml.cs b/SpellSchoolCounter/SpellSchoolCounter/SchoolCounterWidget.xaml.cs similarity index 50% rename from SpellSchoolCounter/SpellSchoolCounter/SchoolCounterWidget2.xaml.cs rename to SpellSchoolCounter/SpellSchoolCounter/SchoolCounterWidget.xaml.cs index 42d663e..a3814f3 100644 --- a/SpellSchoolCounter/SpellSchoolCounter/SchoolCounterWidget2.xaml.cs +++ b/SpellSchoolCounter/SpellSchoolCounter/SchoolCounterWidget.xaml.cs @@ -8,14 +8,11 @@ namespace SpellSchoolCounter { - - public partial class SchoolCountWidget2 + public partial class SchoolCountWidget { - - public SchoolCountWidget2() + public SchoolCountWidget() { InitializeComponent(); - Debug.WriteLine("________________________________________ini component____________________________________________________"); } public void Update(ObservableCollection cards) @@ -23,17 +20,13 @@ public void Update(ObservableCollection cards) // hide if card list is empty this.Visibility = cards.Count <= 0 ? Visibility.Hidden : Visibility.Visible; this.ItemsSource = cards; - Debug.WriteLine("______________________________________________________________________________________________"); - Debug.WriteLine("_________________________________________Update_____________________________________________________"); - Debug.WriteLine(cards.Count); - Debug.WriteLine("______________________________________________________________________________________________"); UpdatePosition(); } - public void UpdatePosition() + private void UpdatePosition() { - Canvas.SetTop(this, Core.OverlayWindow.Height * 5 / 100); - Canvas.SetRight(this, Core.OverlayWindow.Width * 20 / 100); + Canvas.SetTop(this, 300); + Canvas.SetRight(this, 300); } public void Show() diff --git a/SpellSchoolCounter/SpellSchoolCounter/SchoolCounterWidget2.xaml b/SpellSchoolCounter/SpellSchoolCounter/SchoolCounterWidget2.xaml deleted file mode 100644 index c3d1a51..0000000 --- a/SpellSchoolCounter/SpellSchoolCounter/SchoolCounterWidget2.xaml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - diff --git a/SpellSchoolCounter/SpellSchoolCounter/SpellSchoolCounter.cs b/SpellSchoolCounter/SpellSchoolCounter/SpellSchoolCounter.cs index 03c3976..591af6b 100644 --- a/SpellSchoolCounter/SpellSchoolCounter/SpellSchoolCounter.cs +++ b/SpellSchoolCounter/SpellSchoolCounter/SpellSchoolCounter.cs @@ -1,9 +1,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Diagnostics; using HearthDb.Enums; using Hearthstone_Deck_Tracker; -using Hearthstone_Deck_Tracker.Enums; using Hearthstone_Deck_Tracker.Hearthstone; using CoreAPI = Hearthstone_Deck_Tracker.API.Core; @@ -11,14 +9,18 @@ namespace SpellSchoolCounter { internal class SpellSchoolCounter { - private SchoolCountWidget2 _cardListWidget = null; + private SchoolCountWidget _cardListWidget = null; private List _schoolsPlayed = new List(); private ObservableCollection _playedList = new ObservableCollection(); - public SpellSchoolCounter(SchoolCountWidget2 playerList) + private static readonly List CardNamesThatCareAboutSchools = new List { + "Multicaster", "Coral Keeper", "Magister Dawngrasp" + }; + public SpellSchoolCounter(SchoolCountWidget playerList) + { _cardListWidget = playerList; // Hide in menu, if necessary @@ -35,31 +37,16 @@ internal void GameStart() _schoolsPlayed = new List(); _playedList = new ObservableCollection(); _cardListWidget.Update(_playedList); - Debug.WriteLine("______________________________________________________________________________________________"); - Debug.WriteLine("__________________________________________game start____________________________________________________"); - Debug.WriteLine("______________________________________________________________________________________________"); } internal void OnPlayerPlay(Card card) { - Debug.WriteLine("______________________________________________________________________________________________"); - Debug.WriteLine(card.LocalizedName); - Debug.WriteLine(card.SpellSchool); - Debug.WriteLine("______________________________________________________________________________________________"); - - if (card.SpellSchool != SpellSchool.NONE && !_schoolsPlayed.Contains(card.SpellSchool)) { _schoolsPlayed.Add(card.SpellSchool); _playedList.Add(card); _cardListWidget.Update(_playedList); } - - Debug.WriteLine("______________________________________________________________________________________________"); - Debug.WriteLine("List lengths"); - Debug.WriteLine(_schoolsPlayed.Count); - Debug.WriteLine(_playedList.Count); - Debug.WriteLine("______________________________________________________________________________________________"); } // Need to handle hiding the element when in the game menu @@ -71,14 +58,16 @@ internal void InMenu() } } - // Update the card list on player's turn - internal void TurnStart(ActivePlayer player) + public void PlayerHandMouseOver(Card hoveredCard) { - _cardListWidget.Show(); - Debug.WriteLine("______________________________________________________________________________________________"); - Debug.WriteLine("__________________________________________turn start____________________________________________________"); - Debug.WriteLine("______________________________________________________________________________________________"); + if (CardNamesThatCareAboutSchools.Contains(hoveredCard.Name)) + { + _cardListWidget.Show(); + } + else + { + _cardListWidget.Hide(); + } } - } } \ No newline at end of file diff --git a/SpellSchoolCounter/SpellSchoolCounter/SpellSchoolCounter.csproj b/SpellSchoolCounter/SpellSchoolCounter/SpellSchoolCounter.csproj index ce268a1..335f87f 100644 --- a/SpellSchoolCounter/SpellSchoolCounter/SpellSchoolCounter.csproj +++ b/SpellSchoolCounter/SpellSchoolCounter/SpellSchoolCounter.csproj @@ -48,22 +48,18 @@ - - SchoolCounterWidget2.xaml + + SchoolCounterWidget.xaml - - + Designer MSBuild:Compile - - MSBuild:Compile - diff --git a/SpellSchoolCounter/SpellSchoolCounter/SpellSchoolCounterPlugin.cs b/SpellSchoolCounter/SpellSchoolCounter/SpellSchoolCounterPlugin.cs index f85877a..0098b04 100644 --- a/SpellSchoolCounter/SpellSchoolCounter/SpellSchoolCounterPlugin.cs +++ b/SpellSchoolCounter/SpellSchoolCounter/SpellSchoolCounterPlugin.cs @@ -7,7 +7,7 @@ namespace SpellSchoolCounter { public class SpellSchoolCounterPlugin : IPlugin { - private SchoolCountWidget2 _widget; + private SchoolCountWidget _widget; public string Author { @@ -40,16 +40,16 @@ public void OnButtonPress() public void OnLoad() { - _widget = new SchoolCountWidget2(); + _widget = new SchoolCountWidget(); Core.OverlayCanvas.Children.Add(_widget); - SpellSchoolCounter curvy = new SpellSchoolCounter(_widget); + SpellSchoolCounter counter = new SpellSchoolCounter(_widget); - GameEvents.OnGameStart.Add(curvy.GameStart); - GameEvents.OnInMenu.Add(curvy.InMenu); - GameEvents.OnTurnStart.Add(curvy.TurnStart); - GameEvents.OnPlayerPlay.Add(curvy.OnPlayerPlay); + GameEvents.OnPlayerHandMouseOver.Add(counter.PlayerHandMouseOver); + GameEvents.OnGameStart.Add(counter.GameStart); + GameEvents.OnInMenu.Add(counter.InMenu); + GameEvents.OnPlayerPlay.Add(counter.OnPlayerPlay); } public void OnUnload() @@ -63,7 +63,7 @@ public void OnUpdate() public Version Version { - get { return new Version(0,4,3); } + get { return new Version(1,0,0); } } } } \ No newline at end of file