Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
kbengine committed Aug 11, 2015
1 parent db9c86e commit 5b48a84
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
24 changes: 20 additions & 4 deletions Dbg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,20 @@

namespace KBEngine
{
public enum DEBUGLEVEL : int
{
DEBUG = 0,
INFO,
WARNING,
ERROR,

NOLOG, // 放在最后面,使用这个时表示不输出任何日志(!!!慎用!!!)
}

public class Dbg
{
static public DEBUGLEVEL debugLevel = DEBUGLEVEL.DEBUG;

#if UNITY_EDITOR
static Dictionary<string, Profile> _profiles = new Dictionary<string, Profile>();
#endif
Expand All @@ -19,22 +31,26 @@ public static string getHead()

public static void INFO_MSG(object s)
{
Debug.Log(getHead() + s);
if (DEBUGLEVEL.INFO >= debugLevel)
Debug.Log(getHead() + s);
}

public static void DEBUG_MSG(object s)
{
Debug.Log(getHead() + s);
if (DEBUGLEVEL.DEBUG >= debugLevel)
Debug.Log(getHead() + s);
}

public static void WARNING_MSG(object s)
{
Debug.LogWarning(getHead() + s);
if (DEBUGLEVEL.WARNING >= debugLevel)
Debug.LogWarning(getHead() + s);
}

public static void ERROR_MSG(object s)
{
Debug.LogError(getHead() + s);
if (DEBUGLEVEL.ERROR >= debugLevel)
Debug.LogError(getHead() + s);
}

public static void profileStart(string name)
Expand Down
10 changes: 8 additions & 2 deletions KBEMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class KBEMain : MonoBehaviour
public KBEngineApp gameapp = null;

// 在unity3d界面中可见选项
public DEBUGLEVEL debugLevel = DEBUGLEVEL.DEBUG;
public bool isMultiThreads = true;
public string ip = "127.0.0.1";
public int port = 20013;
Expand Down Expand Up @@ -43,7 +44,9 @@ public virtual void installEvents()
public virtual void initKBEngine()
{
// 如果此处发生错误,请查看 Assets\Scripts\kbe_scripts\if_Entity_error_use______git_submodule_update_____kbengine_plugins_______open_this_file_and_I_will_tell_you.cs


Dbg.debugLevel = debugLevel;

KBEngineArgs args = new KBEngineArgs();

args.ip = ip;
Expand Down Expand Up @@ -72,7 +75,10 @@ public virtual void initKBEngine()
void OnDestroy()
{
MonoBehaviour.print("clientapp::OnDestroy(): begin");
KBEngineApp.app.destroy();
if (KBEngineApp.app != null)
{
KBEngineApp.app.destroy();
}
MonoBehaviour.print("clientapp::OnDestroy(): end");
}

Expand Down

0 comments on commit 5b48a84

Please sign in to comment.