// 在scrollview里填充log,unity m_upperPanelScroll = GUILayout.BeginScrollView(m_upperPanelScroll); for (int i = 0; i < m_logItems.Count; i++) { if (m_logTypeForUnshow.Contains(m_logItems[i].GetLogType)) { continue; }
// 画的时候,顺便接受item的点击的结果 if (DrawLogBox(m_logItems[i].LogInfo, m_logItems[i].GetLogType, i % 2 == 0, m_logItems[i].IsSelected)) { if (null != m_selectedLogItem) { if (m_logItems[i] == m_selectedLogItem) { // click a some one, open code // JumpToCurrentLogPos(); // 跳转到你点击的Log的顶部的代码文件(如果可以 } else { m_selectedLogItem.IsSelected = false; m_selectedLogItem = m_logItems[i]; m_selectedLogItem.IsSelected = true; } } else { m_selectedLogItem = m_logItems[i]; m_selectedLogItem.IsSelected = true; } // 准备刷新 GUI.changed = true; } }
GUILayout.EndScrollView(); GUILayout.EndArea(); }
privatevoidOnGUI() { // ..... if (GUI.changed) { Repaint(); } }
logDetailMutiLine = logDetail.Split('\n'); for (int i = 0; i < logDetailMutiLine.Length; i++) { // Regex match 'at xxx' Match matches = Regex.Match(logDetailMutiLine[i], @"\(at (.+)\)", RegexOptions.Multiline);
if (matches.Success) { while (matches.Success) { pathline = matches.Groups[1].Value; if (pathline.Contains(tempCase)) { int splitIndex = pathline.LastIndexOf(":"); path = pathline.Substring(0, splitIndex); line = Convert.ToInt32(pathline.Substring(splitIndex + 1)); string fullpath = Application.dataPath.Substring(0, Application.dataPath.LastIndexOf("Assets")); fullpath = fullpath + path; splitwa = logDetailMutiLine[i].LastIndexOf("("); logDetailMutiLine[i] = logDetailMutiLine[i].Substring(0, splitwa);