game: setting up official scenes

authentication and main menu
This commit is contained in:
kookiekenobi 2025-02-17 04:29:56 +08:00
parent eb7bfb41b3
commit 4887066959
8 changed files with 6337 additions and 5 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 8fe854ce20bb48b47a224673cb413ed9
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -150,9 +150,9 @@ Material:
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BaseColor: {r: 0, g: 0, b: 0, a: 1}
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 0, g: 0, b: 0, a: 1}
- _ColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}

View file

@ -3737,7 +3737,7 @@ MonoBehaviour:
daysPlayedText: {fileID: 1149788710}
peopleHelpedText: {fileID: 983053282}
accuracyText: {fileID: 912717248}
profilePicture: {fileID: 0}
profilePicture: {fileID: 1277945301}
--- !u!1 &387529325
GameObject:
m_ObjectHideFlags: 0
@ -17311,7 +17311,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &1696626647
RectTransform:
m_ObjectHideFlags: 0

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0dead7ea6762a43489aa58bfe36aeb32
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -151,8 +151,14 @@ public class Backend : MonoBehaviour
});
}
private async void GetProfile(string url, Image targetRenderer)
public async void GetProfile(string url, Image targetRenderer)
{
if (string.IsNullOrEmpty(url))
{
Debug.LogError("Profile picture URL is empty");
return;
}
try
{
Texture2D texture = await GetTextureFromURL(url);

View file

@ -4,6 +4,8 @@ using Supabase.Gotrue;
using UnityEngine;
using TMPro;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class MenuButtons : MonoBehaviour
{
/// <summary>
@ -59,6 +61,8 @@ public class MenuButtons : MonoBehaviour
daysPlayedText.text = user.daysPlayed.ToString();
peopleHelpedText.text = totalPeopleHelped.ToString();
accuracyText.text = $"{accuracy:F2}%";
GetProfilePicture();
}
else
{
@ -73,5 +77,19 @@ public class MenuButtons : MonoBehaviour
public void GetProfilePicture()
{
// profilePicture.sprite = Backend.instance.GetProfilePicture("https://fchobpauqasfebohuuam.supabase.co/storage/v1/object/public/Avatar//1739708594780-6156448458035283230_120.jpg");
if(Backend.instance.User != null && !string.IsNullOrEmpty(Backend.instance.User.profilePictureUrl))
Backend.instance.GetProfile(Backend.instance.User.profilePictureUrl, profilePicture);
}
public void LoadScene(string scene)
{
LoadScene(scene);
}
public void QuitGame()
{
Application.Quit();
Debug.Log("Quitting game");
}
}