File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 7
7
// <time> #2018年6月25日 12点06分# </time>
8
8
//-----------------------------------------------------------------------
9
9
10
+ using System ;
10
11
using System . Collections ;
11
12
using System . Collections . Generic ;
12
13
using LitJson ;
@@ -33,6 +34,7 @@ public partial class GameMode : MonoBehaviour
33
34
public static DebuggerManager Debugger ;
34
35
public static ConfigManager Config ;
35
36
public static GameMode Self ;
37
+
36
38
37
39
#region 资源
38
40
/// <summary>
@@ -66,6 +68,19 @@ public JsonData ConfigJsonData
66
68
}
67
69
#endregion
68
70
71
+ #region 回调
72
+ /// <summary>
73
+ /// 游戏进入后台时执行该方法 pause为true 切换回前台时pause为false
74
+ /// 强制暂停时,先 OnApplicationPause
75
+ /// </summary>
76
+ public static Action < bool > OnAppPause ;
77
+ /// <summary>
78
+ /// 游戏失去焦点也就是进入后台时 focus为false 切换回前台时 focus为true
79
+ /// 重新“启动”手机时,OnApplicationFocus
80
+ /// </summary>
81
+ public static Action < bool > OnAppFocus ;
82
+ #endregion
83
+
69
84
#endregion
70
85
IEnumerator Start ( )
71
86
{
@@ -133,5 +148,15 @@ private void OnDestroy()
133
148
GameFrameworkMode . ShutDown ( ) ;
134
149
}
135
150
151
+ private void OnApplicationPause ( bool pause )
152
+ {
153
+ OnAppPause ? . Invoke ( pause ) ;
154
+ }
155
+
156
+ private void OnApplicationFocus ( bool focus )
157
+ {
158
+ OnAppFocus ? . Invoke ( focus ) ;
159
+ }
160
+
136
161
}
137
162
}
You can’t perform that action at this time.
0 commit comments