public static void On_Rebuild(UIPanel panel, bool ignore) { if (UIPanelStats.instance == null) { return; } UIPanelStats.Entry entry = UIPanelStats.instance.EnsureExists(UIPanelStats.instance._allPanelList, panel); entry.rebuildTotal++; if (!ignore) { entry.rebuildCountIgnoreMutiple++; } if (UIPanelStats.instance.logAll || (UIPanelStats.instance.showAll && entry.debugLog)) { UIPanelStats.LogIt(string.Format("mRebuild on {0}", entry.name), true); } entry = UIPanelStats.instance.EnsureExists(UIPanelStats.instance._activePanelList, panel); entry.rebuildTotal++; if (!ignore) { entry.rebuildCountIgnoreMutiple++; } if (UIPanelStats.instance.logAll || (!UIPanelStats.instance.showAll && entry.debugLog)) { UIPanelStats.LogIt(string.Format("mRebuild on {0}", entry.name), true); } UIPanelStats.instance._activePanelList.RemoveAll((UIPanelStats.Entry x) => x.panel == null); UIPanelStats.instance.panelList.Sort((UIPanelStats.Entry x, UIPanelStats.Entry y) => y.UpdateGeometry - x.UpdateGeometry); }
public static string GetFullName(Transform c) { if (c == null) { return(string.Empty); } Transform parent = c.parent; return(UIPanelStats.GetFullName(parent) + "/" + c.name); }
private UIPanelStats.Entry EnsureExists(List <UIPanelStats.Entry> list, UIPanel panel) { UIPanelStats.Entry entry = list.Find((UIPanelStats.Entry x) => x.panel == panel); if (entry == null) { entry = new UIPanelStats.Entry { panel = panel, name = UIPanelStats.GetFullName(panel.transform), startTime = Time.realtimeSinceStartup }; list.Add(entry); } return(entry); }
public static void On_FillDrawCall(UIWidget uiWidget, UIDrawCall dc) { if (!UIPanelStats.instance) { return; } if (uiWidget.panel) { UIPanelStats.Entry entry = UIPanelStats.instance.EnsureExists(UIPanelStats.instance._allPanelList, uiWidget.panel); entry.fillDrawCall++; entry = UIPanelStats.instance.EnsureExists(UIPanelStats.instance._activePanelList, uiWidget.panel); entry.fillDrawCall++; } if (UIPanelStats.instance.logAll) { UIPanelStats.LogIt("FillDrawCall " + uiWidget.name, false); } }
private void OnDestroy() { UIPanelStats.instance = null; }
private void Awake() { UIPanelStats.instance = this; }
public static void On_UpdateGeometry(UIPanel panel, UIDrawCall dc, bool trim) { if (UIPanelStats.instance == null) { return; } UIPanelStats.Entry entry = UIPanelStats.instance.EnsureExists(UIPanelStats.instance._allPanelList, panel); if (trim) { entry.UpdateGeometryTrim++; } else { entry.UpdateGeometryNoTrim++; } if (dc.verts.size > entry.maxVertsSize) { entry.maxVertsSize = dc.verts.size; } entry.curVertsSize = dc.verts.size; entry = UIPanelStats.instance.EnsureExists(UIPanelStats.instance._activePanelList, panel); if (trim) { entry.UpdateGeometryTrim++; } else { entry.UpdateGeometryNoTrim++; } if (dc.verts.size > entry.maxVertsSize) { entry.maxVertsSize = dc.verts.size; } entry.curVertsSize = dc.verts.size; UIPanelStats.instance._activePanelList.RemoveAll((UIPanelStats.Entry x) => x.panel == null); UIPanelStats.instance.panelList.Sort((UIPanelStats.Entry x, UIPanelStats.Entry y) => y.UpdateGeometry - x.UpdateGeometry); if (UIPanelStats.instance.logAll) { UIPanelStats.LogIt(string.Concat(new object[] { "On_UpdateGeometry ", entry.name, " trim=", trim }), false); } if (trim && UIPanelStats.instance.logTrim) { UIPanelStats.LogIt(string.Concat(new object[] { "On_UpdateGeometry ", entry.name, " trim (v,t,c)=", dc.verts.size, ", ", dc.triangles, ", ", dc.cols.size }), false); } }