aboutsummaryrefslogtreecommitdiff
path: root/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram')
-rw-r--r--Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamGraph.cs257
-rw-r--r--Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamGraph.cs.meta12
-rw-r--r--Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamManager.cs235
-rw-r--r--Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamManager.cs.meta12
-rw-r--r--Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamMonitor.cs60
-rw-r--r--Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamMonitor.cs.meta12
-rw-r--r--Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamText.cs109
-rw-r--r--Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamText.cs.meta12
8 files changed, 709 insertions, 0 deletions
diff --git a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamGraph.cs b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamGraph.cs
new file mode 100644
index 0000000..7d2f4f8
--- /dev/null
+++ b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamGraph.cs
@@ -0,0 +1,257 @@
+/* ---------------------------------------
+ * Author: Martin Pane (martintayx@gmail.com) (@tayx94)
+ * Collaborators: Lars Aalbertsen (@Rockylars)
+ * Project: Graphy - Ultimate Stats Monitor
+ * Date: 15-Dec-17
+ * Studio: Tayx
+ *
+ * This project is released under the MIT license.
+ * Attribution is not required, but it is always welcomed!
+ * -------------------------------------*/
+
+using Tayx.Graphy.Graph;
+using UnityEngine;
+using UnityEngine.UI;
+
+#if UNITY_5_5_OR_NEWER
+using UnityEngine.Profiling;
+#endif
+
+namespace Tayx.Graphy.Ram
+{
+ public class G_RamGraph : G_Graph
+ {
+ /* ----- TODO: ----------------------------
+ * Add summaries to the variables.
+ * Add summaries to the functions.
+ * Check if we should add a "RequireComponent" for "RamMonitor".
+ * --------------------------------------*/
+
+ #region Variables -> Serialized Private
+
+ [SerializeField] private Image m_imageAllocated = null;
+ [SerializeField] private Image m_imageReserved = null;
+ [SerializeField] private Image m_imageMono = null;
+
+ [SerializeField] private Shader ShaderFull = null;
+ [SerializeField] private Shader ShaderLight = null;
+
+ #endregion
+
+ #region Variables -> Private
+
+ private GraphyManager m_graphyManager = null;
+
+ private G_RamMonitor m_ramMonitor = null;
+
+ private int m_resolution = 150;
+
+ private G_GraphShader m_shaderGraphAllocated = null;
+ private G_GraphShader m_shaderGraphReserved = null;
+ private G_GraphShader m_shaderGraphMono = null;
+
+ private float[] m_allocatedArray;
+ private float[] m_reservedArray;
+ private float[] m_monoArray;
+
+ private float m_highestMemory = 0;
+
+ #endregion
+
+ #region Methods -> Unity Callbacks
+
+ private void OnEnable()
+ {
+ Init();
+ }
+
+ private void Update()
+ {
+ UpdateGraph();
+ }
+
+ #endregion
+
+ #region Methods -> Public
+
+ public void UpdateParameters()
+ {
+ if ( m_shaderGraphAllocated == null
+ || m_shaderGraphReserved == null
+ || m_shaderGraphMono == null)
+ {
+ Init();
+ }
+
+ switch (m_graphyManager.GraphyMode)
+ {
+ case GraphyManager.Mode.FULL:
+ m_shaderGraphAllocated .ArrayMaxSize = G_GraphShader.ArrayMaxSizeFull;
+ m_shaderGraphReserved .ArrayMaxSize = G_GraphShader.ArrayMaxSizeFull;
+ m_shaderGraphMono .ArrayMaxSize = G_GraphShader.ArrayMaxSizeFull;
+
+ m_shaderGraphAllocated .Image.material = new Material(ShaderFull);
+ m_shaderGraphReserved .Image.material = new Material(ShaderFull);
+ m_shaderGraphMono .Image.material = new Material(ShaderFull);
+ break;
+
+ case GraphyManager.Mode.LIGHT:
+ m_shaderGraphAllocated .ArrayMaxSize = G_GraphShader.ArrayMaxSizeLight;
+ m_shaderGraphReserved .ArrayMaxSize = G_GraphShader.ArrayMaxSizeLight;
+ m_shaderGraphMono .ArrayMaxSize = G_GraphShader.ArrayMaxSizeLight;
+
+ m_shaderGraphAllocated .Image.material = new Material(ShaderLight);
+ m_shaderGraphReserved .Image.material = new Material(ShaderLight);
+ m_shaderGraphMono .Image.material = new Material(ShaderLight);
+ break;
+ }
+
+ m_shaderGraphAllocated.InitializeShader();
+ m_shaderGraphReserved.InitializeShader();
+ m_shaderGraphMono.InitializeShader();
+
+ m_resolution = m_graphyManager.RamGraphResolution;
+
+ CreatePoints();
+ }
+
+ #endregion
+
+ #region Methods -> Protected Override
+
+ protected override void UpdateGraph()
+ {
+ float allocatedMemory = m_ramMonitor.AllocatedRam;
+ float reservedMemory = m_ramMonitor.ReservedRam;
+ float monoMemory = m_ramMonitor.MonoRam;
+
+ m_highestMemory = 0;
+
+ for (int i = 0; i <= m_resolution - 1; i++)
+ {
+ if (i >= m_resolution - 1)
+ {
+ m_allocatedArray[i] = allocatedMemory;
+ m_reservedArray[i] = reservedMemory;
+ m_monoArray[i] = monoMemory;
+ }
+ else
+ {
+ m_allocatedArray[i] = m_allocatedArray[i + 1];
+ m_reservedArray[i] = m_reservedArray[i + 1];
+ m_monoArray[i] = m_monoArray[i + 1];
+ }
+
+ if (m_highestMemory < m_reservedArray[i])
+ {
+ m_highestMemory = m_reservedArray[i];
+ }
+ }
+
+ for (int i = 0; i <= m_resolution - 1; i++)
+ {
+ m_shaderGraphAllocated.Array[i] = m_allocatedArray[i] / m_highestMemory;
+
+ m_shaderGraphReserved.Array[i] = m_reservedArray[i] / m_highestMemory;
+
+ m_shaderGraphMono.Array[i] = m_monoArray[i] / m_highestMemory;
+ }
+
+ m_shaderGraphAllocated.UpdatePoints();
+ m_shaderGraphReserved.UpdatePoints();
+ m_shaderGraphMono.UpdatePoints();
+ }
+
+ protected override void CreatePoints()
+ {
+
+ m_shaderGraphAllocated.Array = new float[m_resolution];
+ m_shaderGraphReserved.Array = new float[m_resolution];
+ m_shaderGraphMono.Array = new float[m_resolution];
+
+ m_allocatedArray = new float[m_resolution];
+ m_reservedArray = new float[m_resolution];
+ m_monoArray = new float[m_resolution];
+
+ for (int i = 0; i < m_resolution; i++)
+ {
+ m_shaderGraphAllocated.Array[i] = 0;
+ m_shaderGraphReserved.Array[i] = 0;
+ m_shaderGraphMono.Array[i] = 0;
+ }
+
+ // Initialize the material values
+
+ // Colors
+
+ m_shaderGraphAllocated.GoodColor = m_graphyManager.AllocatedRamColor;
+ m_shaderGraphAllocated.CautionColor = m_graphyManager.AllocatedRamColor;
+ m_shaderGraphAllocated.CriticalColor = m_graphyManager.AllocatedRamColor;
+
+ m_shaderGraphAllocated.UpdateColors();
+
+ m_shaderGraphReserved.GoodColor = m_graphyManager.ReservedRamColor;
+ m_shaderGraphReserved.CautionColor = m_graphyManager.ReservedRamColor;
+ m_shaderGraphReserved.CriticalColor = m_graphyManager.ReservedRamColor;
+
+ m_shaderGraphReserved.UpdateColors();
+
+ m_shaderGraphMono.GoodColor = m_graphyManager.MonoRamColor;
+ m_shaderGraphMono.CautionColor = m_graphyManager.MonoRamColor;
+ m_shaderGraphMono.CriticalColor = m_graphyManager.MonoRamColor;
+
+ m_shaderGraphMono.UpdateColors();
+
+ // Thresholds
+
+ m_shaderGraphAllocated.GoodThreshold = 0;
+ m_shaderGraphAllocated.CautionThreshold = 0;
+ m_shaderGraphAllocated.UpdateThresholds();
+
+ m_shaderGraphReserved.GoodThreshold = 0;
+ m_shaderGraphReserved.CautionThreshold = 0;
+ m_shaderGraphReserved.UpdateThresholds();
+
+ m_shaderGraphMono.GoodThreshold = 0;
+ m_shaderGraphMono.CautionThreshold = 0;
+ m_shaderGraphMono.UpdateThresholds();
+
+ m_shaderGraphAllocated.UpdateArray();
+ m_shaderGraphReserved.UpdateArray();
+ m_shaderGraphMono.UpdateArray();
+
+ // Average
+
+ m_shaderGraphAllocated.Average = 0;
+ m_shaderGraphReserved.Average = 0;
+ m_shaderGraphMono.Average = 0;
+
+ m_shaderGraphAllocated.UpdateAverage();
+ m_shaderGraphReserved.UpdateAverage();
+ m_shaderGraphMono.UpdateAverage();
+ }
+
+ #endregion
+
+ #region Methods -> Private
+
+ private void Init()
+ {
+ m_graphyManager = transform.root.GetComponentInChildren<GraphyManager>();
+
+ m_ramMonitor = GetComponent<G_RamMonitor>();
+
+ m_shaderGraphAllocated = new G_GraphShader();
+ m_shaderGraphReserved = new G_GraphShader();
+ m_shaderGraphMono = new G_GraphShader();
+
+ m_shaderGraphAllocated .Image = m_imageAllocated;
+ m_shaderGraphReserved .Image = m_imageReserved;
+ m_shaderGraphMono .Image = m_imageMono;
+
+ UpdateParameters();
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamGraph.cs.meta b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamGraph.cs.meta
new file mode 100644
index 0000000..a862788
--- /dev/null
+++ b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamGraph.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: a9c49f1e95f2dab428b3a0ed56328a1c
+timeCreated: 1512484813
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamManager.cs b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamManager.cs
new file mode 100644
index 0000000..4f63d2a
--- /dev/null
+++ b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamManager.cs
@@ -0,0 +1,235 @@
+/* ---------------------------------------
+ * Author: Martin Pane (martintayx@gmail.com) (@tayx94)
+ * Collaborators: Lars Aalbertsen (@Rockylars)
+ * Project: Graphy - Ultimate Stats Monitor
+ * Date: 03-Jan-18
+ * Studio: Tayx
+ *
+ * This project is released under the MIT license.
+ * Attribution is not required, but it is always welcomed!
+ * -------------------------------------*/
+
+using UnityEngine;
+using System.Collections.Generic;
+using Tayx.Graphy.UI;
+using Tayx.Graphy.Utils;
+using UnityEngine.UI;
+
+namespace Tayx.Graphy.Ram
+{
+ public class G_RamManager : MonoBehaviour, IMovable, IModifiableState
+ {
+ /* ----- TODO: ----------------------------
+ * Add summaries to the variables.
+ * Add summaries to the functions.
+ * Check if we should add a "RequireComponent" for "RectTransform".
+ * Check if we should add a "RequireComponent" for "RamGraph".
+ * Check why this manager doesnt use RamMonitor, as all the other managers have a monitor script.
+ * Check if we should add a "RequireComponent" for "RamText".
+ * --------------------------------------*/
+
+ #region Variables -> Serialized Private
+
+ [SerializeField] private GameObject m_ramGraphGameObject = null;
+
+ [SerializeField] private List<Image> m_backgroundImages = new List<Image>();
+
+ #endregion
+
+ #region Variables -> Private
+
+ private GraphyManager m_graphyManager = null;
+
+ private G_RamGraph m_ramGraph = null;
+ private G_RamText m_ramText = null;
+
+ private RectTransform m_rectTransform = null;
+
+ private List<GameObject> m_childrenGameObjects = new List<GameObject>();
+
+ private GraphyManager.ModuleState m_previousModuleState = GraphyManager.ModuleState.FULL;
+ private GraphyManager.ModuleState m_currentModuleState = GraphyManager.ModuleState.FULL;
+
+ #endregion
+
+ #region Methods -> Unity Callbacks
+
+ private void Awake()
+ {
+ Init();
+ }
+
+ private void Start()
+ {
+ UpdateParameters();
+ }
+
+ #endregion
+
+ #region Methods -> Public
+
+ public void SetPosition(GraphyManager.ModulePosition newModulePosition)
+ {
+ float xSideOffset = Mathf.Abs(m_rectTransform.anchoredPosition.x);
+ float ySideOffset = Mathf.Abs(m_rectTransform.anchoredPosition.y);
+
+ switch (newModulePosition)
+ {
+ case GraphyManager.ModulePosition.TOP_LEFT:
+
+ m_rectTransform.anchorMax = Vector2.up;
+ m_rectTransform.anchorMin = Vector2.up;
+ m_rectTransform.anchoredPosition = new Vector2(xSideOffset, -ySideOffset);
+
+ break;
+
+ case GraphyManager.ModulePosition.TOP_RIGHT:
+
+ m_rectTransform.anchorMax = Vector2.one;
+ m_rectTransform.anchorMin = Vector2.one;
+ m_rectTransform.anchoredPosition = new Vector2(-xSideOffset, -ySideOffset);
+
+ break;
+
+ case GraphyManager.ModulePosition.BOTTOM_LEFT:
+
+ m_rectTransform.anchorMax = Vector2.zero;
+ m_rectTransform.anchorMin = Vector2.zero;
+ m_rectTransform.anchoredPosition = new Vector2(xSideOffset, ySideOffset);
+
+ break;
+
+ case GraphyManager.ModulePosition.BOTTOM_RIGHT:
+
+ m_rectTransform.anchorMax = Vector2.right;
+ m_rectTransform.anchorMin = Vector2.right;
+ m_rectTransform.anchoredPosition = new Vector2(-xSideOffset, ySideOffset);
+
+ break;
+
+ case GraphyManager.ModulePosition.FREE:
+ break;
+ }
+ }
+
+ public void SetState(GraphyManager.ModuleState state, bool silentUpdate = false)
+ {
+ if (!silentUpdate)
+ {
+ m_previousModuleState = m_currentModuleState;
+ }
+
+ m_currentModuleState = state;
+
+ switch (state)
+ {
+ case GraphyManager.ModuleState.FULL:
+ gameObject.SetActive(true);
+ m_childrenGameObjects.SetAllActive(true);
+ SetGraphActive(true);
+
+ if (m_graphyManager.Background)
+ {
+ m_backgroundImages.SetOneActive(0);
+ }
+ else
+ {
+ m_backgroundImages.SetAllActive(false);
+ }
+
+ break;
+
+ case GraphyManager.ModuleState.TEXT:
+ case GraphyManager.ModuleState.BASIC:
+ gameObject.SetActive(true);
+ m_childrenGameObjects.SetAllActive(true);
+ SetGraphActive(false);
+
+ if (m_graphyManager.Background)
+ {
+ m_backgroundImages.SetOneActive(1);
+ }
+ else
+ {
+ m_backgroundImages.SetAllActive(false);
+ }
+
+ break;
+
+ case GraphyManager.ModuleState.BACKGROUND:
+ gameObject.SetActive(true);
+ SetGraphActive(false);
+
+ m_childrenGameObjects.SetAllActive(false);
+ m_backgroundImages.SetAllActive(false);
+
+ break;
+
+ case GraphyManager.ModuleState.OFF:
+ gameObject.SetActive(false);
+ break;
+ }
+ }
+
+ public void RestorePreviousState()
+ {
+ SetState(m_previousModuleState);
+ }
+
+ public void UpdateParameters()
+ {
+ foreach (var image in m_backgroundImages)
+ {
+ image.color = m_graphyManager.BackgroundColor;
+ }
+
+ m_ramGraph .UpdateParameters();
+ m_ramText .UpdateParameters();
+
+ SetState(m_graphyManager.RamModuleState);
+ }
+
+ public void RefreshParameters()
+ {
+ foreach (var image in m_backgroundImages)
+ {
+ image.color = m_graphyManager.BackgroundColor;
+ }
+
+ m_ramGraph .UpdateParameters();
+ m_ramText .UpdateParameters();
+
+ SetState(m_currentModuleState, true);
+ }
+
+ #endregion
+
+ #region Methods -> Private
+
+ private void Init()
+ {
+ m_graphyManager = transform.root.GetComponentInChildren<GraphyManager>();
+
+ m_ramGraph = GetComponent<G_RamGraph>();
+ m_ramText = GetComponent<G_RamText>();
+
+ m_rectTransform = GetComponent<RectTransform>();
+
+ foreach (Transform child in transform)
+ {
+ if (child.parent == transform)
+ {
+ m_childrenGameObjects.Add(child.gameObject);
+ }
+ }
+ }
+
+ private void SetGraphActive(bool active)
+ {
+ m_ramGraph.enabled = active;
+ m_ramGraphGameObject.SetActive(active);
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamManager.cs.meta b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamManager.cs.meta
new file mode 100644
index 0000000..38ff383
--- /dev/null
+++ b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamManager.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 84f7591c01b7f1a4ab82f1a0038491da
+timeCreated: 1514998367
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamMonitor.cs b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamMonitor.cs
new file mode 100644
index 0000000..a7cfd09
--- /dev/null
+++ b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamMonitor.cs
@@ -0,0 +1,60 @@
+/* ---------------------------------------
+ * Author: Martin Pane (martintayx@gmail.com) (@tayx94)
+ * Collaborators: Lars Aalbertsen (@Rockylars)
+ * Project: Graphy - Ultimate Stats Monitor
+ * Date: 15-Dec-17
+ * Studio: Tayx
+ *
+ * This project is released under the MIT license.
+ * Attribution is not required, but it is always welcomed!
+ * -------------------------------------*/
+
+using UnityEngine;
+
+#if UNITY_5_5_OR_NEWER
+using UnityEngine.Profiling;
+#endif
+
+namespace Tayx.Graphy.Ram
+{
+ public class G_RamMonitor : MonoBehaviour
+ {
+ /* ----- TODO: ----------------------------
+ * Add summaries to the variables.
+ * Add summaries to the functions.
+ * --------------------------------------*/
+
+ #region Variables -> Private
+
+ private float m_allocatedRam = 0;
+ private float m_reservedRam = 0;
+ private float m_monoRam = 0;
+
+ #endregion
+
+ #region Properties -> Public
+
+ public float AllocatedRam { get { return m_allocatedRam; } }
+ public float ReservedRam { get { return m_reservedRam; } }
+ public float MonoRam { get { return m_monoRam; } }
+
+ #endregion
+
+ #region Methods -> Unity Callbacks
+
+ private void Update()
+ {
+#if UNITY_5_6_OR_NEWER
+ m_allocatedRam = Profiler.GetTotalAllocatedMemoryLong()/ 1048576f;
+ m_reservedRam = Profiler.GetTotalReservedMemoryLong() / 1048576f;
+ m_monoRam = Profiler.GetMonoUsedSizeLong() / 1048576f;
+#else
+ m_allocatedRam = Profiler.GetTotalAllocatedMemory() / 1048576f;
+ m_reservedRam = Profiler.GetTotalReservedMemory() / 1048576f;
+ m_monoRam = Profiler.GetMonoUsedSize() / 1048576f;
+#endif
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamMonitor.cs.meta b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamMonitor.cs.meta
new file mode 100644
index 0000000..db2a0f7
--- /dev/null
+++ b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamMonitor.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 2494656f0dd693144be1306d5551e544
+timeCreated: 1513377000
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamText.cs b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamText.cs
new file mode 100644
index 0000000..8db7f31
--- /dev/null
+++ b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamText.cs
@@ -0,0 +1,109 @@
+/* ---------------------------------------
+ * Author: Martin Pane (martintayx@gmail.com) (@tayx94)
+ * Collaborators: Lars Aalbertsen (@Rockylars)
+ * Project: Graphy - Ultimate Stats Monitor
+ * Date: 05-Dec-17
+ * Studio: Tayx
+ *
+ * This project is released under the MIT license.
+ * Attribution is not required, but it is always welcomed!
+ * -------------------------------------*/
+
+using UnityEngine;
+using UnityEngine.UI;
+using Tayx.Graphy.Utils.NumString;
+
+namespace Tayx.Graphy.Ram
+{
+ public class G_RamText : MonoBehaviour
+ {
+ /* ----- TODO: ----------------------------
+ * Add summaries to the variables.
+ * Add summaries to the functions.
+ * Check if we should add a "RequireComponent" for "RamMonitor".
+ * Improve the FloatString Init to come from the core instead.
+ * --------------------------------------*/
+
+ #region Variables -> Serialized Private
+
+ [SerializeField] private Text m_allocatedSystemMemorySizeText = null;
+ [SerializeField] private Text m_reservedSystemMemorySizeText = null;
+ [SerializeField] private Text m_monoSystemMemorySizeText = null;
+
+ #endregion
+
+ #region Variables -> Private
+
+ private GraphyManager m_graphyManager = null;
+
+ private G_RamMonitor m_ramMonitor = null;
+
+ private float m_updateRate = 4f; // 4 updates per sec.
+
+ private float m_deltaTime = 0.0f;
+
+ private readonly string m_memoryStringFormat = "0.0";
+
+ #endregion
+
+ #region Methods -> Unity Callbacks
+
+ private void Awake()
+ {
+ Init();
+ }
+
+ private void Update()
+ {
+ m_deltaTime += Time.unscaledDeltaTime;
+
+ if (m_deltaTime > 1f / m_updateRate)
+ {
+ // Update allocated, mono and reserved memory
+ m_allocatedSystemMemorySizeText .text = m_ramMonitor.AllocatedRam.ToStringNonAlloc(m_memoryStringFormat);
+ m_reservedSystemMemorySizeText .text = m_ramMonitor.ReservedRam.ToStringNonAlloc(m_memoryStringFormat);
+ m_monoSystemMemorySizeText .text = m_ramMonitor.MonoRam.ToStringNonAlloc(m_memoryStringFormat);
+
+ m_deltaTime = 0f;
+ }
+ }
+
+ #endregion
+
+ #region Methods -> Public
+
+ public void UpdateParameters()
+ {
+ m_allocatedSystemMemorySizeText .color = m_graphyManager.AllocatedRamColor;
+ m_reservedSystemMemorySizeText .color = m_graphyManager.ReservedRamColor;
+ m_monoSystemMemorySizeText .color = m_graphyManager.MonoRamColor;
+
+ m_updateRate = m_graphyManager.RamTextUpdateRate;
+ }
+
+ #endregion
+
+ #region Methods -> Private
+
+ private void Init()
+ {
+ //TODO: Replace this with one activated from the core and figure out the min value.
+ if (!G_FloatString.Inited || G_FloatString.MinValue > -1000f || G_FloatString.MaxValue < 16384f)
+ {
+ G_FloatString.Init
+ (
+ minNegativeValue: -1001f,
+ maxPositiveValue: 16386f
+ );
+ }
+
+ m_graphyManager = transform.root.GetComponentInChildren<GraphyManager>();
+
+ m_ramMonitor = GetComponent<G_RamMonitor>();
+
+ UpdateParameters();
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamText.cs.meta b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamText.cs.meta
new file mode 100644
index 0000000..225ac3e
--- /dev/null
+++ b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamText.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 28d32ee74b6e6d24ea89d1b477060318
+timeCreated: 1512484799
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: