Newer
Older
Marco Zimmer
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using static CommunicationEvents;
public static class Loader
{
private static AsyncOperation loadingscene;
private static string nextscene;
private class MonoDummy : MonoBehaviour { };
public static float progress {
get {
return loadingscene == null ? 1f : loadingscene.progress;
}
}
public static bool isDone {
get {
return loadingscene == null ? true : loadingscene.isDone;
}
}
public static void UnloadStage()
{
GlobalStatic.stage.factState.hardreset(false);
GlobalStatic.stage.solution.hardreset(false);
Fact.Clear();
}
public static bool LoadStage(string name, bool local, bool restore_session = true)
{
if (!GlobalStatic.LoadInitStage(name, local, restore_session))
return false;
LoadScene(GlobalStatic.stage.scene);
return true;
}
public static void LoadScene(string scene)
{
nextscene = scene;
SceneManager.LoadScene("LoadingScene");
// loads LoadingScreen, which will call LoaderCallback() in LoadingScreenPercentage
}
public static void LoadScene(Scene scene)
{
nextscene = scene.name;
SceneManager.LoadScene("LoadingScene");
// loads LoadingScreen, which will call LoaderCallback() in LoadingScreenPercentage
}
public static void PostLoad()
{
;
}
public static void LoaderCallback()
{
loadingscene = SceneManager.LoadSceneAsync(nextscene);
}
}