1
2
3
4
|
public
enum
AppMode {
Developing,
QA,
Release
}
|
01
02
03
04
05
06
07
08
09
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
|
///
/// 全局唯一继承于MonoBehaviour的单例类,保证其他公共模块都以App的生命周期为准
///
public
class
App : QMonoSingleton
{
public
AppMode mode = AppMode.Developing;
private
App() {}
void
Awake()
{
// 确保不被销毁
DontDestroyOnLoad(gameObject);
mInstance =
this
;
// 进入欢迎界面
Application.targetFrameRate = 60;
}
void
Start()
{
CoroutineMgr.Instance ().StartCoroutine (ApplicationDidFinishLaunching());
}
///
/// 进入游戏
///
IEnumerator ApplicationDidFinishLaunching()
{
// 配置文件加载 类似PlayerPrefs
QSetting.Load();
// 日志输出
QLog.Instance ();
yield
return
GameManager.Instance ().Init ();
// 进入测试逻辑
if
(App.Instance().mode == AppMode.Developing) {
// 测试资源加载
ResMgr.Instance ().LoadRes (
"TestRes"
,
delegate
(
string
resName, Object resObj) {
if
(
null
!= resObj) {
GameObject.Instantiate(resObj);
}
// 进入目标界面等等
});
yield
return
null
;
// 进入正常游戏逻辑
}
else
{
yield
return
GameManager.Instance ().Launch ();
}
yield
return
null
;
}
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
|
// 进入测试逻辑
if
(App.Instance().mode == AppMode.Developing) {
// 测试资源加载
ResMgr.Instance ().LoadRes (
"TestRes"
,
delegate
(
string
resName, Object resObj) {
if
(
null
!= resObj) {
GameObject.Instantiate(resObj);
}
// 进入目标界面等等
});
yield
return
null
;
// 进入正常游戏逻辑
}
else
{
yield
return
GameManager.Instance ().Launch ();
}
|
1
2
3
4
5
6
7
8
9
|
///
/// 测试入口
///
public
interface
ITestEntry {
///
/// 启动
///
IEnumerator Launch();
}
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
|
///
/// AR模块测试入口
///
public
class
ARSceneTestEntry :MonoBehaviour,ITestEntry {
public
IEnumerator Launch() {
Debug.LogWarning (
"进入AR场景开始"
);
yield
return
GameObject.Find (
"ARScene"
).GetComponent
yield
return
null
;
}
}
|
1
2
3
4
5
6
7
8
9
|
// 进入测试逻辑
if
(App.Instance().mode == AppMode.Developing) {
yield
return
GetComponent
// 进入正常游戏逻辑
}
else
{
yield
return
GameManager.Instance ().Launch ();
}
|