Moving to flex, Hoping it would fix platform
This commit is contained in:
@@ -11,6 +11,7 @@ using UnityEngine.UI;
|
||||
public class loadingScreen : MonoBehaviour
|
||||
{
|
||||
public string sceneName;
|
||||
public int sceneIndex;
|
||||
public RectTransform loadingWheel;
|
||||
public RectTransform loadingProgress;
|
||||
CanvasGroup canvasGroup;
|
||||
@@ -29,6 +30,7 @@ public class loadingScreen : MonoBehaviour
|
||||
|
||||
void Start()
|
||||
{
|
||||
LoadingScreen.instance=this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
canvasGroup = GetComponent<CanvasGroup>();
|
||||
|
||||
@@ -69,26 +71,37 @@ public class loadingScreen : MonoBehaviour
|
||||
loading = true;
|
||||
loadingProgress.sizeDelta = new Vector2(0, loadingProgress.sizeDelta.y);
|
||||
SceneManager.sceneLoaded += SceneManager_sceneLoaded;
|
||||
loadingOperation = SceneManager.LoadSceneAsync(sceneName);
|
||||
if(sceneName != null){
|
||||
loadingOperation = SceneManager.LoadSceneAsync(sceneName);
|
||||
}else{
|
||||
loadingOperation = SceneManager.LoadSceneAsync(sceneIndex);
|
||||
}
|
||||
}
|
||||
|
||||
private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
|
||||
{
|
||||
if (loading)
|
||||
hide();
|
||||
if (loading && !alreadyConnected)
|
||||
{
|
||||
// hide();
|
||||
if(isHost){host();}else{join();}
|
||||
|
||||
loading = false;
|
||||
loading = false;
|
||||
}
|
||||
if(alreadyConnected){
|
||||
// Debug.Log()
|
||||
SceneData.netSceneData = FindObjectOfType<NetSceneData>();
|
||||
SceneData.localPlayer.GetComponent<NetPlayer>().ReturnToSpawn();
|
||||
|
||||
}
|
||||
}
|
||||
public bool alreadyConnected= false;
|
||||
public string serverName;
|
||||
public bool isPublic;
|
||||
public string serverMetadata;
|
||||
|
||||
void host()
|
||||
{
|
||||
_LRM.serverName = serverName;
|
||||
_LRM.extraServerData = sceneName;
|
||||
_LRM.extraServerData = serverMetadata;
|
||||
_LRM.isPublicServer = isPublic;
|
||||
|
||||
_LRM.ServerStart();
|
||||
@@ -101,3 +114,8 @@ public class loadingScreen : MonoBehaviour
|
||||
NetworkManager.singleton.StartClient();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class LoadingScreen{
|
||||
public static loadingScreen instance;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user