Initial commit
This commit is contained in:
@@ -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