Make user search, chatroom, leaderboards and icon marketplace into a popup
This commit is contained in:
52 files changed
+30178
-31455
No files matched your search
@@ -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;
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+11
-3
@@ -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();
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+14
-19
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
@@ -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 = "") {
|
||||
File renamed without changes.
Reference in new issue
Block a user