Petition-to-the-Gods-V3/Assets/Scripts/SceneController.cs
2025-11-15 08:01:59 +08:00

64 lines
1.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using UnityEngine;
using UnityEngine.SceneManagement;
using Mirror;
public class SceneController : MonoBehaviour
{
[Header("³õ´º¦WºÙ³]¸m")]
public string initSceneName = "InitScene";
public string serverHomeSceneName = "ServerHomeScene";
public string clientHomeSceneName = "ClientHomeScene";
private static SceneController instance;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void Awake()
{
if (instance == null)
{
instance = this;
DontDestroyOnLoad(gameObject);
}
else
{
Destroy(gameObject);
}
}
#region ServerScene
public static void LoadServerHomeScene()
{
if (instance != null)
{
Debug.Log("Switch to Server Home");
SceneManager.LoadScene(instance.serverHomeSceneName);
}
}
#endregion
#region ClientScene
public static void LoadClientHomeScene()
{
if (instance != null)
{
Debug.Log("Switch to Client Home");
SceneManager.LoadScene(instance.clientHomeSceneName);
}
}
#endregion
}