public override string ToString() { System.Text.StringBuilder sb = StrBuilderCache.Acquire(); if (m_ViewStack != null && m_ViewStack.Count > 0) { sb.Append("\n========== View Stack ==========\n"); sb.AppendLine(); for (int k = 0; k < m_ViewStack.Count; k++) { if (m_ViewStack.Elements[k] != null) { sb.AppendLine(string.Format("<color=green>{0} | order:{1} | tpye: <{2}></color>", m_ViewStack.Elements[k].name, m_ViewStack.Elements[k].viewOrder.ToString(), m_ViewStack.Elements[k].viewType.ToString())); //检查是否有content 内容 List <Object> list = m_ViewStack.Elements[k].ListUpdateUI; for (int t = 0; t < list.Count; t++) { if (list[t] is UIContent && (list[t] as UIContent).target != null) { //sb.AppendLine(); sb.AppendLine(string.Format("\t\t<color=yellow>{0}->{1}</color>", (list[t] as UIContent).updateKey, (list[t] as UIContent).target.name)); } } sb.AppendLine(); } else { sb.AppendLine("<color=red> <NULL> </color>"); } } } return(StrBuilderCache.GetStringAndRelease(sb)); }
public static void UF_SplitString(string param, List <string> outlist, char split = ';') { if (outlist == null || string.IsNullOrEmpty(param)) { return; } outlist.Clear(); StringBuilder sb = StrBuilderCache.Acquire(); for (int k = 0; k < param.Length; k++) { if (param[k] == split) { outlist.Add(sb.ToString()); sb.Clear(); } else { sb.Append(param[k]); } } if (sb.Length > 0) { outlist.Add(sb.ToString()); } StrBuilderCache.Release(sb); }
public string UF_GetPoolEntityInfo() { if (m_PoolEntitys.Count > 0) { var dicCache = DictionaryCache <string, int> .Acquire(); System.Text.StringBuilder infoStr = StrBuilderCache.Acquire(); infoStr.Remove(0, infoStr.Length); m_PoolEntitys.UF_NForeach( (e) => { if (e != null) { if (!dicCache.ContainsKey(e.name)) { dicCache.Add(e.name, 0); } dicCache[e.name] = dicCache[e.name] + 1; } return(true); } ); foreach (KeyValuePair <string, int> item in dicCache) { if (item.Value > 0) { int tick = (int)(GTime.Time - m_PoolEntitys.UF_Get(item.Key).timeStamp); infoStr.AppendLine(string.Format("{0} : {1} -> {2}", item.Key, item.Value, tick)); } } DictionaryCache <string, int> .Release(dicCache); return(StrBuilderCache.GetStringAndRelease(infoStr)); } return(string.Empty); }
public string UF_GetActiveEntityInfo() { if (m_ListActive.Count > 0) { System.Text.StringBuilder infoStr = StrBuilderCache.Acquire(); var dicCache = DictionaryCache <string, int> .Acquire(); m_ListActive.UF_NForeach( (e) => { if (e != null) { if (!dicCache.ContainsKey(e.name)) { dicCache.Add(e.name, 0); } dicCache[e.name] = dicCache[e.name] + 1; } return(true); } ); foreach (KeyValuePair <string, int> item in dicCache) { if (item.Value > 0) { infoStr.AppendLine(string.Format("{0} : {1}", item.Key, item.Value)); } } DictionaryCache <string, int> .Release(dicCache); return(StrBuilderCache.GetStringAndRelease(infoStr)); } return(string.Empty); }
public override string ToString() { System.Text.StringBuilder sb = StrBuilderCache.Acquire(); sb.Append(string.Format("RefObjectManager count:{0} \n", m_DicRefObjects.Count)); foreach (RefObject refObj in m_DicRefObjects.Values) { sb.Append(string.Format("\t {0} | type<{1}> | ref -> {2}\n", refObj.target.name, refObj.target.GetType().Name, refObj.Refcount)); } return(StrBuilderCache.GetStringAndRelease(sb)); }
public override string ToString() { System.Text.StringBuilder sb = StrBuilderCache.Acquire(); sb.Append(string.Format("PDataManager count:{0} \n", m_DicPersistentData.Count)); foreach (KeyValuePair <string, ConfigFile> item in m_DicPersistentData) { sb.Append(string.Format("\t {0} \n", item.Key)); } return(StrBuilderCache.GetStringAndRelease(sb)); }
public override string ToString() { System.Text.StringBuilder sb = StrBuilderCache.Acquire(); sb.Append(string.Format("Audio Count:{0} \n", m_ListAudios.Count)); for (int k = 0; k < m_ListAudios.Count; k++) { sb.Append(string.Format("\t {0} | Type:{1} | State:{2}\n", m_ListAudios [k].name, m_ListAudios [k].audioType, m_ListAudios [k].isPlaying.ToString())); } return(StrBuilderCache.GetStringAndRelease(sb)); }
public override string ToString() { System.Text.StringBuilder body = StrBuilderCache.Acquire(); int count = m_DicBundleBuffer.Values.Count; body.AppendFormat("[{0}/{1}] [AssAssetBundle] <{2}>\n", (int)m_TickDuration, m_MaxTickCount, count); foreach (AssetBundleData item in m_DicBundleBuffer.Values) { body.AppendFormat("{0} | <color=yellow>ref -> {2}</color> <color={4}>flag[{1}]</color> <color={5}>tick [{3}]</color>\n", item.name, item.flag, item.refCount, item.tick, item.flag == LoadAssetBundleOptions.UNLOAD_IN_NO_REF ? "green" : "white", item.tick > 0?"red":"grey"); } return(StrBuilderCache.GetStringAndRelease(body)); }
public override string ToString() { System.Text.StringBuilder sb = StrBuilderCache.Acquire(); List <FXController> list = ListCache <FXController> .Acquire(); UF_GetAllActiveFXController(list); sb.AppendLine(string.Format("FX Count:{0} \n", list.Count)); foreach (FXController val in list) { if (val != null) { sb.AppendLine(string.Format("\t {0} | life: {1} | left: {2} ", val.name, val.life, val.leftLife)); } } ListCache <FXController> .Release(list); return(StrBuilderCache.GetStringAndRelease(sb)); }
public override string ToString() { System.Text.StringBuilder sb = StrBuilderCache.Acquire(); sb.Append(string.Format("tickCount={0} \n connectCount={1}", tickCount, connectCount)); sb.Append("connectInfo:\n"); for (int k = 0; k < m_ListConnections.Count; k++) { if (m_ListConnections [k] != null) { NetConnection connection = m_ListConnections [k]; sb.Append(string.Format("\tIP:{0} | Port:{1} | State:{2} | R:{3} | W:{4}\n", connection.host, connection.port, connection.connectState, connection.readBufferSize, connection.writeBufferSize)); } } return(StrBuilderCache.GetStringAndRelease(sb)); }
public static void UF_Error(string error) { System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(true); System.Text.StringBuilder sb = StrBuilderCache.Acquire(); sb.AppendLine(error); sb.AppendLine("Stack:"); foreach (System.Diagnostics.StackFrame sf in st.GetFrames()) { sb.AppendLine(string.Format("\t{0}.{1}:{2}", sf.GetMethod().DeclaringType.FullName, sf.GetMethod().Name, sf.GetFileLineNumber() )); } string info = StrBuilderCache.GetStringAndRelease(sb); #if UNITY_EDITOR Debug.LogError(info); #endif //ingore active ,still write to loger Debugger.UF_GetInstance().UF_LogMessage(TAG_ERROR, info); }
//系统相关信息 private void UF_DrawTagInfo() { GUILayout.Space(4); System.Text.StringBuilder sb = StrBuilderCache.Acquire(); sb.Append(string.Format("AppPath:{0}", GlobalPath.AppPath)); sb.AppendLine(); sb.Append(string.Format("StreamingAssetsPath:{0}", GlobalPath.StreamingAssetsPath)); sb.AppendLine(); sb.Append(string.Format("PersistentPath:{0}", GlobalPath.PersistentPath)); sb.AppendLine(); sb.Append(string.Format("DeviceModel: {0}", GlobalSettings.DeviceModel)); sb.AppendLine(); sb.Append(string.Format("DeviceIMEI: {0}", GlobalSettings.DeviceIMEI)); sb.AppendLine(); sb.Append(string.Format("DeviceOS: {0}", GlobalSettings.DeviceOS)); sb.AppendLine(); sb.Append(string.Format("Battery: {0}", GlobalSettings.BatteryValue)); sb.AppendLine(); sb.Append(string.Format("BatteryStatus: {0}", GlobalSettings.BatteryStatus)); GUILayout.TextArea(StrBuilderCache.GetStringAndRelease(sb)); }
public string UF_ForeachToString(DelegateMsgToStrForeach method) { try{ System.Text.StringBuilder sb = StrBuilderCache.Acquire(); sb.Remove(0, sb.Length); if (m_PtrCurIdx == m_TrackInfo.Length - 1) { for (int k = 0; k < m_TrackInfo.Length; k++) { sb.AppendLine(method(m_TrackInfo[k], m_TrackStamp[k])); } } else if (m_TrackInfo[m_PtrCurIdx + 1] != null) { for (int k = m_PtrCurIdx + 1; k < m_TrackInfo.Length; k++) { sb.AppendLine(method(m_TrackInfo[k], m_TrackStamp[k])); } for (int k = 0; k <= m_PtrCurIdx; k++) { sb.AppendLine(method(m_TrackInfo[k], m_TrackStamp[k])); } } else { for (int k = 0; k <= m_PtrCurIdx; k++) { sb.AppendLine(method(m_TrackInfo[k], m_TrackStamp[k])); } } return(StrBuilderCache.GetStringAndRelease(sb)); } catch (System.Exception e) { Debugger.UF_Exception(e); return(string.Empty); } }
public void UF_DrawInfo(Rect rect) { if (m_CurrentTag == TAG_INFO_ENTITY) { GUILayout.BeginHorizontal(); var sb = StrBuilderCache.Acquire(); sb.AppendLine(string.Format("== Active Count: {0} ==", CEntitySystem.UF_GetInstance().ActiveCount)); sb.AppendLine(); sb.AppendLine(CEntitySystem.UF_GetInstance().UF_GetActiveEntityInfo()); GUI.color = Color.green; GUILayout.Box(sb.ToString()); sb.Clear(); sb.AppendLine(string.Format("== Pool Count: {0} ==", CEntitySystem.UF_GetInstance().PoolCount)); sb.AppendLine(); sb.AppendLine(CEntitySystem.UF_GetInstance().UF_GetPoolEntityInfo()); GUI.color = Color.white; GUILayout.Box(sb.ToString()); StrBuilderCache.Release(sb); GUILayout.EndHorizontal(); } else if (m_CurrentTag == TAG_INFO_AB) { GUILayout.Label("Total Count: " + AssetSystem.UF_GetInstance().count); GUILayout.Box(AssetSystem.UF_GetInstance().ToString()); } else if (m_CurrentTag == TAG_LOAD_TRACK) { if (Debugger.UF_GetInstance().MsgTrackers.ContainsKey(Debugger.TRACK_RES_LOAD)) { MsgTracker tracker = Debugger.UF_GetInstance().MsgTrackers[Debugger.TRACK_RES_LOAD]; GUILayout.Box(tracker.UF_ForeachToString(UF_TrackMsgForeach)); } } else if (m_CurrentTag == TAG_UI) { var lastAlignment = GUI.skin.box.alignment; GUI.skin.box.alignment = TextAnchor.MiddleLeft; GUILayout.Box(UIManager.UF_GetInstance().ToString()); GUI.skin.box.alignment = lastAlignment; } else if (m_CurrentTag == TAG_RefObject) { GUILayout.Box(RefObjectManager.UF_GetInstance().ToString()); } else if (m_CurrentTag == TAG_AUDIO) { GUILayout.Box(AudioManager.UF_GetInstance().ToString()); } else if (m_CurrentTag == TAG_SHADER) { GUILayout.Box(ShaderManager.UF_GetInstance().UF_GetShadersInfo()); } else if (m_CurrentTag == TAG_ASSETDB) { int countBundle = AssetDataBases.UF_GetAssetInfoCount(AssetDataBases.AssetFileType.Bundle); int countRebundle = AssetDataBases.UF_GetAssetInfoCount(AssetDataBases.AssetFileType.Rebundle); int countRuntimes = AssetDataBases.UF_GetAssetInfoCount(AssetDataBases.AssetFileType.Runtimes); int countNone = AssetDataBases.UF_GetAssetInfoCount(AssetDataBases.AssetFileType.None); GUILayout.Box(string.Format("Bundle-> {0}", countBundle)); GUILayout.Box(string.Format("Runtime-> {0}", countRuntimes)); GUILayout.Box(string.Format("Rebundle-> {0}", countRebundle)); GUILayout.Box(string.Format("None-> {0}", countNone)); } }