Skip to content

Commit

Permalink
Merge pull request HearthSim#1263 from zachwlewis/chance-ui
Browse files Browse the repository at this point in the history
Implemented new art for card chances.
  • Loading branch information
Epix committed Aug 21, 2015
2 parents db7c30d + 215c3ba commit 477c246
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 91 deletions.
2 changes: 2 additions & 0 deletions Hearthstone Deck Tracker/Hearthstone Deck Tracker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,8 @@
<Content Include="Images\bluegill-warrior.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Resource Include="Images\opponent-chance-frame.png" />
<Resource Include="Images\player-chance-frame.png" />
<Content Include="Images\thunder-bluff-valiant.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down
Binary file modified Hearthstone Deck Tracker/Images/frame_card_counter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 16 additions & 9 deletions Hearthstone Deck Tracker/Windows/OpponentWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:local="clr-namespace:Hearthstone_Deck_Tracker"
xmlns:deckPicker="clr-namespace:Hearthstone_Deck_Tracker.Controls.DeckPicker"
xmlns:controls1="clr-namespace:Hearthstone_Deck_Tracker.Controls"
Title="Opponent" Height="440" Width="226" MinWidth="226" MaxWidth="226"
Title="Opponent" Height="440" Width="230" MinWidth="230" MaxWidth="230"
Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
SizeChanged="Window_SizeChanged_1" Activated="Window_Activated_1"
Icon="/HearthstoneDeckTracker;component/Images/HearthstoneDeckTracker.ico"
Expand Down Expand Up @@ -58,15 +58,22 @@
</Style>
</ListView.Resources>
</controls1:DeckListView>
<local:HearthstoneTextBlock x:Name="LblOpponentDrawChance2" FontSize="16" Text="0%" />
<local:HearthstoneTextBlock x:Name="LblOpponentDrawChance1" FontSize="16" Text="0%" />
<StackPanel Name="StackPanelCount" Orientation="Horizontal" HorizontalAlignment="Stretch" Height="35" Width="218" Margin="0,5">
<StackPanel.Background>
<Canvas Name="CanvasOpponentCount" HorizontalAlignment="Stretch" Height="40" Width="218" Margin="0,2">
<Canvas.Background>
<ImageBrush ImageSource="/HearthstoneDeckTracker;component/Images/frame_card_counter.png"/>
</StackPanel.Background>
<local:HearthstoneTextBlock x:Name="LblOpponentCardCount" FontSize="18" Text="3" VerticalAlignment="Center" TextAlignment="Center" Width="48" HorizontalAlignment="Left" Margin="50,0,0,0" />
<local:HearthstoneTextBlock x:Name="LblOpponentDeckCount" FontSize="18" Text="27" TextAlignment="Center" Width="48" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="20,0,0,0" />
</StackPanel>
</Canvas.Background>
<local:HearthstoneTextBlock x:Name="LblOpponentCardCount" FontSize="18" Text="0" Canvas.Left="57" Canvas.Top="8" TextAlignment="Center" Width="56" />
<local:HearthstoneTextBlock x:Name="LblOpponentDeckCount" FontSize="18" Text="30" Canvas.Left="152" Canvas.Top="8" TextAlignment="Center" Width="56" />
</Canvas>
<Canvas Name="CanvasOpponentChance" HorizontalAlignment="Stretch" Height="71" Width="218" Margin="0,2">
<Canvas.Background>
<ImageBrush ImageSource="/HearthstoneDeckTracker;component/Images/opponent-chance-frame.png"/>
</Canvas.Background>
<local:HearthstoneTextBlock x:Name="LblOpponentDrawChance1" FontSize="18" Text="0%" Canvas.Left="71" Canvas.Top="8" TextAlignment="Right" Width="55" />
<local:HearthstoneTextBlock x:Name="LblOpponentDrawChance2" FontSize="18" Text="0%" Canvas.Left="149" Canvas.Top="8" TextAlignment="Right" Width="55" />
<local:HearthstoneTextBlock x:Name="LblOpponentHandChance1" FontSize="18" Text="0%" Canvas.Left="71" Canvas.Top="39" TextAlignment="Right" Width="55" />
<local:HearthstoneTextBlock x:Name="LblOpponentHandChance2" FontSize="18" Text="0%" Canvas.Left="149" Canvas.Top="39" TextAlignment="Right" Width="55" />
</Canvas>
<StackPanel Name="StackPanelOpponentFatigue" Orientation="Horizontal" HorizontalAlignment="Center">
<local:HearthstoneTextBlock x:Name="LblOpponentFatigue" FontSize="14" Text="" Margin="4,0,0,0" />
</StackPanel>
Expand Down
22 changes: 9 additions & 13 deletions Hearthstone Deck Tracker/Windows/OpponentWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ public bool ShowToolTip
public void Update()
{
LblWinRateAgainst.Visibility = Config.Instance.ShowWinRateAgainst && Game.IsUsingPremade ? Visibility.Visible : Visibility.Collapsed;
LblOpponentDrawChance1.Visibility = _config.HideOpponentDrawChances ? Visibility.Collapsed : Visibility.Visible;
LblOpponentDrawChance2.Visibility = _config.HideOpponentDrawChances ? Visibility.Collapsed : Visibility.Visible;
StackPanelCount.Visibility = _config.HideOpponentCardCount ? Visibility.Collapsed : Visibility.Visible;
CanvasOpponentChance.Visibility = _config.HideOpponentDrawChances ? Visibility.Collapsed : Visibility.Visible;
CanvasOpponentCount.Visibility = _config.HideOpponentCardCount ? Visibility.Collapsed : Visibility.Visible;
ListViewOpponent.Visibility = _config.HideOpponentCards ? Visibility.Collapsed : Visibility.Visible;

var selectedDeck = DeckList.Instance.ActiveDeck;
Expand All @@ -88,11 +87,10 @@ public void UpdateOpponentLayout()
StackPanelMain.Children.Add(ListViewOpponent);
break;
case "Draw Chances":
StackPanelMain.Children.Add(LblOpponentDrawChance1);
StackPanelMain.Children.Add(LblOpponentDrawChance2);
StackPanelMain.Children.Add(CanvasOpponentChance);
break;
case "Card Counter":
StackPanelMain.Children.Add(StackPanelCount);
StackPanelMain.Children.Add(CanvasOpponentCount);
break;
case "Fatigue Counter":
StackPanelMain.Children.Add(StackPanelOpponentFatigue);
Expand Down Expand Up @@ -190,18 +188,16 @@ public void SetTextLocation(bool top)
StackPanelMain.Children.Clear();
if(top)
{
StackPanelMain.Children.Add(LblOpponentDrawChance2);
StackPanelMain.Children.Add(LblOpponentDrawChance1);
StackPanelMain.Children.Add(StackPanelCount);
StackPanelMain.Children.Add(CanvasOpponentChance);
StackPanelMain.Children.Add(CanvasOpponentCount);
StackPanelMain.Children.Add(ListViewOpponent);
}
else
{
StackPanelMain.Children.Add(ListViewOpponent);
StackPanelMain.Children.Add(LblOpponentDrawChance2);
StackPanelMain.Children.Add(LblOpponentDrawChance1);
StackPanelMain.Children.Add(StackPanelCount);
}
StackPanelMain.Children.Add(CanvasOpponentChance);
StackPanelMain.Children.Add(CanvasOpponentCount);
}
}
}
}
53 changes: 32 additions & 21 deletions Hearthstone Deck Tracker/Windows/OverlayWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<TextBox x:Name="LblDebugLog" Text="Test" TextWrapping="Wrap" FontSize="14" Foreground="Aqua" />
</ScrollViewer>

