File tree Expand file tree Collapse file tree 2 files changed +28
-6
lines changed Expand file tree Collapse file tree 2 files changed +28
-6
lines changed Original file line number Diff line number Diff line change 66
77namespace KBEngine
88{
9+ public enum DEBUGLEVEL : int
10+ {
11+ DEBUG = 0 ,
12+ INFO ,
13+ WARNING ,
14+ ERROR ,
15+
16+ NOLOG , // 放在最后面,使用这个时表示不输出任何日志(!!!慎用!!!)
17+ }
18+
919 public class Dbg
1020 {
21+ static public DEBUGLEVEL debugLevel = DEBUGLEVEL . DEBUG ;
22+
1123#if UNITY_EDITOR
1224 static Dictionary < string , Profile > _profiles = new Dictionary < string , Profile > ( ) ;
1325#endif
@@ -19,22 +31,26 @@ public static string getHead()
1931
2032 public static void INFO_MSG ( object s )
2133 {
22- Debug . Log ( getHead ( ) + s ) ;
34+ if ( DEBUGLEVEL . INFO >= debugLevel )
35+ Debug . Log ( getHead ( ) + s ) ;
2336 }
2437
2538 public static void DEBUG_MSG ( object s )
2639 {
27- Debug . Log ( getHead ( ) + s ) ;
40+ if ( DEBUGLEVEL . DEBUG >= debugLevel )
41+ Debug . Log ( getHead ( ) + s ) ;
2842 }
2943
3044 public static void WARNING_MSG ( object s )
3145 {
32- Debug . LogWarning ( getHead ( ) + s ) ;
46+ if ( DEBUGLEVEL . WARNING >= debugLevel )
47+ Debug . LogWarning ( getHead ( ) + s ) ;
3348 }
3449
3550 public static void ERROR_MSG ( object s )
3651 {
37- Debug . LogError ( getHead ( ) + s ) ;
52+ if ( DEBUGLEVEL . ERROR >= debugLevel )
53+ Debug . LogError ( getHead ( ) + s ) ;
3854 }
3955
4056 public static void profileStart ( string name )
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ public class KBEMain : MonoBehaviour
1313 public KBEngineApp gameapp = null ;
1414
1515 // 在unity3d界面中可见选项
16+ public DEBUGLEVEL debugLevel = DEBUGLEVEL . DEBUG ;
1617 public bool isMultiThreads = true ;
1718 public string ip = "127.0.0.1" ;
1819 public int port = 20013 ;
@@ -43,7 +44,9 @@ public virtual void installEvents()
4344 public virtual void initKBEngine ( )
4445 {
4546 // 如果此处发生错误,请查看 Assets\Scripts\kbe_scripts\if_Entity_error_use______git_submodule_update_____kbengine_plugins_______open_this_file_and_I_will_tell_you.cs
46-
47+
48+ Dbg . debugLevel = debugLevel ;
49+
4750 KBEngineArgs args = new KBEngineArgs ( ) ;
4851
4952 args . ip = ip ;
@@ -72,7 +75,10 @@ public virtual void initKBEngine()
7275 void OnDestroy ( )
7376 {
7477 MonoBehaviour . print ( "clientapp::OnDestroy(): begin" ) ;
75- KBEngineApp . app . destroy ( ) ;
78+ if ( KBEngineApp . app != null )
79+ {
80+ KBEngineApp . app . destroy ( ) ;
81+ }
7682 MonoBehaviour . print ( "clientapp::OnDestroy(): end" ) ;
7783 }
7884
You can’t perform that action at this time.
0 commit comments