Skip to content

Commit

Permalink
- mod 命令重复注册改为替换处理
Browse files Browse the repository at this point in the history
  • Loading branch information
leviyuan committed Jan 30, 2018
1 parent c73567e commit 1e041e9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 34 deletions.
Binary file modified TTConsole.VS/Build/Release/TinyTeam.Debuger.Editor.dll
Binary file not shown.
Binary file modified TTConsole.VS/Build/Release/TinyTeam.Debuger.dll
Binary file not shown.
65 changes: 31 additions & 34 deletions TTConsole_Source_Unity/Assets/Console/Console.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1098,11 +1098,11 @@ object CMDSystemInfo(string[] args)

Log("CurrentResolution: " + Screen.currentResolution.width + " * " + Screen.currentResolution.height, MessageType.OUTPUT);
Log("Dpi: " + Screen.dpi, MessageType.OUTPUT);
#if UNITY_5_5_OR_NEWER
Log("Profiler.enabled = : " + UnityEngine.Profiling.Profiler.enabled.ToString(), MessageType.OUTPUT);
#else
#if UNITY_5_5_OR_NEWER
Log("Profiler.enabled = : " + UnityEngine.Profiling.Profiler.enabled.ToString(), MessageType.OUTPUT);
#else
Log("Profiler.enabled = : " + UnityEngine.Profiler.enabled.ToString(), MessageType.OUTPUT);
#endif
#endif

System.GC.Collect();
Log(string.Format("Total memory: {0:###,###,###,##0} kb", (System.GC.GetTotalMemory(true)) / 1024f), MessageType.OUTPUT);
Expand Down Expand Up @@ -1303,25 +1303,25 @@ object CMDShowMemory(string[] args)
Log("Texture Count:" + textures.Count, MessageType.OUTPUT);
textures.Sort((a, b) =>
{
#if UNITY_5_5_OR_NEWER
long sa = UnityEngine.Profiling.Profiler.GetRuntimeMemorySizeLong(a);
long sb = UnityEngine.Profiling.Profiler.GetRuntimeMemorySizeLong(b);
#else
#if UNITY_5_5_OR_NEWER
long sa = UnityEngine.Profiling.Profiler.GetRuntimeMemorySizeLong(a);
long sb = UnityEngine.Profiling.Profiler.GetRuntimeMemorySizeLong(b);
#else
var sa = UnityEngine.Profiler.GetRuntimeMemorySize(a);
var sb = UnityEngine.Profiler.GetRuntimeMemorySize(b);
#endif
#endif
if (sa > sb) return -1;
else if (sa < sb) return 1;
else return 0;
});
for (int i = 0; i < textures.Count && i < 100; i++)
{
#if UNITY_5_5_OR_NEWER
Log(textures[i].name + " : " + (Profiler.GetRuntimeMemorySizeLong(textures[i]) * mbseed).ToString("#0.##") + "mb", MessageType.OUTPUT);
#else
#if UNITY_5_5_OR_NEWER
Log(textures[i].name + " : " + (Profiler.GetRuntimeMemorySizeLong(textures[i]) * mbseed).ToString("#0.##") + "mb", MessageType.OUTPUT);
#else
Log(textures[i].name + " : " + (Profiler.GetRuntimeMemorySize(textures[i]) * mbseed).ToString("#0.##") + "mb", MessageType.OUTPUT);
#endif
#endif

}

//sounds
Expand All @@ -1330,25 +1330,25 @@ object CMDShowMemory(string[] args)
Log("Sound Count:" + clips.Count, MessageType.OUTPUT);
clips.Sort((a, b) =>
{
#if UNITY_5_5_OR_NEWER
long sa = UnityEngine.Profiling.Profiler.GetRuntimeMemorySizeLong(a);
long sb = UnityEngine.Profiling.Profiler.GetRuntimeMemorySizeLong(b);
#else
#if UNITY_5_5_OR_NEWER
long sa = UnityEngine.Profiling.Profiler.GetRuntimeMemorySizeLong(a);
long sb = UnityEngine.Profiling.Profiler.GetRuntimeMemorySizeLong(b);
#else
var sa = UnityEngine.Profiler.GetRuntimeMemorySize(a);
var sb = UnityEngine.Profiler.GetRuntimeMemorySize(b);
#endif
#endif
if (sa > sb) return -1;
else if (sa < sb) return 1;
else return 0;
});
for (int i = 0; i < clips.Count; i++)
{
#if UNITY_5_5_OR_NEWER
Log(clips[i].name + " : " + (Profiler.GetRuntimeMemorySizeLong(clips[i]) * mbseed).ToString("#0.##") + "mb", MessageType.OUTPUT);
#else
#if UNITY_5_5_OR_NEWER
Log(clips[i].name + " : " + (Profiler.GetRuntimeMemorySizeLong(clips[i]) * mbseed).ToString("#0.##") + "mb", MessageType.OUTPUT);
#else
Log(clips[i].name + " : " + (Profiler.GetRuntimeMemorySize(clips[i]) * mbseed).ToString("#0.##") + "mb", MessageType.OUTPUT);
#endif
#endif

}

return "end.";
Expand Down Expand Up @@ -1412,11 +1412,8 @@ void RegisterCommandCallback(string commandString, Func<string[], object> comman
{
try
{
///wont add again.
if (_cmdTable.ContainsKey(commandString)) return;

_cmdTable[commandString] = commandCallback;
_cmdTableDiscribes.Add(commandString, CMD_Discribes);
_cmdTableDiscribes[commandString] = CMD_Discribes;
}
catch (Exception e)
{
Expand Down Expand Up @@ -1990,14 +1987,14 @@ public bool Update(int updateInterval)
{
preTime = Time.realtimeSinceStartup;
}
#if UNITY_5_5_OR_NEWER
totalReserved = UnityEngine.Profiling.Profiler.GetTotalReservedMemoryLong();
allocated = UnityEngine.Profiling.Profiler.GetTotalAllocatedMemoryLong();
#else
#if UNITY_5_5_OR_NEWER
totalReserved = UnityEngine.Profiling.Profiler.GetTotalReservedMemoryLong();
allocated = UnityEngine.Profiling.Profiler.GetTotalAllocatedMemoryLong();
#else
totalReserved = (long)UnityEngine.Profiler.GetTotalReservedMemory();
allocated = (long)UnityEngine.Profiler.GetTotalAllocatedMemory();
#endif
#endif

monoMemory = GC.GetTotalMemory(false);
return true;
}
Expand Down

0 comments on commit 1e041e9

Please sign in to comment.