<StackPanel Name="StackPanelPlayer" Canvas.Left="438" Canvas.Top="47" Width="218">
<StackPanel Name="StackPanelPlayer" Canvas.Left="604" Canvas.Top="203" Width="218">
<local:HearthstoneTextBlock x:Name="LblDeckTitle" FontSize="16" Text="Deck title" />
<local:HearthstoneTextBlock x:Name="LblWins" FontSize="16" Text="0 - 0 (0%)" />
<controls:DeckListView x:Name="ListViewPlayer" Height="auto" Canvas.Left="350" Canvas.Top="147"
Expand All @@ -45,23 +45,26 @@
</Style>
</ListView.Resources>
</controls:DeckListView>
<StackPanel Name="StackPanelPlayerCount" Orientation="Horizontal" HorizontalAlignment="Stretch" Height="35" Width="218" Margin="0,5">
<StackPanel.Background>
<Canvas Name="CanvasPlayerCount" HorizontalAlignment="Stretch" Height="40" Width="218" Margin="0,2">
<Canvas.Background>
<ImageBrush ImageSource="/HearthstoneDeckTracker;component/Images/frame_card_counter.png"/>
</StackPanel.Background>
<local:HearthstoneTextBlock x:Name="LblCardCount" FontSize="18" Text="3" VerticalAlignment="Center" TextAlignment="Center" Width="48" HorizontalAlignment="Left" Margin="50,0,0,0" />
<local:HearthstoneTextBlock x:Name="LblDeckCount" FontSize="18" Text="27" TextAlignment="Center" Width="48" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="20,0,0,0" />
</StackPanel>
<StackPanel Name="StackPanelPlayerDraw" Orientation="Horizontal" HorizontalAlignment="Center">
<local:HearthstoneTextBlock x:Name="LblDrawChance2" FontSize="16" Text="0%" />
<local:HearthstoneTextBlock x:Name="LblDrawChance1" FontSize="16" Text="0%" Margin="4,0,0,0" />
</StackPanel>
</Canvas.Background>
<local:HearthstoneTextBlock x:Name="LblCardCount" FontSize="18" Text="0" Canvas.Left="57" Canvas.Top="8" TextAlignment="Center" Width="56" />
<local:HearthstoneTextBlock x:Name="LblDeckCount" FontSize="18" Text="30" Canvas.Left="152" Canvas.Top="8" TextAlignment="Center" Width="56" />
</Canvas>
<Canvas Name="CanvasPlayerChance" HorizontalAlignment="Stretch" Height="40" Width="218" Margin="0,2">
<Canvas.Background>
<ImageBrush ImageSource="/HearthstoneDeckTracker;component/Images/player-chance-frame.png"/>
</Canvas.Background>
<local:HearthstoneTextBlock x:Name="LblDrawChance1" FontSize="18" Text="0%" Canvas.Left="71" Canvas.Top="8" TextAlignment="Right" Width="55" />
<local:HearthstoneTextBlock x:Name="LblDrawChance2" FontSize="18" Text="0%" Canvas.Left="149" Canvas.Top="8" TextAlignment="Right" Width="55" />
</Canvas>
<StackPanel Name="StackPanelPlayerFatigue" Orientation="Horizontal" HorizontalAlignment="Center">
<local:HearthstoneTextBlock x:Name="LblPlayerFatigue" FontSize="14" Text="" Margin="4,0,0,0" />
</StackPanel>

