Skip to content

Commit

Permalink
reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
fernando-cortez committed Jan 17, 2025
1 parent 003c718 commit 325168b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Assets/Scripts/Gameplay/UI/PartyHUD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ void SetAllyData(ClientPlayerAvatar clientPlayerAvatar)

ulong id = serverCharacter.NetworkObjectId;
int slot = FindOrAddAlly(id);

// do nothing if not in a slot
if (slot == -1)
{
Expand Down Expand Up @@ -187,18 +188,21 @@ void SetUIFromSlotData(int slot, ServerCharacter serverCharacter)
void SetAllyGodModeStatus(ulong id, bool newValue)
{
int slot = FindOrAddAlly(id, true);

// do nothing if not in a slot
if (slot == -1)
{
return;
}

m_PartyHealthGodModeImages[slot].gameObject.SetActive(newValue);
}
#endif

void SetAllyHealth(ulong id, int hp)
{
int slot = FindOrAddAlly(id, true);

// do nothing if not in a slot
if (slot == -1)
{
Expand Down Expand Up @@ -260,7 +264,7 @@ int FindOrAddAlly(ulong id, bool dontAdd = false)
// special case: id of 0 is uninitialized party id
return -1;
}

int openslot = -1;
for (int i = 0; i < m_PartyIds.Length; i++)
{
Expand All @@ -269,6 +273,7 @@ int FindOrAddAlly(ulong id, bool dontAdd = false)
{
return i;
}

// otherwise, record the first open slot (not slot 0 thats for the Hero)
if (openslot == -1 && i > 0 && m_PartyIds[i] == 0)
{
Expand All @@ -284,6 +289,7 @@ int FindOrAddAlly(ulong id, bool dontAdd = false)
{
// activeate the correct ally panel
m_AllyPanel[openslot - 1].SetActive(true);

// and save ally ID to party array
m_PartyIds[openslot] = id;
return openslot;
Expand Down Expand Up @@ -314,13 +320,14 @@ void RemoveAlly(ulong id)
{
// remove potential selected state of party member UI
SetHeroSelectFX(id, false);

for (int i = 0; i < m_PartyIds.Length; i++)
{
// if this ID is in the list, return the slot index
if (m_PartyIds[i] == id)
{
m_AllyPanel[i - 1].SetActive(false);

// and save ally ID to party array
m_PartyIds[i] = 0;
}
Expand Down

0 comments on commit 325168b

Please sign in to comment.