64 lines
1.3 KiB
C#
64 lines
1.3 KiB
C#
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
|
||
}
|