</StackPanel>
<StackPanel Name="StackPanelOpponent" Width="218">
<StackPanel Name="StackPanelOpponent" Width="218" Canvas.Top="203" Canvas.Left="10">
<Viewbox StretchDirection="DownOnly" Name="ViewBoxWinRateAgainst">
<local:HearthstoneTextBlock x:Name="LblWinRateAgainst" FontSize="16" Text="VS: 0 - 0 (0%)"/>
</Viewbox>
Expand All @@ -83,15 +86,23 @@
</Style>
</ListView.Resources>
</controls:DeckListView>
<StackPanel Name="StackPanelOpponentCount" Orientation="Horizontal" HorizontalAlignment="Stretch" Height="35" Width="218" Margin="0,5">
<StackPanel.Background>
<Canvas Name="CanvasOpponentCount" HorizontalAlignment="Stretch" Height="40" Width="218" Margin="0,2">
<Canvas.Background>
<ImageBrush ImageSource="/HearthstoneDeckTracker;component/Images/frame_card_counter.png"/>
</StackPanel.Background>
<local:HearthstoneTextBlock x:Name="LblOpponentCardCount" FontSize="18" Text="3" VerticalAlignment="Center" TextAlignment="Center" Width="48" HorizontalAlignment="Left" Margin="50,0,0,0" />
<local:HearthstoneTextBlock x:Name="LblOpponentDeckCount" FontSize="18" Text="27" TextAlignment="Center" Width="48" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="20,0,0,0" />
</StackPanel>
<local:HearthstoneTextBlock x:Name="LblOpponentDrawChance2" FontSize="16" Text="0%" />
<local:HearthstoneTextBlock x:Name="LblOpponentDrawChance1" FontSize="16" Text="0%" />
</Canvas.Background>
<local:HearthstoneTextBlock x:Name="LblOpponentCardCount" FontSize="18" Text="0" Canvas.Left="57" Canvas.Top="8" TextAlignment="Center" Width="56" />
<local:HearthstoneTextBlock x:Name="LblOpponentDeckCount" FontSize="18" Text="30" Canvas.Left="152" Canvas.Top="8" TextAlignment="Center" Width="56" />
</Canvas>
<Canvas Name="CanvasOpponentChance" HorizontalAlignment="Stretch" Height="71" Width="218" Margin="0,2">
<Canvas.Background>
<ImageBrush ImageSource="/HearthstoneDeckTracker;component/Images/opponent-chance-frame.png"/>
</Canvas.Background>
<local:HearthstoneTextBlock x:Name="LblOpponentDrawChance1" FontSize="18" Text="0%" Canvas.Left="71" Canvas.Top="8" TextAlignment="Right" Width="55" />
<local:HearthstoneTextBlock x:Name="LblOpponentDrawChance2" FontSize="18" Text="0%" Canvas.Left="149" Canvas.Top="8" TextAlignment="Right" Width="55" />
<local:HearthstoneTextBlock x:Name="LblOpponentHandChance1" FontSize="18" Text="0%" Canvas.Left="71" Canvas.Top="39" TextAlignment="Right" Width="55" />
<local:HearthstoneTextBlock x:Name="LblOpponentHandChance2" FontSize="18" Text="0%" Canvas.Left="149" Canvas.Top="39" TextAlignment="Right" Width="55" />
</Canvas>

