using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class LoadingSceneCtrl : MonoBehaviour {
public LoadingSceneUICtrl loadingsceneUICtrl;
public AsyncOperation async;
private float progress;
// Use this for initialization
void Start () {
GetSceneTypeName();
}
public void GetSceneTypeName()
{
string name = "";
switch (SceneMgr.Instance.currentType)
{
case EnumSceneType.Login:
name = "Scene_Login";
break;
case EnumSceneType.MainCity:
name = "Scene_MainCity";
break;
}
async = SceneManager.LoadSceneAsync(name);
async.allowSceneActivation = false;
}
// Update is called once per frame
void Update () {
progress++;
loadingsceneUICtrl.SetSilderValue(progress/100);
if(async.progress>=0.9||progress>=100)
{
async.allowSceneActivation = true;
}
}
}
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class LoadingSceneCtrl : MonoBehaviour {
public LoadingSceneUICtrl loadingsceneUICtrl;
public AsyncOperation async;
private float progress;
// Use this for initialization
void Start () {
GetSceneTypeName();
}
public void GetSceneTypeName()
{
string name = "";
switch (SceneMgr.Instance.currentType)
{
case EnumSceneType.Login:
name = "Scene_Login";
break;
case EnumSceneType.MainCity:
name = "Scene_MainCity";
break;
}
async = SceneManager.LoadSceneAsync(name);
async.allowSceneActivation = false;
}
// Update is called once per frame
void Update () {
progress++;
loadingsceneUICtrl.SetSilderValue(progress/100);
if(async.progress>=0.9||progress>=100)
{
async.allowSceneActivation = true;
}
}
}