Skip to content

Commit

Permalink
* fixed a bug, which caused the GoldDifference window to spawn withou…
Browse files Browse the repository at this point in the history
…t the team being initialized correctly

* increase the Team stats sizing slightly
  • Loading branch information
Johannes-Schneider committed Nov 20, 2020
1 parent a2d2b36 commit 04a9523
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
25 changes: 19 additions & 6 deletions GoldDiff/LeagueOfLegends/Game/LoLGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void GameClientClosed()

State = LoLGameStateType.Ended;
}

public void Consume(LoLClientGameData? gameData)
{
if (gameData == null)
Expand Down Expand Up @@ -125,6 +125,7 @@ public void Consume(LoLClientGameData? gameData)
{
EventDispatcher!.Invoke(() => Initialized.Invoke(this, EventArgs.Empty));
}

EventDispatcher!.Invoke(() => GameDataReceived?.Invoke(this, gameData));
}

Expand All @@ -134,18 +135,30 @@ private bool Initialize(LoLClientGameData gameData)
{
return true;
}

Mode = gameData.Stats.GameMode;
if (Mode != LoLGameModeType.Classic5X5 && Mode != LoLGameModeType.PracticeTool)
if (Mode != LoLGameModeType.Classic5X5
#if DEBUG
&& Mode != LoLGameModeType.PracticeTool
#endif
)
{
// We do support only classic 5v5 games right now
State = LoLGameStateType.Undefined;
return false;
}

var teams = LoLTeamFactory.ExtractTeams(gameData, StaticResourceCache).ToList();
TeamBlueSide = teams.FirstOrDefault(team => team.Side == LoLTeamType.BlueSide) ?? new LoLTeam(LoLTeamType.BlueSide, Enumerable.Empty<LoLPlayer>());
TeamRedSide = teams.FirstOrDefault(team => team.Side == LoLTeamType.RedSide) ?? new LoLTeam(LoLTeamType.RedSide, Enumerable.Empty<LoLPlayer>());
TeamBlueSide = teams.FirstOrDefault(team => team.Side == LoLTeamType.BlueSide);
TeamRedSide = teams.FirstOrDefault(team => team.Side == LoLTeamType.RedSide);

if (TeamBlueSide == null && TeamRedSide == null)
{
return false;
}

TeamBlueSide ??= new LoLTeam(LoLTeamType.BlueSide, Enumerable.Empty<LoLPlayer>());
TeamRedSide ??= new LoLTeam(LoLTeamType.RedSide, Enumerable.Empty<LoLPlayer>());

RespawnTimerCollection = new LoLRespawnTimerCollection();
TeamPowerPlayCollection = new LoLTeamPowerPlayCollection(this);
Expand Down
8 changes: 4 additions & 4 deletions GoldDiff/View/ControlElement/LoLGameView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="24" /> <!-- Spacing Left -->
<ColumnDefinition Width="1.5*" MinWidth="32" /> <!-- Blue Side Inhibitor Respawn Timers -->
<ColumnDefinition Width="1*" MinWidth="32" /> <!-- Blue Side Inhibitor Respawn Timers -->
<ColumnDefinition Width="2.5*" MinWidth="32" /> <!-- Blue Side Stats -->
<ColumnDefinition Width="1.5*" MinWidth="32" /> <!-- Blue Side Total Gold -->
<ColumnDefinition Width="1*" MinWidth="32" /> <!-- Blue Side Total Gold -->
<ColumnDefinition Width="Auto" /> <!-- Gold Difference -->
<ColumnDefinition Width="1.5*" MinWidth="32" /> <!-- Red Side Total Gold -->
<ColumnDefinition Width="1*" MinWidth="32" /> <!-- Red Side Total Gold -->
<ColumnDefinition Width="2.5*" MinWidth="32" /> <!-- Red Side Stats -->
<ColumnDefinition Width="1.5*" MinWidth="32" /> <!-- Red Side Inhibitor Respawn Timers -->
<ColumnDefinition Width="1*" MinWidth="32" /> <!-- Red Side Inhibitor Respawn Timers -->
<ColumnDefinition Width="24" /> <!-- Spacing Right -->
</Grid.ColumnDefinitions>

Expand Down
3 changes: 2 additions & 1 deletion GoldDiff/View/GoldDifferenceWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
</Window.Topmost>

<Window.Resources>
<system:Double x:Key="TeamRowMinimumHeight">64</system:Double>
<system:Double x:Key="RowMinimumHeight">48</system:Double>
<LinearGradientBrush x:Key="{x:Static local:GoldDifferenceWindow.ActivePlayerOnBlueSideBackground}" StartPoint="0, 0.5" EndPoint="1, 0.5" Opacity="0.35">
<GradientStop Offset="0" Color="{DynamicResource {x:Static sharedTheme:GoldDiffSharedThemeKeys.LoLActivePlayerRegularColor}}" />
Expand All @@ -47,7 +48,7 @@

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" MinHeight="{StaticResource RowMinimumHeight}" />
<RowDefinition Height="1.5*" MinHeight="{StaticResource TeamRowMinimumHeight}" />
<RowDefinition Height="*" MinHeight="{StaticResource RowMinimumHeight}" />
<RowDefinition Height="*" MinHeight="{StaticResource RowMinimumHeight}" />
<RowDefinition Height="*" MinHeight="{StaticResource RowMinimumHeight}" />
Expand Down

0 comments on commit 04a9523

Please sign in to comment.