<StackPanel Name="StackPanelOpponentFatigue" Orientation="Horizontal" HorizontalAlignment="Center">
<local:HearthstoneTextBlock x:Name="LblOpponentFatigue" FontSize="14" Text="" Margin="4,0,0,0" />
</StackPanel>
Expand Down
52 changes: 27 additions & 25 deletions Hearthstone Deck Tracker/Windows/OverlayWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,22 +353,26 @@ private void SetOpponentCardCount(int cardCount, int cardsLeftInDeck)
{
LblOpponentFatigue.Text = "Next draw fatigues for: " + (Game.OpponentFatigueCount + 1);

LblOpponentDrawChance2.Text = cardCount <= 0 ? "[2]: -% / -%" : "[2]: 100% / -%";
LblOpponentDrawChance1.Text = cardCount <= 0 ? "[1]: -% / -%" : "[1]: 100% / -%";
return;
LblOpponentDrawChance2.Text = "0%";
LblOpponentDrawChance1.Text = "0%";
LblOpponentHandChance2.Text = cardCount <= 0 ? "0%" : "100%"; ;
LblOpponentHandChance1.Text = cardCount <= 0 ? "0%" : "100%";
return;
}
LblOpponentFatigue.Text = "";

var handWithoutCoin = cardCount - (Game.OpponentHasCoin ? 1 : 0);

var holdingNextTurn2 = Math.Round(100.0f * Helper.DrawProbability(2, (cardsLeftInDeck + handWithoutCoin), handWithoutCoin + 1), 2);
var drawNextTurn2 = Math.Round(200.0f / cardsLeftInDeck, 2);
LblOpponentDrawChance2.Text = "[2]: " + holdingNextTurn2 + "% / " + drawNextTurn2 + "%";
var holdingNextTurn2 = Math.Round(100.0f * Helper.DrawProbability(2, (cardsLeftInDeck + handWithoutCoin), handWithoutCoin + 1), 1);
var drawNextTurn2 = Math.Round(200.0f / cardsLeftInDeck, 1);
LblOpponentDrawChance2.Text = drawNextTurn2 + "%";
LblOpponentHandChance2.Text = holdingNextTurn2 + "%";

var holdingNextTurn = Math.Round(100.0f * Helper.DrawProbability(1, (cardsLeftInDeck + handWithoutCoin), handWithoutCoin + 1), 2);
var drawNextTurn = Math.Round(100.0f / cardsLeftInDeck, 2);
LblOpponentDrawChance1.Text = "[1]: " + holdingNextTurn + "% / " + drawNextTurn + "%";
}
var holdingNextTurn = Math.Round(100.0f * Helper.DrawProbability(1, (cardsLeftInDeck + handWithoutCoin), handWithoutCoin + 1), 1);
var drawNextTurn = Math.Round(100.0f / cardsLeftInDeck, 1);
LblOpponentDrawChance1.Text = drawNextTurn + "%";
LblOpponentHandChance1.Text = holdingNextTurn + "%";
}

