Init
This commit is contained in:
55
Assets/Scripts/HotUpdate/Main/GameStart.cs
Normal file
55
Assets/Scripts/HotUpdate/Main/GameStart.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using YooAsset;
|
||||
|
||||
public class GameStart : MonoBehaviour
|
||||
{
|
||||
SceneHandle sceneHandle;
|
||||
void Start()
|
||||
{
|
||||
StartCoroutine(LoadScene());
|
||||
//StartCoroutine(LoadNetWorkManager());
|
||||
StartCoroutine(LoadUIManager());
|
||||
}
|
||||
IEnumerator LoadScene()
|
||||
{
|
||||
sceneHandle = YooAssets.LoadSceneAsync("MirrorRoomOffline");
|
||||
//sceneHandle = YooAssets.LoadSceneAsync("Game");
|
||||
sceneHandle.Completed += (handle) =>
|
||||
{
|
||||
handle.ActivateScene();
|
||||
};
|
||||
yield return sceneHandle;
|
||||
}
|
||||
IEnumerator LoadUIManager()
|
||||
{
|
||||
AssetHandle _handle = YooAssets.LoadAssetAsync<GameObject>("UIManager");
|
||||
_handle.Completed += (handle) =>
|
||||
{
|
||||
GameObject go = Instantiate((GameObject)_handle.AssetObject);
|
||||
DontDestroyOnLoad(go);
|
||||
Debug.Log(_handle.AssetObject);
|
||||
};
|
||||
yield return _handle;
|
||||
}
|
||||
IEnumerator LoadNetWorkManager()
|
||||
{
|
||||
AssetHandle _handle = YooAssets.LoadAssetAsync<GameObject>("MyRoomManager");
|
||||
_handle.Completed += (handle) =>
|
||||
{
|
||||
GameObject go = Instantiate((GameObject)_handle.AssetObject);
|
||||
DontDestroyOnLoad(go);
|
||||
Debug.Log(_handle.AssetObject);
|
||||
};
|
||||
yield return _handle;
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if(sceneHandle!=null && !sceneHandle.IsDone)
|
||||
{
|
||||
Debug.Log(sceneHandle.Progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user