Move from deprecated functions for finding objects

This commit is contained in:
Lncvrt committed 2026-04-04 07:39:58 -07:00
1 parent 131ac97281
commit 9bf20cb727
13 files changed
+21 -21

No files matched your search

@@ -135,7 +135,7 @@ public class AccountHandler : MonoBehaviour {
accountForgotDetails.gameObject.SetActive(true);
break;
}
foreach (CustomColorObject customColorObject in FindObjectsByType<CustomColorObject>(FindObjectsSortMode.None)) customColorObject.SetColor();
foreach (CustomColorObject customColorObject in FindObjectsByType<CustomColorObject>()) customColorObject.SetColor();
}
void Update() {
@@ -128,7 +128,7 @@ public class AccountLoggedIn : MonoBehaviour {
QualitySettings.vSyncCount = 0;
}
MenuMusic.Instance.GetComponent<AudioSource>().volume = BazookaManager.Instance.GetSettingMusicVolume();
foreach (CustomColorObject customColorObject in FindObjectsByType<CustomColorObject>(FindObjectsSortMode.None)) customColorObject.SetColor();
foreach (CustomColorObject customColorObject in FindObjectsByType<CustomColorObject>()) customColorObject.SetColor();
}
Tools.UpdateStatusText(loggedInText, (string)jsonResponse["message"], (bool)jsonResponse["success"] ? Color.green : Color.red);
loggedInChangeUsernameButton.interactable = true;
@@ -78,13 +78,13 @@ public class ChatroomPrefab : MonoBehaviour {
}
statusText.text = "";
StartCoroutine(ScrollToBottom());
CustomIconLoader.Init(FindObjectsByType<WaitingForCustomIcon>(FindObjectsSortMode.None));
CustomIconLoader.Init(FindObjectsByType<WaitingForCustomIcon>());
} else if (data["for"].ToString() == "upload:chatroom_message") {
var userId = BazookaManager.Instance.GetAccountID();
var chatMessage = data["data"].ToObject<ChatroomMessage>();
Destroy(content.transform.GetChild(1).gameObject);
InsertMessage(chatMessage, userId);
CustomIconLoader.Init(FindObjectsByType<WaitingForCustomIcon>(FindObjectsSortMode.None));
CustomIconLoader.Init(FindObjectsByType<WaitingForCustomIcon>());
} else if (data["for"].ToString() == "delete:chatroom_message") {
Destroy(content.transform.Find("ChatroomRow_" + data["data"]["id"].ToString() ?? "").gameObject);
if (data["data"]["fillerMessage"].ToString() != null) {
@@ -92,7 +92,7 @@ public class ChatroomPrefab : MonoBehaviour {
var chatMessage = data["data"]["fillerMessage"].ToObject<ChatroomMessage>();
var row = InsertMessage(chatMessage, userId);
row.transform.SetSiblingIndex(1);
CustomIconLoader.Init(FindObjectsByType<WaitingForCustomIcon>(FindObjectsSortMode.None));
CustomIconLoader.Init(FindObjectsByType<WaitingForCustomIcon>());
}
} else if (data["for"].ToString() == "edit:chatroom_message") {
if (data["data"]["newContent"].ToString() != null) {
@@ -259,7 +259,7 @@ public class ChatroomPrefab : MonoBehaviour {
optionsPanel.SetActive(false);
editMessage.SetActive(true);
CustomIconLoader.Init(FindObjectsByType<WaitingForCustomIcon>(FindObjectsSortMode.None));
CustomIconLoader.Init(FindObjectsByType<WaitingForCustomIcon>());
});
optionsPanelReportButton.onClick.AddListener(() => {
reportMessagePanelReportReason.text = "";
@@ -348,7 +348,7 @@ public class ChatroomPrefab : MonoBehaviour {
var max = content.GetComponent<RectTransform>().sizeDelta.y;
var current = content.transform.localPosition.y;
downButton.gameObject.SetActive(Mathf.Abs(max - current) > 0.1f * max);
if (Keyboard.current.escapeKey.wasPressedThisFrame && FindFirstObjectByType<ProfilePrefab>() == null) {
if (Keyboard.current.escapeKey.wasPressedThisFrame && FindAnyObjectByType<ProfilePrefab>() == null) {
if (optionsPanel.activeSelf) optionsPanelExitButton.onClick.Invoke();
else if (reportMessagePanel.activeSelf) reportMessagePanelExitButton.onClick.Invoke();
else if (editMessagePanelCurrent != null) editMessagePanelCurrent.transform.GetChild(0).GetChild(0).GetComponent<Button>().onClick.Invoke();
@@ -188,7 +188,7 @@ public class IconMarketplaceDownloadIcon : MonoBehaviour {
newIcon.SetActive(true);
Tools.RefreshHierarchy(newIcon);
}
CustomIconLoader.Init(FindObjectsByType<WaitingForCustomIcon>(FindObjectsSortMode.None));
CustomIconLoader.Init(FindObjectsByType<WaitingForCustomIcon>());
refreshButton.interactable = true;
optionsButton.interactable = true;
backButton.interactable = true;
@@ -210,7 +210,7 @@ public class IconkitPrefab : MonoBehaviour {
}
void RenderIcons() {
var objects = FindObjectsByType<WaitingForCustomIcon>(FindObjectsSortMode.None);
var objects = FindObjectsByType<WaitingForCustomIcon>();
if (objects.Length != 0) CustomIconLoader.Init(objects);
}
}
@@ -211,7 +211,7 @@ public class LeaderboardsPrefab : MonoBehaviour {
entryInfo.SetActive(true);
}
}
CustomIconLoader.Init(FindObjectsByType<WaitingForCustomIcon>(FindObjectsSortMode.None));
CustomIconLoader.Init(FindObjectsByType<WaitingForCustomIcon>());
} else {
UpdateStatus(true, (string)jsonResponse["message"]);
}
@@ -225,7 +225,7 @@ public class LeaderboardsPrefab : MonoBehaviour {
}
void Update() {
if (Keyboard.current.escapeKey.wasPressedThisFrame && FindFirstObjectByType<ProfilePrefab>() == null) {
if (Keyboard.current.escapeKey.wasPressedThisFrame && FindAnyObjectByType<ProfilePrefab>() == null) {
if (selectionPanel.activeSelf && mainBackButton.interactable) mainBackButton.onClick.Invoke();
else if (scoresPanel.activeSelf && berryBackButton.interactable) berryBackButton.onClick.Invoke();
}
@@ -35,14 +35,14 @@ public class SettingsMenu : MonoBehaviour {
else if (colorType == 3) BazookaManager.Instance.SetColorSettingButtonContent(color);
else if (colorType == 4) BazookaManager.Instance.SetColorSettingText(color);
foreach (CustomColorObject customColorObject in FindObjectsByType<CustomColorObject>(FindObjectsSortMode.None)) customColorObject.SetColor();
foreach (CustomColorObject customColorObject in FindObjectsByType<CustomColorObject>()) customColorObject.SetColor();
};
exitButton.onClick.AddListener(() => Destroy(gameObject));
toggleButton.onClick.AddListener(() => {
settingsMenu.SetActive(!settingsMenu.activeSelf);
colorMenu.gameObject.SetActive(!colorMenu.gameObject.activeSelf);
SwitchColorType(4);
foreach (CustomColorObject customColorObject in FindObjectsByType<CustomColorObject>(FindObjectsSortMode.None)) customColorObject.SetColor();
foreach (CustomColorObject customColorObject in FindObjectsByType<CustomColorObject>()) customColorObject.SetColor();
});
switchColorTypeButton.onClick.AddListener(() => SwitchColorType());
@@ -75,7 +75,7 @@ public class UserSearchPrefab : MonoBehaviour {
});
entryInfo.SetActive(true);
}
CustomIconLoader.Init(FindObjectsByType<WaitingForCustomIcon>(FindObjectsSortMode.None));
CustomIconLoader.Init(FindObjectsByType<WaitingForCustomIcon>());
} else {
UpdateStatus(true, (string)jsonResponse["message"]);
}
@@ -83,7 +83,7 @@ public class UserSearchPrefab : MonoBehaviour {
}
void Update() {
if (Keyboard.current.escapeKey.wasPressedThisFrame && FindFirstObjectByType<ProfilePrefab>() == null && backButton.interactable) backButton.onClick.Invoke();
if (Keyboard.current.escapeKey.wasPressedThisFrame && FindAnyObjectByType<ProfilePrefab>() == null && backButton.interactable) backButton.onClick.Invoke();
}
private void UpdateStatus(bool enabled, string message = "") {