Skip to content

Commit

Permalink
Team display shifts and resizes when multiple columns are needed and …
Browse files Browse the repository at this point in the history
…a Match Options pane is visible
  • Loading branch information
CCraigen committed Sep 1, 2023
1 parent aeebbf2 commit 207809c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
2 changes: 1 addition & 1 deletion GameMod/GameMod.csproj
Expand Up @@ -104,7 +104,7 @@
<Compile Include="AddOnLevelSort.cs" />
<Compile Include="AmbientUnload.cs" />
<Compile Include="AxisCountFix.cs" />
<Compile Include="MPRoundInfo.cs" />
<Compile Include="MPMatchInfo.cs" />
<Compile Include="FramerateLimiter.cs" />
<Compile Include="MPShips.cs" />
<Compile Include="MPColliderSwap.cs" />
Expand Down
12 changes: 8 additions & 4 deletions GameMod/MPRoundInfo.cs → GameMod/MPMatchInfo.cs
Expand Up @@ -12,10 +12,12 @@ public static class MPMatchInfo
private const float LINE_SIZE = 18f;
private const float LEFT_OFFSET = 200f;

public static int powerup_bitmask = 0;
public static bool[] primarypowerups = new bool[8];
public static bool[] secondarypowerups = new bool[8];
public static bool disabledpowerups = false;
private static int powerup_bitmask = 0;
private static bool[] primarypowerups = new bool[8];
private static bool[] secondarypowerups = new bool[8];
private static bool disabledpowerups = false;

public static bool Displayed = false;

public static void DrawMatchInfo(UIElement uie, Vector2 position)
{
Expand Down Expand Up @@ -156,6 +158,8 @@ public static void DrawMatchInfo(UIElement uie, Vector2 position)
position.y += 15f;
UIManager.DrawQuadUI(position - Vector2.right * 100f, 110f, 1f, UIManager.m_col_ub1, uie.m_alpha, 21);
}

Displayed = show;
}

public static string GetColliderName(int collider)
Expand Down
27 changes: 21 additions & 6 deletions GameMod/MPTeams.cs
Expand Up @@ -197,15 +197,30 @@ public static void DrawTeamHeader(UIElement uie, Vector2 pos, MpTeam team, float

public static void DrawLobby(UIElement uie, Vector2 pos)
{
float name_offset = -250f;
float highlight_width = 285f;
float org_x = pos.x;
int max_row_count = NetworkMatch.GetMaxPlayersForMatch() + MPTeams.NetworkMatchTeamCount;
int cur_row_count = NetworkMatch.m_players.Count() + MPTeams.NetworkMatchTeamCount;
bool split = max_row_count > 10;

float highlight_width;
float name_offset;

if (MPMatchInfo.Displayed && split)
{
highlight_width = 245f;
name_offset = -210f;
pos.x -= 100f;
}
else
{
highlight_width = 285f;
name_offset = -250f;
}

float org_x = pos.x;

if (split)
{
pos.x -= 300f;
pos.x -= highlight_width + 15f;
pos.y += 50f + 24f;
}
float org_y = pos.y;
Expand All @@ -217,12 +232,12 @@ public static void DrawLobby(UIElement uie, Vector2 pos)
if (row_num >= rows_per_col)
{
first_y = pos.y;
pos.x += 300f * 2;
pos.x += (highlight_width + 15f) * 2;
pos.y = org_y;
rows_per_col = cur_row_count; // no more split
row_num = 0;
}
DrawTeamHeader(uie, pos, team, 255f);
DrawTeamHeader(uie, pos, team, highlight_width - 30f);
pos.y += 24f;
row_num++;
int num = 0;
Expand Down

0 comments on commit 207809c

Please sign in to comment.