Make user search, chatroom, leaderboards and icon marketplace into a popup

This commit is contained in:
Lncvrt committed 2026-03-16 21:43:00 -07:00
1 parent 70687c2856
commit 06ba845790
52 files changed
+30178 -31455

No files matched your search

+1 -1
View File
@@ -17049,7 +17049,7 @@ Canvas:
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_SortingOrder: 999
m_TargetDisplay: 0
--- !u!114 &1759020458268336183
MonoBehaviour:
File diff suppressed because it is too large. Load diff
@@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: 7cac5956257281848842dff97b10124b
DefaultImporter:
guid: e1a37328c6ce743648d56c1a30ea3d80
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
File diff suppressed because it is too large. Load diff
@@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: 6d51f8ef1f7d4f01a8416e468a7ed278
DefaultImporter:
guid: 7a63b3c695e6f48b7b9e37022024529c
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
+2 -2
View File
@@ -7118,7 +7118,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -0.000061035156, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6008663641036732197
@@ -12634,7 +12634,7 @@ Canvas:
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_SortingOrder: 999
m_TargetDisplay: 0
--- !u!114 &6180559882126765873
MonoBehaviour:
File diff suppressed because it is too large. Load diff
@@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: 9824037642dab4ad5bcf9be82d6c3f4d
DefaultImporter:
guid: 97c01c76672e44273a5d1cfc2e370fd5
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
+2 -2
View File
@@ -1785,7 +1785,7 @@ Canvas:
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_SortingOrder: 999
m_TargetDisplay: 0
--- !u!114 &8158950665026664241
MonoBehaviour:
@@ -10315,7 +10315,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -0.000061035156, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7090232919967563469
+18 -1
View File
@@ -5817,7 +5817,7 @@ Canvas:
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_SortingOrder: 999
m_TargetDisplay: 0
--- !u!114 &7398370305477143944
MonoBehaviour:
@@ -9352,6 +9352,7 @@ GameObject:
- component: {fileID: 7500752845745524794}
- component: {fileID: 1097756438607454988}
- component: {fileID: 369171550614447944}
- component: {fileID: 3414475556719474257}
m_Layer: 5
m_Name: VoteText
m_TagString: Untagged
@@ -9478,6 +9479,22 @@ MonoBehaviour:
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!114 &3414475556719474257
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8602369677009573670}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 73b30df2b3a7144b99b75ce70168fd50, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::CustomColorObject
type: 4
invert: 0
addMore: {r: 0, g: 0, b: 0, a: 0}
reverseAdd: 0
--- !u!1 &8622410119972894528
GameObject:
m_ObjectHideFlags: 0
+1 -1
View File
@@ -1550,7 +1550,7 @@ Canvas:
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_SortingOrder: 999
m_TargetDisplay: 0
--- !u!114 &4446474620327799357
MonoBehaviour:
+1 -1
View File
@@ -1961,7 +1961,7 @@ Canvas:
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_SortingOrder: 999
m_TargetDisplay: 0
--- !u!114 &2450530804936179412
MonoBehaviour:
File diff suppressed because it is too large. Load diff
@@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: 88bad8620907810c097277153f83e44c
DefaultImporter:
guid: d331d8bfed88a414e833b34b1cffd197
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
+7 -56
View File
@@ -669,7 +669,6 @@ GameObject:
- component: {fileID: 62990864}
- component: {fileID: 62990863}
- component: {fileID: 62990862}
- component: {fileID: 62990861}
- component: {fileID: 62990865}
m_Layer: 5
m_Name: Button
@@ -698,19 +697,6 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &62990861
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 62990859}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1a45465fc8803364d968dc6bec70fca8, type: 3}
m_Name:
m_EditorClassIdentifier:
sceneName: IconMarketplaceMenu
--- !u!114 &62990862
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -2460,6 +2446,10 @@ MonoBehaviour:
statsPrefab: {fileID: 922734498401451496, guid: 33b706f9dca9d4d36be1cd5740f53b03, type: 3}
playModePrefab: {fileID: 5412203424544537898, guid: c9bfc084cf0a4481181349b979f74e43, type: 3}
iconkitPrefab: {fileID: 1299894586620017673, guid: 0ab3da8801cb54d6ca8318e649eab21b, type: 3}
userSearchPrefab: {fileID: 7344705192662463861, guid: d331d8bfed88a414e833b34b1cffd197, type: 3}
chatroomPrefab: {fileID: 7375619544931749353, guid: e1a37328c6ce743648d56c1a30ea3d80, type: 3}
iconMarketplacePrefab: {fileID: 1143860709270164401, guid: 7a63b3c695e6f48b7b9e37022024529c, type: 3}
leaderboardsPrefab: {fileID: 3838063057407156075, guid: 97c01c76672e44273a5d1cfc2e370fd5, type: 3}
copyrightText: {fileID: 319334213}
closePopup: {fileID: 60514371}
closePopupCancelButton: {fileID: 1983964294}
@@ -2471,6 +2461,9 @@ MonoBehaviour:
statsButton: {fileID: 462957726}
playButton: {fileID: 1777696996}
iconkitButton: {fileID: 1997401229}
userSearchButton: {fileID: 1633098169}
chatroomButton: {fileID: 2038556862}
leaderboardsButton: {fileID: 1572234421}
--- !u!1 &600923169
GameObject:
m_ObjectHideFlags: 0
@@ -5597,7 +5590,6 @@ GameObject:
- component: {fileID: 1572234423}
- component: {fileID: 1572234422}
- component: {fileID: 1572234421}
- component: {fileID: 1572234424}
- component: {fileID: 1572234425}
m_Layer: 5
m_Name: Button
@@ -5708,19 +5700,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1572234419}
m_CullTransparentMesh: 1
--- !u!114 &1572234424
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1572234419}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1a45465fc8803364d968dc6bec70fca8, type: 3}
m_Name:
m_EditorClassIdentifier:
sceneName: LeaderboardMenu
--- !u!114 &1572234425
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -6344,7 +6323,6 @@ GameObject:
- component: {fileID: 1633098171}
- component: {fileID: 1633098170}
- component: {fileID: 1633098169}
- component: {fileID: 1633098168}
- component: {fileID: 1633098167}
m_Layer: 5
m_Name: Button
@@ -6389,19 +6367,6 @@ MonoBehaviour:
invert: 0
addMore: {r: 0, g: 0, b: 0, a: 0}
reverseAdd: 0
--- !u!114 &1633098168
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1633098165}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1a45465fc8803364d968dc6bec70fca8, type: 3}
m_Name:
m_EditorClassIdentifier:
sceneName: UserSearchMenu
--- !u!114 &1633098169
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -8416,7 +8381,6 @@ GameObject:
- component: {fileID: 2038556864}
- component: {fileID: 2038556863}
- component: {fileID: 2038556862}
- component: {fileID: 2038556861}
- component: {fileID: 2038556865}
m_Layer: 5
m_Name: Button
@@ -8445,19 +8409,6 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2038556861
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2038556859}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1a45465fc8803364d968dc6bec70fca8, type: 3}
m_Name:
m_EditorClassIdentifier:
sceneName: ChatroomMenu
--- !u!114 &2038556862
MonoBehaviour:
m_ObjectHideFlags: 0
+29 -2
View File
@@ -11,12 +11,16 @@ public class MainMenu : MonoBehaviour {
[SerializeField] private Button updateButton;
[SerializeField] private TMP_Text splashText;
[SerializeField] private Button profileButton;
[SerializeField] private ProfileMenu profilePrefab;
[SerializeField] private ProfilePrefab profilePrefab;
[SerializeField] private AccountHandler accountsPrefab;
[SerializeField] private SettingsMenu settingsPrefab;
[SerializeField] private StatsPrefab statsPrefab;
[SerializeField] private PlayModePrefab playModePrefab;
[SerializeField] private IconkitPrefab iconkitPrefab;
[SerializeField] private UserSearchPrefab userSearchPrefab;
[SerializeField] private ChatroomPrefab chatroomPrefab;
[SerializeField] private IconMarketplaceManager iconMarketplacePrefab;
[SerializeField] private LeaderboardsPrefab leaderboardsPrefab;
[SerializeField] private TMP_Text copyrightText;
[SerializeField] private GameObject closePopup;
[SerializeField] private Button closePopupCancelButton;
@@ -28,6 +32,9 @@ public class MainMenu : MonoBehaviour {
[SerializeField] private Button statsButton;
[SerializeField] private Button playButton;
[SerializeField] private Button iconkitButton;
[SerializeField] private Button userSearchButton;
[SerializeField] private Button chatroomButton;
[SerializeField] private Button leaderboardsButton;
void Awake() {
if (PresistentData.latestVersion != null) {
@@ -58,7 +65,7 @@ public class MainMenu : MonoBehaviour {
var clone = Instantiate(profilePrefab.gameObject, profilePrefab.gameObject.transform.parent);
clone.name = "Prefab";
clone.SetActive(true);
await clone.GetComponent<ProfileMenu>().Init();
await clone.GetComponent<ProfilePrefab>().Init();
});
try {
Tools.LoadIcon(
@@ -96,6 +103,26 @@ public class MainMenu : MonoBehaviour {
clone.name = "Prefab";
clone.SetActive(true);
});
userSearchButton.onClick.AddListener(() => {
var clone = Instantiate(userSearchPrefab.gameObject, userSearchPrefab.gameObject.transform.parent);
clone.name = "Prefab";
clone.SetActive(true);
});
chatroomButton.onClick.AddListener(() => {
var clone = Instantiate(chatroomPrefab.gameObject, chatroomPrefab.gameObject.transform.parent);
clone.name = "Prefab";
clone.SetActive(true);
});
iconMarketplaceButton.onClick.AddListener(() => {
var clone = Instantiate(iconMarketplacePrefab.gameObject, iconMarketplacePrefab.gameObject.transform.parent);
clone.name = "Prefab";
clone.SetActive(true);
});
leaderboardsButton.onClick.AddListener(() => {
var clone = Instantiate(leaderboardsPrefab.gameObject, leaderboardsPrefab.gameObject.transform.parent);
clone.name = "Prefab";
clone.SetActive(true);
});
if (Tools.GetLevelInfo().level < 3) {
iconMarketplaceButton.interactable = false;
@@ -9,10 +9,9 @@ using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class ChatroomMenu : MonoBehaviour {
public class ChatroomPrefab : MonoBehaviour {
[SerializeField] private TMP_Text statusText;
[SerializeField] private Button backButton;
[SerializeField] private Button sendButton;
@@ -20,7 +19,7 @@ public class ChatroomMenu : MonoBehaviour {
[SerializeField] private GameObject content;
[SerializeField] private GameObject sampleObject;
[SerializeField] private Button downButton;
[SerializeField] private ProfileMenu profilePrefab;
[SerializeField] private ProfilePrefab profilePrefab;
[SerializeField] private GameObject optionsPanel;
[SerializeField] private Button optionsPanelExitButton;
@@ -149,7 +148,7 @@ public class ChatroomMenu : MonoBehaviour {
playerIconButton.onClick.AddListener(async () => {
var clone = Instantiate(profilePrefab.gameObject, profilePrefab.gameObject.transform.parent);
clone.SetActive(true);
await clone.GetComponent<ProfileMenu>().Init(message.UserID);
await clone.GetComponent<ProfilePrefab>().Init(message.UserID);
});
optionsButton.onClick.AddListener(() => OptionsButtonClick(message, localUserId ?? 0));
rowInfo.name = "ChatroomRow_" + message.ID;
@@ -282,6 +281,7 @@ public class ChatroomMenu : MonoBehaviour {
if (selectedMessageForOptions != null) GUIUtility.systemCopyBuffer = selectedMessageForOptions.Content;
});
optionsPanelCopyButton.onClick.AddListener(optionsPanelExitButton.onClick.Invoke);
backButton.onClick.AddListener(() => Destroy(gameObject));
}
void HandleMessageSubmit() {
@@ -344,15 +344,15 @@ public class ChatroomMenu : MonoBehaviour {
StartCoroutine(ScrollToBottom());
}
async void Update() {
void Update() {
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<ProfileMenu>() == null) {
if (Keyboard.current.escapeKey.wasPressedThisFrame && FindFirstObjectByType<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();
else await SceneManager.LoadSceneAsync("MainMenu");
else if (backButton.interactable) backButton.onClick.Invoke();
}
}
@@ -2,10 +2,10 @@ using SimpleFileBrowser;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class IconMarketplaceManager : MonoBehaviour {
[SerializeField] private GameObject panel;
[SerializeField] private GameObject normalPanel;
[SerializeField] private GameObject downloadPanel;
[SerializeField] private GameObject uploadPanel;
@@ -13,6 +13,7 @@ public class IconMarketplaceManager : MonoBehaviour {
[SerializeField] private IconMarketplaceUploadIcon uploadPanelScript;
[SerializeField] private IconMarketplaceDownloadIcon downloadPanelScript;
[SerializeField] private Button exitButton;
[SerializeField] private Button downloadButton;
[SerializeField] private Button uploadButton;
[SerializeField] private TMP_Text coinText;
@@ -28,6 +29,7 @@ public class IconMarketplaceManager : MonoBehaviour {
uploadButton.transform.GetChild(1).GetComponent<TMP_Text>().text = "Not logged in to an account";
}
SwitchPanel(0);
exitButton.onClick.AddListener(() => Destroy(gameObject));
}
internal void SwitchPanel(int panelIndex) {
@@ -38,6 +40,8 @@ public class IconMarketplaceManager : MonoBehaviour {
downloadPanelScript.optionsPanelSearchForToggle.isOn = false;
switch (panelIndex) {
case 0:
panel.SetActive(false);
panel.SetActive(true);
coinText.text = "You have " + Tools.FormatWithCommas(BazookaManager.Instance.GetCustomBirdIconData().Balance) + " coins";
normalPanel.SetActive(true);
downloadPanel.SetActive(false);
@@ -45,6 +49,8 @@ public class IconMarketplaceManager : MonoBehaviour {
if (DiscordRPCHandler.Instance != null) DiscordRPCHandler.Instance.UpdateRPC("Choosing what to do in the icon marketplace", null);
break;
case 1:
panel.SetActive(false);
panel.SetActive(true);
foreach (Transform item in downloadPanelScript.content.transform) {
if (item.gameObject.activeSelf) {
Destroy(item.gameObject);
@@ -57,6 +63,8 @@ public class IconMarketplaceManager : MonoBehaviour {
if (DiscordRPCHandler.Instance != null) DiscordRPCHandler.Instance.UpdateRPC("Browsing the icon marketplace", "They have " + Tools.FormatWithCommas(BazookaManager.Instance.GetCustomBirdIconData().Balance) + " coins");
break;
case 2:
panel.SetActive(false);
panel.SetActive(true);
uploadPanelScript.Reset();
normalPanel.SetActive(false);
downloadPanel.SetActive(false);
@@ -66,12 +74,12 @@ public class IconMarketplaceManager : MonoBehaviour {
}
}
async void Update() {
void Update() {
if (Keyboard.current.escapeKey.wasPressedThisFrame) {
if (downloadPanelScript.optionsPanel.activeSelf) downloadPanelScript.optionsPanelSubmitButton.onClick.Invoke();
else if (uploadPanel.activeSelf && FileBrowser.IsOpen) return;
else if (downloadPanel.activeSelf || uploadPanel.activeSelf) SwitchPanel(0);
else await SceneManager.LoadSceneAsync("MainMenu");
else if (exitButton.interactable) exitButton.onClick.Invoke();
} else if (Keyboard.current.rKey.wasPressedThisFrame && downloadPanel.activeSelf && downloadPanelScript.refreshButton.interactable) downloadPanelScript.GetIcons();
}
}
@@ -4,14 +4,14 @@ using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class LeaderboardsMenu : MonoBehaviour {
public class LeaderboardsPrefab : MonoBehaviour {
[SerializeField] private TMP_Text statusText;
[SerializeField] private Button backButton;
[SerializeField] private Button mainBackButton;
[SerializeField] private Button berryBackButton;
[SerializeField] private Button refreshButton;
[SerializeField] private ProfileMenu profilePrefab;
[SerializeField] private ProfilePrefab profilePrefab;
[SerializeField] private GameObject selectionPanel;
[SerializeField] private Button selectionScoreButton;
@@ -40,10 +40,8 @@ public class LeaderboardsMenu : MonoBehaviour {
selectionTotalBerriesButton.onClick.AddListener(() => { mode = LeaderboardMode.TotalBerries; SwitchMenu(1); });
berryShowTypeDropdown.onValueChanged.AddListener(_ => GetTopPlayers());
backButton.onClick.AddListener(async () => {
if (selectionPanel.activeSelf) await SceneManager.LoadSceneAsync("MainMenu");
else if (scoresPanel.activeSelf) SwitchMenu(0);
});
mainBackButton.onClick.AddListener(() => Destroy(gameObject));
berryBackButton.onClick.AddListener(() => SwitchMenu(0));
refreshButton.onClick.AddListener(GetTopPlayers);
}
@@ -59,12 +57,9 @@ public class LeaderboardsMenu : MonoBehaviour {
if (menu == 0) {
mode = LeaderboardMode.None;
refreshButton.gameObject.SetActive(false);
selectionPanel.SetActive(true);
scoresPanel.SetActive(false);
} else if (menu == 1) {
refreshButton.transform.localPosition = mode == LeaderboardMode.Berry ? new Vector2(402.5f, 282.33f) : new Vector2(-402.5f, -282.33f);
refreshButton.gameObject.SetActive(true);
berryShowTypeDropdown.gameObject.SetActive(mode == LeaderboardMode.Berry);
changedByCode = true;
berryShowTypeDropdown.value = 0;
@@ -77,7 +72,7 @@ public class LeaderboardsMenu : MonoBehaviour {
async void GetTopPlayers() {
if (changedByCode) return;
backButton.interactable = false;
berryBackButton.interactable = false;
refreshButton.interactable = false;
foreach (Transform item in content.transform) {
if (item.gameObject.activeSelf) {
@@ -146,7 +141,7 @@ public class LeaderboardsMenu : MonoBehaviour {
playerIconButton.onClick.AddListener(async () => {
var clone = Instantiate(profilePrefab.gameObject, profilePrefab.gameObject.transform.parent);
clone.SetActive(true);
await clone.GetComponent<ProfileMenu>().Init(entry.UserID);
await clone.GetComponent<ProfilePrefab>().Init(entry.UserID);
});
entryInfo.SetActive(true);
}
@@ -211,7 +206,7 @@ public class LeaderboardsMenu : MonoBehaviour {
playerIconButton.onClick.AddListener(async () => {
var clone = Instantiate(profilePrefab.gameObject, profilePrefab.gameObject.transform.parent);
clone.SetActive(true);
await clone.GetComponent<ProfileMenu>().Init(entry.UserID);
await clone.GetComponent<ProfilePrefab>().Init(entry.UserID);
});
entryInfo.SetActive(true);
}
@@ -220,7 +215,7 @@ public class LeaderboardsMenu : MonoBehaviour {
} else {
UpdateStatus(true, (string)jsonResponse["message"]);
}
backButton.interactable = true;
berryBackButton.interactable = true;
refreshButton.interactable = true;
}
@@ -229,10 +224,10 @@ public class LeaderboardsMenu : MonoBehaviour {
statusText.text = message;
}
async void Update() {
if (Keyboard.current.escapeKey.wasPressedThisFrame && FindFirstObjectByType<ProfileMenu>() == null) {
if (!selectionPanel.activeSelf) SwitchMenu(0);
else await SceneManager.LoadSceneAsync("MainMenu");
void Update() {
if (Keyboard.current.escapeKey.wasPressedThisFrame && FindFirstObjectByType<ProfilePrefab>() == null) {
if (selectionPanel.activeSelf && mainBackButton.interactable) mainBackButton.onClick.Invoke();
else if (scoresPanel.activeSelf && berryBackButton.interactable) berryBackButton.onClick.Invoke();
}
}
}
@@ -9,7 +9,7 @@ using UnityEngine.InputSystem;
using UnityEngine.Networking;
using UnityEngine.UI;
public class ProfileMenu : MonoBehaviour {
public class ProfilePrefab : MonoBehaviour {
[SerializeField] private Button exitButton;
[SerializeField] private Button refreshButton;
[SerializeField] private Button postButton;
@@ -39,7 +39,6 @@ public class ProfileMenu : MonoBehaviour {
private GameObject popupObject;
void Awake() {
exitButton.onClick.AddListener(() => Destroy(gameObject));
}
@@ -335,6 +334,11 @@ public class ProfileMenu : MonoBehaviour {
}
void Update() {
if (Keyboard.current.escapeKey.wasPressedThisFrame && exitButton.interactable) exitButton.onClick.Invoke();
if (Keyboard.current.escapeKey.wasPressedThisFrame && exitButton.interactable) {
if (popupObject) {
Destroy(popupObject);
popupObject = null;
} else exitButton.onClick.Invoke();
}
}
}
@@ -3,18 +3,19 @@ using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class UserSearchMenu : MonoBehaviour {
public class UserSearchPrefab : MonoBehaviour {
[SerializeField] private GameObject content;
[SerializeField] private GameObject sampleObject;
[SerializeField] private Button searchButton;
[SerializeField] private Button backButton;
[SerializeField] private TMP_InputField usernameInput;
[SerializeField] private Button searchButton;
[SerializeField] private TMP_Text statusText;
[SerializeField] private ProfileMenu profilePrefab;
[SerializeField] private ProfilePrefab profilePrefab;
void Awake() {
backButton.onClick.AddListener(() => Destroy(gameObject));
usernameInput.onSelect.AddListener((_) => usernameInput.caretPosition = usernameInput.text.Length);
searchButton.onClick.AddListener(Search);
Search();
@@ -70,7 +71,7 @@ public class UserSearchMenu : MonoBehaviour {
playerIconButton.onClick.AddListener(async () => {
var clone = Instantiate(profilePrefab.gameObject, profilePrefab.gameObject.transform.parent);
clone.SetActive(true);
await clone.GetComponent<ProfileMenu>().Init(entry.UserID);
await clone.GetComponent<ProfilePrefab>().Init(entry.UserID);
});
entryInfo.SetActive(true);
}
@@ -81,8 +82,8 @@ public class UserSearchMenu : MonoBehaviour {
searchButton.interactable = true;
}
async void Update() {
if (Keyboard.current.escapeKey.wasPressedThisFrame && !GameObject.Find("ProfilePrefab(Clone)")) await SceneManager.LoadSceneAsync("MainMenu");
void Update() {
if (Keyboard.current.escapeKey.wasPressedThisFrame && FindFirstObjectByType<ProfilePrefab>() == null && backButton.interactable) backButton.onClick.Invoke();
}
private void UpdateStatus(bool enabled, string message = "") {