From 325168bedea0d3c41f9b764ef7eb66606a0ea9d6 Mon Sep 17 00:00:00 2001 From: Fernando Cortez Date: Fri, 17 Jan 2025 11:30:04 -0500 Subject: [PATCH] reformatting --- Assets/Scripts/Gameplay/UI/PartyHUD.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Gameplay/UI/PartyHUD.cs b/Assets/Scripts/Gameplay/UI/PartyHUD.cs index 342bcd4af..dfc346198 100644 --- a/Assets/Scripts/Gameplay/UI/PartyHUD.cs +++ b/Assets/Scripts/Gameplay/UI/PartyHUD.cs @@ -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) { @@ -187,11 +188,13 @@ 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 @@ -199,6 +202,7 @@ void SetAllyGodModeStatus(ulong id, bool newValue) void SetAllyHealth(ulong id, int hp) { int slot = FindOrAddAlly(id, true); + // do nothing if not in a slot if (slot == -1) { @@ -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++) { @@ -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) { @@ -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; @@ -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; }