-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathSceneLoader.cs
More file actions
77 lines (62 loc) · 2.49 KB
/
SceneLoader.cs
File metadata and controls
77 lines (62 loc) · 2.49 KB
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
67
68
69
70
71
72
73
74
75
76
77
using System;
using System.Collections;
using UnityEngine;
namespace uFrame.Kernel
{
public abstract class SceneLoader<T> : uFrameComponent, ISceneLoader where T : IScene
{
public virtual Type SceneType
{
get { return typeof (T); }
}
/// <summary>
/// The type of scene that this loader is for. This is used by the kernel to link link it to the
/// scene type when the "SceneAwakeEvent" is invoked.
/// </summary>
/// <param name="scene">The scene component that is at the root of the scene.</param>
/// <param name="progressDelegate">The progress delegate for providing user feedback on long running actions.</param>
/// <returns></returns>
protected abstract IEnumerator LoadScene(T scene, Action<float, string> progressDelegate);
/// <summary>
///
/// </summary>
/// <param name="scene">The scene component that is at the root of the scene.</param>
/// <param name="progressDelegate">The progress delegate for providing user feedback on long running actions.</param>
/// <returns></returns>
protected abstract IEnumerator UnloadScene(T scene, Action<float, string> progressDelegate);
public IEnumerator Load(object sceneObject, Action<float, string> progressDelegate)
{
return LoadScene((T) sceneObject, progressDelegate);
}
public IEnumerator Unload(object sceneObject, Action<float, string> progressDelegate)
{
return UnloadScene((T) sceneObject, progressDelegate);
}
}
/// <summary>
///
/// </summary>
public class DefaultSceneLoader : SceneLoader<IScene>
{
public override Type SceneType
{
get { return typeof (IScene); }
}
protected override IEnumerator LoadScene(IScene scene, Action<float, string> progressDelegate)
{
yield break;
}
protected override IEnumerator UnloadScene(IScene scene, Action<float, string> progressDelegate)
{
yield break;
}
//public IEnumerator Load(object sceneObject, Action<float, string> progressDelegate)
//{
// return LoadScene((IScene)sceneObject, progressDelegate);
//}
//public IEnumerator Unload(object sceneObject, object settings, Action<float, string> progressDelegate)
//{
// return UnloadScene((IScene)sceneObject, progressDelegate);
//}
}
}