private void SetCardCount(int cardCount, int cardsLeftInDeck)
{
Expand All @@ -384,14 +388,14 @@ private void SetCardCount(int cardCount, int cardsLeftInDeck)
{
LblPlayerFatigue.Text = "Next draw fatigues for: " + (Game.PlayerFatigueCount + 1);

LblDrawChance2.Text = "[2]: -%";
LblDrawChance1.Text = "[1]: -%";
LblDrawChance2.Text = "0%";
LblDrawChance1.Text = "0%";
return;
}
LblPlayerFatigue.Text = "";

LblDrawChance2.Text = "[2]: " + Math.Round(200.0f / cardsLeftInDeck, 2) + "%";
LblDrawChance1.Text = "[1]: " + Math.Round(100.0f / cardsLeftInDeck, 2) + "%";
LblDrawChance2.Text = Math.Round(200.0f / cardsLeftInDeck, 1) + "%";
LblDrawChance1.Text = Math.Round(100.0f / cardsLeftInDeck, 1) + "%";
}

public void ShowOverlay(bool enable)
Expand Down Expand Up @@ -584,15 +588,14 @@ public void Update(bool refresh)
&& !_uiMovable ? Visibility.Collapsed : Visibility.Visible;
}

LblDrawChance1.Visibility = Config.Instance.HideDrawChances ? Visibility.Collapsed : Visibility.Visible;
LblDrawChance2.Visibility = Config.Instance.HideDrawChances ? Visibility.Collapsed : Visibility.Visible;
CanvasPlayerChance.Visibility = Config.Instance.HideDrawChances ? Visibility.Collapsed : Visibility.Visible;
LblPlayerFatigue.Visibility = Config.Instance.HidePlayerFatigueCount ? Visibility.Collapsed : Visibility.Visible;
StackPanelPlayerCount.Visibility = Config.Instance.HidePlayerCardCount ? Visibility.Collapsed : Visibility.Visible;
CanvasPlayerCount.Visibility = Config.Instance.HidePlayerCardCount ? Visibility.Collapsed : Visibility.Visible;

LblOpponentDrawChance1.Visibility = Config.Instance.HideOpponentDrawChances ? Visibility.Collapsed : Visibility.Visible;
LblOpponentDrawChance2.Visibility = Config.Instance.HideOpponentDrawChances ? Visibility.Collapsed : Visibility.Visible;
CanvasOpponentChance.Visibility = Config.Instance.HideOpponentDrawChances ? Visibility.Collapsed : Visibility.Visible;
LblOpponentFatigue.Visibility = Config.Instance.HideOpponentFatigueCount ? Visibility.Collapsed : Visibility.Visible;
StackPanelOpponentCount.Visibility = Config.Instance.HideOpponentCardCount ? Visibility.Collapsed : Visibility.Visible;
CanvasOpponentCount.Visibility = Config.Instance.HideOpponentCardCount ? Visibility.Collapsed : Visibility.Visible;

if(Game.IsInMenu && !_uiMovable)
HideTimers();

Expand Down Expand Up @@ -972,10 +975,10 @@ public void UpdatePlayerLayout()
StackPanelPlayer.Children.Add(ListViewPlayer);
break;
case "Draw Chances":
StackPanelPlayer.Children.Add(StackPanelPlayerDraw);
StackPanelPlayer.Children.Add(CanvasPlayerChance);
break;
case "Card Counter":
StackPanelPlayer.Children.Add(StackPanelPlayerCount);
StackPanelPlayer.Children.Add(CanvasPlayerCount);
break;
case "Fatigue Counter":
StackPanelPlayer.Children.Add(StackPanelPlayerFatigue);
Expand All @@ -1001,11 +1004,10 @@ public void UpdateOpponentLayout()
StackPanelOpponent.Children.Add(ListViewOpponent);
break;
case "Draw Chances":
StackPanelOpponent.Children.Add(LblOpponentDrawChance1);
StackPanelOpponent.Children.Add(LblOpponentDrawChance2);
StackPanelOpponent.Children.Add(CanvasOpponentChance);
break;
case "Card Counter":
StackPanelOpponent.Children.Add(StackPanelOpponentCount);
StackPanelOpponent.Children.Add(CanvasOpponentCount);
break;
case "Fatigue Counter":
StackPanelOpponent.Children.Add(StackPanelOpponentFatigue);
Expand Down
Loading

0 comments on commit 477c246

Please sign in to comment.