Initial commit
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 77821865bf8b39c49a939adc0b1eb189
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 52a5761204929f34abe1c66ab2876c93, type: 3}
|
||||
m_Name: Room1
|
||||
m_EditorClassIdentifier:
|
||||
doors: 0
|
||||
furniture: 1
|
||||
portals: 0
|
||||
enemies: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 106f2f3bbf55fdc4d99252211dfdd3f2
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 52a5761204929f34abe1c66ab2876c93, type: 3}
|
||||
m_Name: Room10
|
||||
m_EditorClassIdentifier:
|
||||
doors: 0
|
||||
furniture: 1
|
||||
portals: 0
|
||||
enemies: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d3b5143823bea947a16fa39bd25e8fe
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 52a5761204929f34abe1c66ab2876c93, type: 3}
|
||||
m_Name: Room11
|
||||
m_EditorClassIdentifier:
|
||||
doors: 0
|
||||
furniture: 1
|
||||
portals: 0
|
||||
enemies: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 127a97df26bad4d48bf36078232c9ea4
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 52a5761204929f34abe1c66ab2876c93, type: 3}
|
||||
m_Name: Room12
|
||||
m_EditorClassIdentifier:
|
||||
doors: 0
|
||||
furniture: 1
|
||||
portals: 0
|
||||
enemies: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 96ba4924b1e9c194cb75224a5b6daed3
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 52a5761204929f34abe1c66ab2876c93, type: 3}
|
||||
m_Name: Room2
|
||||
m_EditorClassIdentifier:
|
||||
doors: 0
|
||||
furniture: 1
|
||||
portals: 0
|
||||
enemies: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b5ba897189d3f94086ca5ee07c84dee
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 52a5761204929f34abe1c66ab2876c93, type: 3}
|
||||
m_Name: Room3
|
||||
m_EditorClassIdentifier:
|
||||
doors: 0
|
||||
furniture: 1
|
||||
portals: 0
|
||||
enemies: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b597535da1eba4243940c6c0f1b655de
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 52a5761204929f34abe1c66ab2876c93, type: 3}
|
||||
m_Name: Room4
|
||||
m_EditorClassIdentifier:
|
||||
doors: 0
|
||||
furniture: 1
|
||||
portals: 0
|
||||
enemies: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 190315b6186ca5b4ea35ff95dca0ed9d
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 52a5761204929f34abe1c66ab2876c93, type: 3}
|
||||
m_Name: Room5
|
||||
m_EditorClassIdentifier:
|
||||
doors: 0
|
||||
furniture: 1
|
||||
portals: 0
|
||||
enemies: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8bb570b290a409b429dc8311bdd7bbb8
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 52a5761204929f34abe1c66ab2876c93, type: 3}
|
||||
m_Name: Room6
|
||||
m_EditorClassIdentifier:
|
||||
doors: 0
|
||||
furniture: 1
|
||||
portals: 0
|
||||
enemies: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba7cc6620201c27439368b153b8cdcf0
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 52a5761204929f34abe1c66ab2876c93, type: 3}
|
||||
m_Name: Room7
|
||||
m_EditorClassIdentifier:
|
||||
doors: 0
|
||||
furniture: 1
|
||||
portals: 0
|
||||
enemies: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e6afc347cc11954a9536886bcf00751
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 52a5761204929f34abe1c66ab2876c93, type: 3}
|
||||
m_Name: Room8
|
||||
m_EditorClassIdentifier:
|
||||
doors: 0
|
||||
furniture: 1
|
||||
portals: 0
|
||||
enemies: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2b865aae0dfdcb640a6b00e0ce3d34c0
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 52a5761204929f34abe1c66ab2876c93, type: 3}
|
||||
m_Name: Room9
|
||||
m_EditorClassIdentifier:
|
||||
doors: 0
|
||||
furniture: 1
|
||||
portals: 0
|
||||
enemies: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3341f8aacfc463340a026cb1051f6e6c
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu]
|
||||
public class RoomPrefs : ScriptableObject
|
||||
{
|
||||
public bool doors = false;
|
||||
public bool furniture = true;
|
||||
public bool portals = false;
|
||||
public bool enemies = false;
|
||||
|
||||
public void SetDoors (bool doorValue) { doors = doorValue; }
|
||||
public void SetFurniture (bool furnitureValue) { furniture=furnitureValue; }
|
||||
public void SetPortals (bool portalsValue) { portals = portalsValue; }
|
||||
public void SetEnemies (bool enemiesValue) { enemies = enemiesValue; }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 52a5761204929f34abe1c66ab2876c93
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class SceneloaderEventSystem : MonoBehaviour
|
||||
{
|
||||
[SerializeField] string tagFilter;
|
||||
|
||||
[SerializeField] UnityEvent onTriggerEnter;
|
||||
[SerializeField] UnityEvent onTriggerExit;
|
||||
void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(tagFilter) && !other.gameObject.CompareTag(tagFilter)) return;
|
||||
onTriggerEnter.Invoke();
|
||||
}
|
||||
void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(tagFilter) && !other.gameObject.CompareTag(tagFilter)) return;
|
||||
onTriggerExit.Invoke();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 18162507865d8bd4cbbb5287aca5410c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 112f562cc875d4049a1a8fa8a13296ab
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,146 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
using Supabase.Gotrue;
|
||||
using Supabase.Gotrue.Exceptions;
|
||||
using Client = Supabase.Client;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace GhostSystem
|
||||
{
|
||||
public class SupabaseManager : MonoBehaviour
|
||||
{
|
||||
public static SupabaseManager instance { get; private set; }
|
||||
|
||||
public const string subabaseUrl = "https://cezghxztvyggwgunyhmq.supabase.co";
|
||||
public const string supabaseAnonKey = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNlemdoeHp0dnlnZ3dndW55aG1xIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDcyMTk5MzcsImV4cCI6MjA2Mjc5NTkzN30.vr6-3X3Ux_DjcCiw_CqG-VKP8BiBXtmCzAXjYTiA_vY";
|
||||
|
||||
public Client supabase { get; private set; }
|
||||
public string userId => supabase?.Auth?.CurrentUser?.Id;
|
||||
|
||||
private string email;
|
||||
private string password;
|
||||
private const string authFileName = "auth.txt";
|
||||
|
||||
public static event Action OnSuperbaseReady;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Initialize().Forget();
|
||||
}
|
||||
|
||||
|
||||
private async UniTask Initialize()
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Log("🌐 Starting Supabase setup...");
|
||||
await RunDiagnostics();
|
||||
|
||||
await InitSupabaseAsync();
|
||||
OnSuperbaseReady?.Invoke();
|
||||
}
|
||||
|
||||
private async UniTask InitSupabaseAsync()
|
||||
{
|
||||
if (supabase != null)
|
||||
return;
|
||||
|
||||
string path = Path.Combine(Application.persistentDataPath, authFileName);
|
||||
|
||||
if (File.Exists(path))
|
||||
{
|
||||
string[] lines = await UniTask.Run(() => File.ReadAllLines(path));
|
||||
email = lines[0];
|
||||
password = lines[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
email = string.IsNullOrEmpty(SystemInfo.deviceUniqueIdentifier)
|
||||
? $"{Guid.NewGuid()}@device.local"
|
||||
: $"{SystemInfo.deviceUniqueIdentifier}@device.local";
|
||||
|
||||
password = Convert.ToBase64String(Guid.NewGuid().ToByteArray());
|
||||
|
||||
await UniTask.Run(() => File.WriteAllLines(path, new[] { email, password }));
|
||||
}
|
||||
|
||||
Debug.Log($"📧 Using Email: {email}, Password: {password}");
|
||||
|
||||
supabase = new Client(subabaseUrl, supabaseAnonKey);
|
||||
|
||||
try
|
||||
{
|
||||
await supabase.InitializeAsync();
|
||||
Debug.Log("✅ Supabase initialized.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError($"❌ Initialization failed: {ex}");
|
||||
}
|
||||
|
||||
await AuthenticateAsync(email, password);
|
||||
Debug.Log($"👤 Authenticated user ID: {userId}");
|
||||
}
|
||||
|
||||
public async UniTask AuthenticateAsync(string email, string password)
|
||||
{
|
||||
try
|
||||
{
|
||||
await supabase.Auth.SignIn(email, password);
|
||||
Debug.Log("🔓 Sign-in successful");
|
||||
}
|
||||
catch (Exception authEx)
|
||||
{
|
||||
Debug.LogWarning($"Sign-in failed, trying sign-up: {authEx.Message}");
|
||||
try
|
||||
{
|
||||
await supabase.Auth.SignUp(email, password);
|
||||
Debug.Log("🆕 Sign-up successful");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError($"❌ Authentication failed: {ex}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async UniTask RunDiagnostics()
|
||||
{
|
||||
await UniTask.WhenAll(CheckSupabaseHealthAsync(), CheckGoogleConnectionAsync());
|
||||
}
|
||||
|
||||
private async UniTask CheckSupabaseHealthAsync()
|
||||
{
|
||||
using var www = UnityWebRequest.Get($"{subabaseUrl}/auth/v1/health");
|
||||
www.SetRequestHeader("apikey", supabaseAnonKey);
|
||||
await www.SendWebRequest();
|
||||
|
||||
if (www.result == UnityWebRequest.Result.Success)
|
||||
Debug.Log($"✅ Supabase health: {www.downloadHandler.text}");
|
||||
else
|
||||
Debug.LogError($"❌ Supabase health check failed: {www.error}");
|
||||
}
|
||||
|
||||
private async UniTask CheckGoogleConnectionAsync()
|
||||
{
|
||||
using var www = UnityWebRequest.Get("https://www.google.com");
|
||||
await www.SendWebRequest();
|
||||
|
||||
if (www.result == UnityWebRequest.Result.Success)
|
||||
Debug.Log("✅ Google request succeeded.");
|
||||
else
|
||||
Debug.LogError($"❌ Google connection failed: {www.error}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8983945cca89adc46aab1638d1823d76
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3290a3fbb2c5c9c4f9a4a9290863437e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,58 @@
|
||||
using System.Collections;
|
||||
using System.Net;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
public class NetworkDiagnostic : MonoBehaviour
|
||||
{
|
||||
void Start()
|
||||
{
|
||||
StartCoroutine(RunDiagnostics());
|
||||
}
|
||||
|
||||
IEnumerator RunDiagnostics()
|
||||
{
|
||||
Debug.Log("🌐 Starting network diagnostics...");
|
||||
|
||||
// 1. UnityWebRequest to Google (HTTP check)
|
||||
string testUrl = "https://www.google.com";
|
||||
using (UnityWebRequest request = UnityWebRequest.Get(testUrl))
|
||||
{
|
||||
yield return request.SendWebRequest();
|
||||
|
||||
if (request.result != UnityWebRequest.Result.Success)
|
||||
Debug.LogError($"❌ Google request failed: {request.error}");
|
||||
else
|
||||
Debug.Log("✅ Google request succeeded.");
|
||||
}
|
||||
|
||||
// 2. DNS Resolution (System.Net)
|
||||
string hostToCheck = "www.google.com";
|
||||
try
|
||||
{
|
||||
Debug.Log($"🔎 Attempting DNS resolution for: {hostToCheck}");
|
||||
IPAddress[] addresses = Dns.GetHostAddresses(hostToCheck);
|
||||
foreach (var addr in addresses)
|
||||
Debug.Log($"✅ DNS Resolved: {addr}");
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
Debug.LogError($"❌ DNS resolution failed: {ex.Message}");
|
||||
}
|
||||
|
||||
// 3. UnityWebRequest to Supabase Health
|
||||
string supabaseHealth = "https://cezghxztvyggwgunyhmq.supabase.co/auth/v1/health";
|
||||
using (UnityWebRequest supa = UnityWebRequest.Get(supabaseHealth))
|
||||
{
|
||||
supa.SetRequestHeader("apikey", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNlemdoeHp0dnlnZ3dndW55aG1xIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDcyMTk5MzcsImV4cCI6MjA2Mjc5NTkzN30.vr6-3X3Ux_DjcCiw_CqG-VKP8BiBXtmCzAXjYTiA_vY");
|
||||
yield return supa.SendWebRequest();
|
||||
|
||||
if (supa.result != UnityWebRequest.Result.Success)
|
||||
Debug.LogError($"❌ Supabase health check failed: {supa.error}");
|
||||
else
|
||||
Debug.Log($"✅ Supabase responded: {supa.downloadHandler.text}");
|
||||
}
|
||||
|
||||
Debug.Log("📊 Network diagnostics complete.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a414e41b5eb32f489ad37f31d24a9d0
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class Room : MonoBehaviour
|
||||
{
|
||||
public int roomID;
|
||||
public float timeInSeconds { get; set; }
|
||||
public bool used = false;
|
||||
|
||||
public Room CreateRoom(int roomID, float timeInSeconds)
|
||||
{
|
||||
this.roomID = roomID;
|
||||
this.timeInSeconds = timeInSeconds;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59e49d0f5e41d9c4fad0bc295381df0b
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class RoomManager : MonoBehaviour
|
||||
{
|
||||
public RoomPrefs myRoom;
|
||||
public List<GameObject> doors;
|
||||
public List<GameObject> furnitures;
|
||||
public List<GameObject> portals;
|
||||
public List<GameObject> enemies;
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
if (!myRoom.doors && myRoom.furniture && !myRoom.portals && !myRoom.enemies) return;
|
||||
if (myRoom.doors)
|
||||
{
|
||||
foreach (GameObject door in doors) door.SetActive(true);
|
||||
}
|
||||
if (!myRoom.furniture)
|
||||
{
|
||||
foreach(GameObject f in furnitures) f.SetActive(false);
|
||||
}
|
||||
if (myRoom.portals)
|
||||
{
|
||||
foreach(GameObject portal in portals) portal.SetActive(true);
|
||||
}
|
||||
if (myRoom.enemies)
|
||||
{
|
||||
foreach ( GameObject enemy in enemies) enemy.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6dbbd26d36698e5439027b6ce6f2b535
|
||||
@@ -0,0 +1,48 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class SceneLoader : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private int baseSceneIndex;
|
||||
|
||||
private bool isLoaded;
|
||||
private int currentScene = 0;
|
||||
public int prevScene = 0;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
currentScene = baseSceneIndex; // holt sich den Index der aktuellen Szene
|
||||
}
|
||||
public void LoadScene(string sceneName) // ist die Funktion zum gewögnlichen Laden von Szenen
|
||||
{
|
||||
SceneManager.LoadScene(sceneName);
|
||||
}
|
||||
|
||||
public void LoadNextSceneAdditive() // Lädt die nach Index nächste Szene additiv hinzu. Wird asynchron ausgeführt.
|
||||
{
|
||||
Debug.LogError("Triggered");
|
||||
if (currentScene >= SceneManager.sceneCountInBuildSettings - 1 || SceneManager.loadedSceneCount > 2) return; // die aktuelle Szene darf nicht die letzte sein und es dürfen nöch keine zwei Szenen geladen sein.
|
||||
int nextScene = currentScene + 1; // setzt den Index für die nächste Szene
|
||||
prevScene = currentScene; // die aktuelle Szene wird zur "Previous Scene". Nun kann sie entladen werden.
|
||||
currentScene = nextScene; // die nächste Szene wird zur neuen "Current Scene".
|
||||
SceneManager.LoadSceneAsync(nextScene, LoadSceneMode.Additive); // nun wird die nächste Szene (in diesem moment dieselbe wie "Current Scene" asynchron hinzugeladen.
|
||||
Debug.Log("Loaded Scene " + nextScene);
|
||||
}
|
||||
|
||||
public void UnloadPrevSceneAdditive() // Entlädt die Szene, deren Index als "Previous Scene" festgehalten ist.
|
||||
{
|
||||
if (prevScene == baseSceneIndex) return; // Wird nicht ausgeführt, wenn die "Previous Scene" die Basis-Szene ist.
|
||||
SceneManager.UnloadSceneAsync(prevScene); // Die "Previous Scene" wird entladen.
|
||||
if (SceneManager.GetSceneByName("CurrentResults").isLoaded)
|
||||
{
|
||||
SceneManager.UnloadSceneAsync("CurrentResults");
|
||||
Debug.Log("Unloaded CurrentResults");
|
||||
}
|
||||
}
|
||||
public void LoadResultsAdditive() // Lädt die Results zur aktuellen Szene
|
||||
{
|
||||
SceneManager.LoadScene("CurrentResults", LoadSceneMode.Additive);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c2de113212d736e4398276cda5347f35
|
||||
Reference in New Issue
Block a user