protected override void OnAllLoadEnd() { base.OnAllLoadEnd(); FPSCounterGO = SelfBaseGlobal.GRMgr.GetResources("BaseFPSCounter", true); FPSCounter = FPSCounterGO.GetComponentInChildren <AFPSCounter>(); ShowFPS(isShowFPS); }
/// <summary> /// For internal usage! /// </summary> internal void Init() { if (!enabled) { return; } if (!HasData()) { return; } if (colorCached == null) { colorCached = "<color=#" + AFPSCounter.Color32ToHex(color) + ">"; } inited = true; if (text == null) { text = new StringBuilder(); } else { text.Length = 0; } UpdateValue(); }
internal override void Activate() { if (!enabled || inited || !HasData()) { return; } base.Activate(); inited = true; if (main.OperationMode == AFPSCounterOperationMode.Normal) { if (colorCached == null) { colorCached = "<color=#" + AFPSCounter.Color32ToHex(color) + ">"; } } if (text == null) { text = new StringBuilder(); } else { text.Remove(0, text.Length); } UpdateValue(); }
protected void CacheCriticalColor() { string colorString = AFPSCounter.Color32ToHex(colorCritical); colorCriticalCached = String.Format(FPS_TEXT_START, colorString); colorCriticalCachedMin = String.Format(MIN_TEXT_START, colorString); colorCriticalCachedMax = String.Format(MAX_TEXT_START, colorString); colorCriticalCachedAvg = String.Format(AVG_TEXT_START, colorString); }
protected void CacheCriticalColor() { string arg = AFPSCounter.Color32ToHex(this.colorCritical); this.colorCriticalCached = string.Format("<color=#{0}><b>FPS: ", arg); this.colorCriticalCachedMin = string.Format("\n<color=#{0}><b>MIN: ", arg); this.colorCriticalCachedMax = string.Format("<color=#{0}><b>MAX: ", arg); this.colorCriticalCachedAvg = string.Format(" <color=#{0}><b>AVG: ", arg); }
protected override void CacheCurrentColor() { string arg = AFPSCounter.Color32ToHex(this.color); this.colorCached = string.Format("<color=#{0}><b>FPS: ", arg); this.colorCachedMin = string.Format("\n<color=#{0}><b>MIN: ", arg); this.colorCachedMax = string.Format("<color=#{0}><b>MAX: ", arg); this.colorCachedAvg = string.Format(" <color=#{0}><b>AVG: ", arg); }
protected override void CacheCurrentColor() { string colorString = AFPSCounter.Color32ToHex(color); colorCached = String.Format(FPS_TEXT_START, colorString); colorCachedMin = String.Format(MIN_TEXT_START, colorString); colorCachedMax = String.Format(MAX_TEXT_START, colorString); colorCachedAvg = String.Format(AVG_TEXT_START, colorString); }
internal void Dispose() { this.main = null; if (this.text != null) { this.text.Remove(0, this.text.Length); this.text = null; } }
protected void CacheCriticalColor() { var colorString = AFPSCounter.Color32ToHex(colorCritical); colorCriticalCached = string.Format(FPSTextStart, colorString); colorCriticalCachedMs = string.Format(MsTextStart, colorString); colorCriticalCachedMin = string.Format(MinTextStart, colorString); colorCriticalCachedMax = string.Format(MaxTextStart, colorString); colorCriticalCachedAvg = string.Format(AvgTextStart, colorString); }
internal void Destroy() { main = null; if (text != null) { text.Remove(0, text.Length); text = null; } }
internal void Dispose() { main = null; if (text != null) { text.Remove(0, text.Length); text = null; } }
protected void CacheWarningColor() { string colorString = AFPSCounter.Color32ToHex(colorWarning); colorWarningCached = string.Format(FPS_TEXT_START, colorString); colorWarningCachedMs = string.Format(MS_TEXT_START, colorString); colorWarningCachedMin = string.Format(MIN_TEXT_START, colorString); colorWarningCachedMax = string.Format(MAX_TEXT_START, colorString); colorWarningCachedAvg = string.Format(AVG_TEXT_START, colorString); }
protected override void CacheCurrentColor() { var colorString = AFPSCounter.Color32ToHex(color); colorCached = string.Format(FPSTextStart, colorString); colorCachedMs = string.Format(MsTextStart, colorString); colorCachedMin = string.Format(MinTextStart, colorString); colorCachedMax = string.Format(MaxTextStart, colorString); colorCachedAvg = string.Format(AvgTextStart, colorString); var colorRenderString = AFPSCounter.Color32ToHex(colorRender); colorCachedRender = string.Format(RenderTextStart, colorRenderString); }
protected override void CacheCurrentColor() { string colorString = AFPSCounter.Color32ToHex(color); colorCached = string.Format(FPS_TEXT_START, colorString); colorCachedMs = string.Format(MS_TEXT_START, colorString); colorCachedMin = string.Format(MIN_TEXT_START, colorString); colorCachedMax = string.Format(MAX_TEXT_START, colorString); colorCachedAvg = string.Format(AVG_TEXT_START, colorString); string colorRenderString = AFPSCounter.Color32ToHex(colorRender); colorCachedRender = string.Format(RENDER_TEXT_START, colorRenderString); }
protected void CacheWarningColor() { string colorString = AFPSCounter.Color32ToHex(colorWarning); colorWarningCached = String.Format(FPS_TEXT_START, colorString); if (oneLine) { colorWarningCachedMin = String.Format(" " + MIN_TEXT_START, colorString); } else { colorWarningCachedMin = String.Format("\n" + MIN_TEXT_START, colorString); } colorWarningCachedMax = String.Format(MAX_TEXT_START, colorString); colorWarningCachedAvg = String.Format(AVG_TEXT_START, colorString); }
/// <summary> /// For internal usage! /// </summary> internal void Init() { if (!enabled) { return; } string color; if (colorNormalCached == null) { color = String.Format(TEXT_START, AFPSCounter.Color32ToHex(colorNormal)); colorNormalCached = color + "FPS: "; colorNormalCachedAvg = color + " AVG: "; } if (colorWarningCached == null) { color = String.Format(TEXT_START, AFPSCounter.Color32ToHex(colorWarning)); colorWarningCached = color + "FPS: "; colorWarningCachedAvg = color + " AVG: "; } if (colorCriticalCached == null) { color = String.Format(TEXT_START, AFPSCounter.Color32ToHex(colorCritical)); colorCriticalCached = color + "FPS: "; colorCriticalCachedAvg = color + " AVG: "; } previousValue = 0; if (text == null) { text = new StringBuilder(100); } else { text.Length = 0; } text.Append(colorCriticalCached).Append("0").Append(TEXT_END); dirty = true; AFPSCounter.Instance.StartCoroutine(COROUTINE_NAME); }
private void Start() { Application.targetFrameRate = 300; // will add AFPSCounter to the scene if it not exists // you don't need to call it if you already have AFPSCounter in the scene var newCounterInstance = AFPSCounter.AddToScene(false); // you also may get the instance at any time // using AFPSCounter.Instance property newCounterInstance.fpsCounter.OnFPSLevelChange += OnFPSLevelChanged; newCounterInstance.OperationMode = OperationMode.Background; _configuration.CurrentFpsLevel = FPSLevel.Normal; Invoke("CanUpdateMinValue", 1f); }
internal override void Activate() { if (!enabled || !HasData()) { return; } base.Activate(); inited = true; if (main.OperationMode == OperationMode.Normal) { if (colorCached == null) { colorCached = "<color=#" + AFPSCounter.Color32ToHex(color) + ">"; } } UpdateValue(); }
internal override void Activate() { if (!this.enabled || this.inited || !this.HasData()) { return; } base.Activate(); this.inited = true; if (this.main.OperationMode == AFPSCounterOperationMode.Normal && this.colorCached == null) { this.colorCached = "<color=#" + AFPSCounter.Color32ToHex(this.color) + ">"; } if (this.text == null) { this.text = new StringBuilder(); } else { this.text.Remove(0, this.text.Length); } this.UpdateValue(); }
protected override void CacheCurrentColor() { this.colorCached = string.Format("<color=#{0}><b>", AFPSCounter.Color32ToHex(this.color)); }
internal void Init(AFPSCounter reference) { main = reference; }
public void OnEnable() { me = target as AFPSCounter; operationMode = serializedObject.FindProperty("operationMode"); hotKey = serializedObject.FindProperty("hotKey"); hotKeyCtrl = serializedObject.FindProperty("hotKeyCtrl"); hotKeyShift = serializedObject.FindProperty("hotKeyShift"); hotKeyAlt = serializedObject.FindProperty("hotKeyAlt"); circleGesture = serializedObject.FindProperty("circleGesture"); keepAlive = serializedObject.FindProperty("keepAlive"); forceFrameRate = serializedObject.FindProperty("forceFrameRate"); forcedFrameRate = serializedObject.FindProperty("forcedFrameRate"); lookAndFeelFoldout = serializedObject.FindProperty("lookAndFeelFoldout"); autoScale = serializedObject.FindProperty("autoScale"); scaleFactor = serializedObject.FindProperty("scaleFactor"); labelsFont = serializedObject.FindProperty("labelsFont"); fontSize = serializedObject.FindProperty("fontSize"); lineSpacing = serializedObject.FindProperty("lineSpacing"); countersSpacing = serializedObject.FindProperty("countersSpacing"); paddingOffset = serializedObject.FindProperty("paddingOffset"); pixelPerfect = serializedObject.FindProperty("pixelPerfect"); background = serializedObject.FindProperty("background"); backgroundColor = serializedObject.FindProperty("backgroundColor"); backgroundPadding = serializedObject.FindProperty("backgroundPadding"); shadow = serializedObject.FindProperty("shadow"); shadowColor = serializedObject.FindProperty("shadowColor"); shadowDistance = serializedObject.FindProperty("shadowDistance"); outline = serializedObject.FindProperty("outline"); outlineColor = serializedObject.FindProperty("outlineColor"); outlineDistance = serializedObject.FindProperty("outlineDistance"); advancedFoldout = serializedObject.FindProperty("advancedFoldout"); sortingOrder = serializedObject.FindProperty("sortingOrder"); fps = serializedObject.FindProperty("fpsCounter"); fpsEnabled = fps.FindPropertyRelative("enabled"); fpsInterval = fps.FindPropertyRelative("updateInterval"); fpsAnchor = fps.FindPropertyRelative("anchor"); realtimeFPSFoldout = fps.FindPropertyRelative("realtimeFPSFoldout"); fpsRealtime = fps.FindPropertyRelative("realtimeFPS"); fpsMilliseconds = fps.FindPropertyRelative("milliseconds"); averageFoldout = fps.FindPropertyRelative("averageFoldout"); fpsAverage = fps.FindPropertyRelative("average"); fpsAverageMilliseconds = fps.FindPropertyRelative("averageMilliseconds"); fpsAverageNewLine = fps.FindPropertyRelative("averageNewLine"); fpsAverageSamples = fps.FindPropertyRelative("averageSamples"); fpsResetAverageOnNewScene = fps.FindPropertyRelative("resetAverageOnNewScene"); minMaxFoldout = fps.FindPropertyRelative("minMaxFoldout"); fpsMinMax = fps.FindPropertyRelative("minMax"); fpsMinMaxMilliseconds = fps.FindPropertyRelative("minMaxMilliseconds"); fpsMinMaxNewLine = fps.FindPropertyRelative("minMaxNewLine"); fpsMinMaxTwoLines = fps.FindPropertyRelative("minMaxTwoLines"); fpsResetMinMaxOnNewScene = fps.FindPropertyRelative("resetMinMaxOnNewScene"); fpsMinMaxIntervalsToSkip = fps.FindPropertyRelative("minMaxIntervalsToSkip"); renderFoldout = fps.FindPropertyRelative("renderFoldout"); fpsRender = fps.FindPropertyRelative("render"); fpsRenderNewLine = fps.FindPropertyRelative("renderNewLine"); fpsRenderAutoAdd = fps.FindPropertyRelative("renderAutoAdd"); fpsWarningLevelValue = fps.FindPropertyRelative("warningLevelValue"); fpsCriticalLevelValue = fps.FindPropertyRelative("criticalLevelValue"); fpsColor = fps.FindPropertyRelative("color"); fpsColorWarning = fps.FindPropertyRelative("colorWarning"); fpsColorCritical = fps.FindPropertyRelative("colorCritical"); fpsColorRender = fps.FindPropertyRelative("colorRender"); fpsStyle = fps.FindPropertyRelative("style"); memory = serializedObject.FindProperty("memoryCounter"); memoryEnabled = memory.FindPropertyRelative("enabled"); memoryInterval = memory.FindPropertyRelative("updateInterval"); memoryAnchor = memory.FindPropertyRelative("anchor"); memoryPrecise = memory.FindPropertyRelative("precise"); memoryColor = memory.FindPropertyRelative("color"); memoryStyle = memory.FindPropertyRelative("style"); memoryTotal = memory.FindPropertyRelative("total"); memoryAllocated = memory.FindPropertyRelative("allocated"); memoryMonoUsage = memory.FindPropertyRelative("monoUsage"); memoryGfx = memory.FindPropertyRelative("gfx"); device = serializedObject.FindProperty("deviceInfoCounter"); deviceEnabled = device.FindPropertyRelative("enabled"); deviceAnchor = device.FindPropertyRelative("anchor"); deviceColor = device.FindPropertyRelative("color"); deviceStyle = device.FindPropertyRelative("style"); devicePlatform = device.FindPropertyRelative("platform"); deviceCpuModel = device.FindPropertyRelative("cpuModel"); deviceCpuModelNewLine = device.FindPropertyRelative("cpuModelNewLine"); deviceGpuModel = device.FindPropertyRelative("gpuModel"); deviceGpuModelNewLine = device.FindPropertyRelative("gpuModelNewLine"); deviceGpuApi = device.FindPropertyRelative("gpuApi"); deviceGpuApiNewLine = device.FindPropertyRelative("gpuApiNewLine"); deviceGpuSpec = device.FindPropertyRelative("gpuSpec"); deviceGpuSpecNewLine = device.FindPropertyRelative("gpuSpecNewLine"); deviceRamSize = device.FindPropertyRelative("ramSize"); deviceRamSizeNewLine = device.FindPropertyRelative("ramSizeNewLine"); deviceScreenData = device.FindPropertyRelative("screenData"); deviceScreenDataNewLine = device.FindPropertyRelative("screenDataNewLine"); deviceModel = device.FindPropertyRelative("deviceModel"); deviceModelNewLine = device.FindPropertyRelative("deviceModelNewLine"); }
// ---------------------------------------------------------------------------- // protected methods // ---------------------------------------------------------------------------- protected override void CacheCurrentColor() { colorCached = "<color=#" + AFPSCounter.Color32ToHex(color) + ">"; }
/// <summary> /// For internal usage! /// </summary> internal void Init() { if (!enabled) { return; } if (!HasData()) { return; } inited = true; previousMonoValue = 0; #if ENABLE_PROFILER previousHeapValue = 0; #endif if (colorCached == null) { colorCached = String.Format(TEXT_START, AFPSCounter.Color32ToHex(color)); } if (text == null) { text = new StringBuilder(200); } else { text.Length = 0; } text.Append(colorCached); if (monoUsage) { string lineStart; #if !UNITY_FLASH lineStart = LINE_START_MONO; #else lineStart = LINE_START_FLASH; #endif if (preciseValues) { text.Append(lineStart).AppendFormat("{0:F}", 0).Append(LINE_END); } else { text.Append(lineStart).Append(0).Append(LINE_END); } } if (heapUsage) { #if ENABLE_PROFILER if (text.Length > 0) { text.Append(AFPSCounter.NEW_LINE); } if (preciseValues) { text.Append(LINE_START_HEAP).AppendFormat("{0:F}", 0).Append(LINE_END); } else { text.Append(LINE_START_HEAP).Append(0).Append(LINE_END); } #else Debug.LogWarning("You have enabled Heap Usage in AFPSCounter, but it requires enabled Profiler (it's disabled currently)!"); #endif } text.Append(TEXT_END); AFPSCounter.Instance.StartCoroutine(COROUTINE_NAME); AFPSCounter.Instance.MakeDrawableLabelDirty(anchor); }
protected override void CacheCurrentColor() { colorCached = string.Format(TextStart, AFPSCounter.Color32ToHex(color)); }
// ---------------------------------------------------------------------------- // protected methods // ---------------------------------------------------------------------------- protected override void PerformActivationActions() { base.PerformActivationActions(); if (!HasData()) { return; } LastTotalValue = 0; LastAllocatedValue = 0; LastMonoValue = 0; if (main.OperationMode == OperationMode.Normal) { if (colorCached == null) { colorCached = string.Format(TextStart, AFPSCounter.Color32ToHex(color)); } text.Append(colorCached); if (total) { if (precise) { text.Append(LineStartTotal).Append("0.00").Append(LineEnd); } else { text.Append(LineStartTotal).Append(0).Append(LineEnd); } } if (allocated) { if (text.Length > 0) { text.Append(AFPSCounter.NewLine); } if (precise) { text.Append(LineStartAllocated).Append("0.00").Append(LineEnd); } else { text.Append(LineStartAllocated).Append(0).Append(LineEnd); } } if (monoUsage) { if (text.Length > 0) { text.Append(AFPSCounter.NewLine); } if (precise) { text.Append(LineStartMono).Append("0.00").Append(LineEnd); } else { text.Append(LineStartMono).Append(0).Append(LineEnd); } } #if ENABLE_GFX_MEMORY if (gfx) { if (text.Length > 0) { text.Append(AFPSCounter.NewLine); } if (precise) { text.Append(LineStartGfx).Append("0.00").Append(LineEnd); } else { text.Append(LineStartGfx).Append(0).Append(LineEnd); } } #endif text.Append(TextEnd); ApplyTextStyles(); dirty = true; } }
internal override void Activate() { if (!enabled || inited || !HasData()) { return; } base.Activate(); inited = true; lastTotalValue = 0; lastAllocatedValue = 0; lastMonoValue = 0; if (main.OperationMode == AFPSCounterOperationMode.Normal) { if (colorCached == null) { colorCached = String.Format(TEXT_START, AFPSCounter.Color32ToHex(color)); } if (text == null) { text = new StringBuilder(200); } else { text.Length = 0; } text.Append(colorCached); if (totalReserved) { if (preciseValues) { text.Append(LINE_START_TOTAL).AppendFormat("{0:F}", 0).Append(LINE_END); } else { text.Append(LINE_START_TOTAL).Append(0).Append(LINE_END); } } if (allocated) { if (text.Length > 0) { text.Append(AFPSCounter.NEW_LINE); } if (preciseValues) { text.Append(LINE_START_ALLOCATED).AppendFormat("{0:F}", 0).Append(LINE_END); } else { text.Append(LINE_START_ALLOCATED).Append(0).Append(LINE_END); } } if (monoUsage) { if (text.Length > 0) { text.Append(AFPSCounter.NEW_LINE); } if (preciseValues) { text.Append(LINE_START_MONO).AppendFormat("{0:F}", 0).Append(LINE_END); } else { text.Append(LINE_START_MONO).Append(0).Append(LINE_END); } } text.Append(TEXT_END); dirty = true; } main.StartCoroutine(COROUTINE_NAME); }
protected override void CacheCurrentColor() { colorCached = String.Format(TEXT_START, AFPSCounter.Color32ToHex(color)); }
// ---------------------------------------------------------------------------- // protected methods // ---------------------------------------------------------------------------- protected override void PerformActivationActions() { base.PerformActivationActions(); if (!HasData()) { return; } LastTotalValue = 0; LastAllocatedValue = 0; LastMonoValue = 0; if (main.OperationMode == OperationMode.Normal) { if (colorCached == null) { colorCached = string.Format(TEXT_START, AFPSCounter.Color32ToHex(color)); } text.Append(colorCached); if (total) { if (precise) { text.Append(LINE_START_TOTAL).Append("0.00").Append(LINE_END); } else { text.Append(LINE_START_TOTAL).Append(0).Append(LINE_END); } } if (allocated) { if (text.Length > 0) { text.Append(AFPSCounter.NEW_LINE); } if (precise) { text.Append(LINE_START_ALLOCATED).Append("0.00").Append(LINE_END); } else { text.Append(LINE_START_ALLOCATED).Append(0).Append(LINE_END); } } if (monoUsage) { if (text.Length > 0) { text.Append(AFPSCounter.NEW_LINE); } if (precise) { text.Append(LINE_START_MONO).Append("0.00").Append(LINE_END); } else { text.Append(LINE_START_MONO).Append(0).Append(LINE_END); } } #if ENABLE_GFX_MEMORY if (gfx) { if (text.Length > 0) { text.Append(AFPSCounter.NEW_LINE); } if (precise) { text.Append(LINE_START_GFX).Append("0.00").Append(LINE_END); } else { text.Append(LINE_START_GFX).Append(0).Append(LINE_END); } } #endif text.Append(TEXT_END); ApplyTextStyles(); dirty = true; } }
internal override void Activate() { if (!this.enabled || this.inited || !this.HasData()) { return; } base.Activate(); this.inited = true; this.lastTotalValue = 0u; this.lastAllocatedValue = 0u; this.lastMonoValue = 0L; if (this.main.OperationMode == AFPSCounterOperationMode.Normal) { if (this.colorCached == null) { this.colorCached = string.Format("<color=#{0}><b>", AFPSCounter.Color32ToHex(this.color)); } if (this.text == null) { this.text = new StringBuilder(200); } else { this.text.Length = 0; } this.text.Append(this.colorCached); if (this.totalReserved) { if (this.preciseValues) { this.text.Append("MEM (total): ").AppendFormat("{0:F}", 0).Append(" MB"); } else { this.text.Append("MEM (total): ").Append(0).Append(" MB"); } } if (this.allocated) { if (this.text.Length > 0) { this.text.Append(AFPSCounter.NEW_LINE); } if (this.preciseValues) { this.text.Append("MEM (alloc): ").AppendFormat("{0:F}", 0).Append(" MB"); } else { this.text.Append("MEM (alloc): ").Append(0).Append(" MB"); } } if (this.monoUsage) { if (this.text.Length > 0) { this.text.Append(AFPSCounter.NEW_LINE); } if (this.preciseValues) { this.text.Append("MEM (mono): ").AppendFormat("{0:F}", 0).Append(" MB"); } else { this.text.Append("MEM (mono): ").Append(0).Append(" MB"); } } this.text.Append("</b></color>"); this.dirty = true; } this.main.StartCoroutine("UpdateMemoryCounter"); }