summaryrefslogtreecommitdiff
path: root/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2020-08-20 23:40:50 -0400
committerAndrew Lee <alee14498@protonmail.com>2020-08-20 23:40:50 -0400
commit3af4c218c0e70167db23a6303d2af30aff37d2fe (patch)
tree927f29edcf54ab562f40f3d1c6cb69287c7f5980 /Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts
parentb6daed0af784f4e9bc13329dd87c671b06ee1c65 (diff)
downloadProject-Sandbox-3af4c218c0e70167db23a6303d2af30aff37d2fe.tar.gz
Project-Sandbox-3af4c218c0e70167db23a6303d2af30aff37d2fe.tar.bz2
Project-Sandbox-3af4c218c0e70167db23a6303d2af30aff37d2fe.zip
Removed a bunch of stuff; Changes
Diffstat (limited to 'Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts')
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Advanced.meta9
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Advanced/G_AdvancedData.cs376
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Advanced/G_AdvancedData.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio.meta9
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioGraph.cs261
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioGraph.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioManager.cs242
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioManager.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioMonitor.cs216
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioMonitor.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioText.cs103
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioText.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Editor.meta9
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Editor/GraphyDebuggerEditor.cs658
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Editor/GraphyDebuggerEditor.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Editor/GraphyManagerEditor.cs961
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Editor/GraphyManagerEditor.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps.meta9
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsGraph.cs178
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsGraph.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsManager.cs257
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsManager.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsMonitor.cs178
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsMonitor.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsText.cs170
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsText.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Graph.meta9
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Graph/G_Graph.cs37
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Graph/G_Graph.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/GraphyDebugger.cs567
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/GraphyDebugger.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/GraphyManager.cs713
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/GraphyManager.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram.meta9
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamGraph.cs257
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamGraph.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamManager.cs235
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamManager.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamMonitor.cs60
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamMonitor.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamText.cs109
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamText.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Shader.meta9
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Shader/G_GraphShader.cs154
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Shader/G_GraphShader.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/UI.meta9
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/UI/IModifiableState.cs28
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/UI/IModifiableState.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/UI/IMovable.cs30
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/UI/IMovable.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util.meta9
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_ExtensionMethods.cs67
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_ExtensionMethods.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_FloatString.cs232
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_FloatString.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_Intstring.cs131
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_Intstring.cs.meta12
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_Singleton.cs135
-rw-r--r--Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_Singleton.cs.meta12
59 files changed, 6736 insertions, 0 deletions
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Advanced.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Advanced.meta
new file mode 100644
index 0000000..27858e1
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Advanced.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 1ac38d39b5dd9f442a088b7284b58236
+folderAsset: yes
+timeCreated: 1513377123
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Advanced/G_AdvancedData.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Advanced/G_AdvancedData.cs
new file mode 100644
index 0000000..66d4375
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Advanced/G_AdvancedData.cs
@@ -0,0 +1,376 @@
+/* ---------------------------------------
+ * 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 System.Collections.Generic;
+using System.Text;
+using Tayx.Graphy.UI;
+using Tayx.Graphy.Utils;
+using Tayx.Graphy.Utils.NumString;
+
+#if UNITY_5_5_OR_NEWER
+using UnityEngine.Profiling;
+#endif
+
+namespace Tayx.Graphy.Advanced
+{
+ public class G_AdvancedData : MonoBehaviour, IMovable, IModifiableState
+ {
+ /* ----- TODO: ----------------------------
+ * Add summaries to the variables.
+ * Add summaries to the functions.
+ * --------------------------------------*/
+
+ #region Variables -> Serialized Private
+
+ [SerializeField] private List<Image> m_backgroundImages = new List<Image>();
+
+ [SerializeField] private Text m_graphicsDeviceVersionText = null;
+
+ [SerializeField] private Text m_processorTypeText = null;
+
+ [SerializeField] private Text m_operatingSystemText = null;
+
+ [SerializeField] private Text m_systemMemoryText = null;
+
+ [SerializeField] private Text m_graphicsDeviceNameText = null;
+ [SerializeField] private Text m_graphicsMemorySizeText = null;
+ [SerializeField] private Text m_screenResolutionText = null;
+ [SerializeField] private Text m_gameWindowResolutionText = null;
+
+ [Range(1, 60)]
+ [SerializeField] private float m_updateRate = 1f; // 1 update per sec.
+
+ #endregion
+
+ #region Variables -> Private
+
+ private GraphyManager m_graphyManager = null;
+
+ private RectTransform m_rectTransform = null;
+
+ private float m_deltaTime = 0.0f;
+
+ private StringBuilder m_sb = null;
+
+ private GraphyManager.ModuleState m_previousModuleState = GraphyManager.ModuleState.FULL;
+ private GraphyManager.ModuleState m_currentModuleState = GraphyManager.ModuleState.FULL;
+
+ private readonly string[] m_windowStrings =
+ {
+ "Window: ",
+ "x",
+ "@",
+ "Hz",
+ "[",
+ "dpi]"
+ };
+
+ #endregion
+
+ #region Methods -> Unity Callbacks
+
+ private void OnEnable()
+ {
+ Init();
+ }
+
+ private void Update()
+ {
+ m_deltaTime += Time.unscaledDeltaTime;
+
+ if (m_deltaTime > 1f / m_updateRate)
+ {
+ // Update screen window resolution
+ m_sb.Length = 0;
+
+ m_sb.Append(m_windowStrings[0]).Append(Screen.width.ToStringNonAlloc())
+ .Append(m_windowStrings[1]).Append(Screen.height.ToStringNonAlloc())
+ .Append(m_windowStrings[2]).Append(Screen.currentResolution.refreshRate.ToStringNonAlloc())
+ .Append(m_windowStrings[3])
+ .Append(m_windowStrings[4]).Append(Screen.dpi.ToStringNonAlloc())
+ .Append(m_windowStrings[5]);
+
+ m_gameWindowResolutionText.text = m_sb.ToString();
+
+ // Reset variables
+ m_deltaTime = 0f;
+ }
+ }
+
+ #endregion
+
+ #region Methods -> Public
+
+ public void SetPosition(GraphyManager.ModulePosition newModulePosition)
+ {
+ float xSideOffsetBackgroundImage = Mathf.Abs(m_backgroundImages[0].rectTransform.anchoredPosition.x);
+ float ySideOffset = Mathf.Abs(m_rectTransform.anchoredPosition.y);
+
+ switch (newModulePosition)
+ {
+ case GraphyManager.ModulePosition.TOP_LEFT:
+
+ m_rectTransform.anchorMax = Vector2.one;
+ m_rectTransform.anchorMin = Vector2.up;
+ m_rectTransform.anchoredPosition = new Vector2(0, -ySideOffset);
+
+
+ m_backgroundImages[0].rectTransform.anchorMax = Vector2.up;
+ m_backgroundImages[0].rectTransform.anchorMin = Vector2.zero;
+ m_backgroundImages[0].rectTransform.anchoredPosition = new Vector2(xSideOffsetBackgroundImage, 0);
+
+ break;
+
+ case GraphyManager.ModulePosition.TOP_RIGHT:
+
+ m_rectTransform.anchorMax = Vector2.one;
+ m_rectTransform.anchorMin = Vector2.up;
+ m_rectTransform.anchoredPosition = new Vector2(0, -ySideOffset);
+
+ m_backgroundImages[0].rectTransform.anchorMax = Vector2.one;
+ m_backgroundImages[0].rectTransform.anchorMin = Vector2.right;
+ m_backgroundImages[0].rectTransform.anchoredPosition = new Vector2(-xSideOffsetBackgroundImage, 0);
+
+ break;
+
+ case GraphyManager.ModulePosition.BOTTOM_LEFT:
+
+ m_rectTransform.anchorMax = Vector2.right;
+ m_rectTransform.anchorMin = Vector2.zero;
+ m_rectTransform.anchoredPosition = new Vector2(0, ySideOffset);
+
+ m_backgroundImages[0].rectTransform.anchorMax = Vector2.up;
+ m_backgroundImages[0].rectTransform.anchorMin = Vector2.zero;
+ m_backgroundImages[0].rectTransform.anchoredPosition = new Vector2(xSideOffsetBackgroundImage, 0);
+
+ break;
+
+ case GraphyManager.ModulePosition.BOTTOM_RIGHT:
+
+ m_rectTransform.anchorMax = Vector2.right;
+ m_rectTransform.anchorMin = Vector2.zero;
+ m_rectTransform.anchoredPosition = new Vector2(0, ySideOffset);
+
+ m_backgroundImages[0].rectTransform.anchorMax = Vector2.one;
+ m_backgroundImages[0].rectTransform.anchorMin = Vector2.right;
+ m_backgroundImages[0].rectTransform.anchoredPosition = new Vector2(-xSideOffsetBackgroundImage, 0);
+
+ break;
+
+ case GraphyManager.ModulePosition.FREE:
+ break;
+ }
+
+ switch (newModulePosition)
+ {
+ case GraphyManager.ModulePosition.TOP_LEFT:
+ case GraphyManager.ModulePosition.BOTTOM_LEFT:
+
+ m_processorTypeText .alignment = TextAnchor.UpperLeft;
+ m_systemMemoryText .alignment = TextAnchor.UpperLeft;
+ m_graphicsDeviceNameText .alignment = TextAnchor.UpperLeft;
+ m_graphicsDeviceVersionText .alignment = TextAnchor.UpperLeft;
+ m_graphicsMemorySizeText .alignment = TextAnchor.UpperLeft;
+ m_screenResolutionText .alignment = TextAnchor.UpperLeft;
+ m_gameWindowResolutionText .alignment = TextAnchor.UpperLeft;
+ m_operatingSystemText .alignment = TextAnchor.UpperLeft;
+
+ break;
+
+ case GraphyManager.ModulePosition.TOP_RIGHT:
+ case GraphyManager.ModulePosition.BOTTOM_RIGHT:
+
+ m_processorTypeText .alignment = TextAnchor.UpperRight;
+ m_systemMemoryText .alignment = TextAnchor.UpperRight;
+ m_graphicsDeviceNameText .alignment = TextAnchor.UpperRight;
+ m_graphicsDeviceVersionText .alignment = TextAnchor.UpperRight;
+ m_graphicsMemorySizeText .alignment = TextAnchor.UpperRight;
+ m_screenResolutionText .alignment = TextAnchor.UpperRight;
+ m_gameWindowResolutionText .alignment = TextAnchor.UpperRight;
+ m_operatingSystemText .alignment = TextAnchor.UpperRight;
+
+ break;
+
+ case GraphyManager.ModulePosition.FREE:
+ break;
+ }
+ }
+
+ public void SetState(GraphyManager.ModuleState state, bool silentUpdate = false)
+ {
+ if (!silentUpdate)
+ {
+ m_previousModuleState = m_currentModuleState;
+ }
+
+ m_currentModuleState = state;
+
+ bool active = state == GraphyManager.ModuleState.FULL
+ || state == GraphyManager.ModuleState.TEXT
+ || state == GraphyManager.ModuleState.BASIC;
+
+ gameObject.SetActive(active);
+
+ m_backgroundImages.SetAllActive(active && m_graphyManager.Background);
+ }
+
+ /// <summary>
+ /// Restores state to the previous one.
+ /// </summary>
+ public void RestorePreviousState()
+ {
+ SetState(m_previousModuleState);
+ }
+
+ public void UpdateParameters()
+ {
+ foreach (var image in m_backgroundImages)
+ {
+ image.color = m_graphyManager.BackgroundColor;
+ }
+
+ SetPosition(m_graphyManager.AdvancedModulePosition);
+ SetState(m_graphyManager.AdvancedModuleState);
+ }
+
+ public void RefreshParameters()
+ {
+ foreach (var image in m_backgroundImages)
+ {
+ image.color = m_graphyManager.BackgroundColor;
+ }
+
+ SetPosition(m_graphyManager.AdvancedModulePosition);
+ SetState(m_currentModuleState, true);
+ }
+
+ #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_sb = new StringBuilder();
+
+ m_rectTransform = GetComponent<RectTransform>();
+
+ #region Section -> Text
+
+ m_processorTypeText.text
+ = "CPU: "
+ + SystemInfo.processorType
+ + " ["
+ + SystemInfo.processorCount
+ + " cores]";
+
+ m_systemMemoryText.text
+ = "RAM: "
+ + SystemInfo.systemMemorySize
+ + " MB";
+
+ m_graphicsDeviceVersionText.text
+ = "Graphics API: "
+ + SystemInfo.graphicsDeviceVersion;
+
+ m_graphicsDeviceNameText.text
+ = "GPU: "
+ + SystemInfo.graphicsDeviceName;
+
+ m_graphicsMemorySizeText.text
+ = "VRAM: "
+ + SystemInfo.graphicsMemorySize
+ + "MB. Max texture size: "
+ + SystemInfo.maxTextureSize
+ + "px. Shader level: "
+ + SystemInfo.graphicsShaderLevel;
+
+ Resolution res = Screen.currentResolution;
+
+ m_screenResolutionText.text
+ = "Screen: "
+ + res.width
+ + "x"
+ + res.height
+ + "@"
+ + res.refreshRate
+ + "Hz";
+
+ m_operatingSystemText.text
+ = "OS: "
+ + SystemInfo.operatingSystem
+ + " ["
+ + SystemInfo.deviceType
+ + "]";
+
+ float preferredWidth = 0;
+
+ // Resize the background overlay
+
+ List<Text> texts = new List<Text>()
+ {
+ m_graphicsDeviceVersionText,
+ m_processorTypeText,
+ m_systemMemoryText,
+ m_graphicsDeviceNameText,
+ m_graphicsMemorySizeText,
+ m_screenResolutionText,
+ m_gameWindowResolutionText,
+ m_operatingSystemText
+ };
+
+ foreach (var text in texts)
+ {
+ if (text.preferredWidth > preferredWidth)
+ {
+ preferredWidth = text.preferredWidth;
+ }
+ }
+
+ #endregion
+
+ #region Section -> Background Images
+
+ m_backgroundImages[0].rectTransform.SetSizeWithCurrentAnchors
+ (
+ axis: RectTransform.Axis.Horizontal,
+ size: preferredWidth + 10
+ );
+
+ m_backgroundImages[0].rectTransform.anchoredPosition = new Vector2
+ (
+ x: (preferredWidth + 15) / 2 * Mathf.Sign(m_backgroundImages[0].rectTransform.anchoredPosition.x),
+ y: m_backgroundImages[0].rectTransform.anchoredPosition.y
+ );
+
+ #endregion
+
+ UpdateParameters();
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Advanced/G_AdvancedData.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Advanced/G_AdvancedData.cs.meta
new file mode 100644
index 0000000..e6b0b0d
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Advanced/G_AdvancedData.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 5c1019d31db77fd468164577146737ad
+timeCreated: 1512484835
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio.meta
new file mode 100644
index 0000000..0af3857
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 2523395741efc1c48822a27d9fcb57d2
+folderAsset: yes
+timeCreated: 1513377094
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioGraph.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioGraph.cs
new file mode 100644
index 0000000..3e56ff4
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioGraph.cs
@@ -0,0 +1,261 @@
+/* ---------------------------------------
+ * 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;
+
+namespace Tayx.Graphy.Audio
+{
+ public class G_AudioGraph : G_Graph
+ {
+ /* ----- TODO: ----------------------------
+ * Add summaries to the variables.
+ * Add summaries to the functions.
+ * Check if we should add a "RequireComponent" for "AudioMonitor".
+ * --------------------------------------*/
+
+ #region Variables -> Serialized Private
+
+ [SerializeField] private Image m_imageGraph = null;
+ [SerializeField] private Image m_imageGraphHighestValues = null;
+
+ [SerializeField] private Shader ShaderFull = null;
+ [SerializeField] private Shader ShaderLight = null;
+
+ #endregion
+
+ #region Variables -> Private
+
+ private GraphyManager m_graphyManager = null;
+
+ private G_AudioMonitor m_audioMonitor = null;
+
+ private int m_resolution = 40;
+
+ private G_GraphShader m_shaderGraph = null;
+ private G_GraphShader m_shaderGraphHighestValues = null;
+
+ private float[] m_graphArray;
+ private float[] m_graphArrayHighestValue;
+
+ #endregion
+
+ #region Methods -> Unity Callbacks
+
+ private void OnEnable()
+ {
+ Init();
+ }
+
+ private void Update()
+ {
+ if (m_audioMonitor.SpectrumDataAvailable)
+ {
+ UpdateGraph();
+ }
+ }
+
+ #endregion
+
+ #region Methods -> Public
+
+ public void UpdateParameters()
+ {
+ switch (m_graphyManager.GraphyMode)
+ {
+ case GraphyManager.Mode.FULL:
+ m_shaderGraph.ArrayMaxSize = G_GraphShader.ArrayMaxSizeFull;
+ m_shaderGraph.Image.material = new Material(ShaderFull);
+
+ m_shaderGraphHighestValues.ArrayMaxSize = G_GraphShader.ArrayMaxSizeFull;
+ m_shaderGraphHighestValues.Image.material = new Material(ShaderFull);
+ break;
+
+ case GraphyManager.Mode.LIGHT:
+ m_shaderGraph.ArrayMaxSize = G_GraphShader.ArrayMaxSizeLight;
+ m_shaderGraph.Image.material = new Material(ShaderLight);
+
+ m_shaderGraphHighestValues.ArrayMaxSize = G_GraphShader.ArrayMaxSizeLight;
+ m_shaderGraphHighestValues.Image.material = new Material(ShaderLight);
+ break;
+ }
+
+ m_shaderGraph.InitializeShader();
+ m_shaderGraphHighestValues.InitializeShader();
+
+ m_resolution = m_graphyManager.AudioGraphResolution;
+
+ CreatePoints();
+ }
+
+ #endregion
+
+ #region Methods -> Protected Override
+
+ protected override void UpdateGraph()
+ {
+ int incrementPerIteration = Mathf.FloorToInt(m_audioMonitor.Spectrum.Length / (float)m_resolution);
+
+ // Current values -------------------------
+
+ for (int i = 0; i <= m_resolution - 1; i++)
+ {
+ float currentValue = 0;
+
+ for (int j = 0; j < incrementPerIteration; j++)
+ {
+ currentValue += m_audioMonitor.Spectrum[i * incrementPerIteration + j];
+ }
+
+ // Uses 3 values for each bar to accomplish that look
+
+ if ((i + 1) % 3 == 0 && i > 1)
+ {
+ float value =
+ (
+ m_audioMonitor.dBNormalized(m_audioMonitor.lin2dB(currentValue / incrementPerIteration))
+ + m_graphArray[i - 1]
+ + m_graphArray[i - 2]
+ ) / 3;
+
+ m_graphArray[i] = value;
+ m_graphArray[i - 1] = value;
+ m_graphArray[i - 2] = -1; // Always set the third one to -1 to leave gaps in the graph and improve readability
+ }
+ else
+ {
+ m_graphArray[i] = m_audioMonitor.dBNormalized(m_audioMonitor.lin2dB(currentValue / incrementPerIteration));
+ }
+ }
+
+ for (int i = 0; i <= m_resolution - 1; i++)
+ {
+ m_shaderGraph.Array[i] = m_graphArray[i];
+ }
+
+ m_shaderGraph.UpdatePoints();
+
+
+ // Highest values -------------------------
+
+ for (int i = 0; i <= m_resolution - 1; i++)
+ {
+ float currentValue = 0;
+
+ for (int j = 0; j < incrementPerIteration; j++)
+ {
+ currentValue += m_audioMonitor.SpectrumHighestValues[i * incrementPerIteration + j];
+ }
+
+ // Uses 3 values for each bar to accomplish that look
+
+ if ((i + 1) % 3 == 0 && i > 1)
+ {
+ float value =
+ (
+ m_audioMonitor.dBNormalized(m_audioMonitor.lin2dB(currentValue / incrementPerIteration))
+ + m_graphArrayHighestValue[i - 1]
+ + m_graphArrayHighestValue[i - 2]
+ ) / 3;
+
+ m_graphArrayHighestValue[i] = value;
+ m_graphArrayHighestValue[i - 1] = value;
+ m_graphArrayHighestValue[i - 2] = -1; // Always set the third one to -1 to leave gaps in the graph and improve readability
+ }
+ else
+ {
+ m_graphArrayHighestValue[i] = m_audioMonitor.dBNormalized(m_audioMonitor.lin2dB(currentValue / incrementPerIteration));
+ }
+ }
+
+ for (int i = 0; i <= m_resolution - 1; i++)
+ {
+ m_shaderGraphHighestValues.Array[i] = m_graphArrayHighestValue[i];
+ }
+
+ m_shaderGraphHighestValues.UpdatePoints();
+
+ }
+
+ protected override void CreatePoints()
+ {
+ // Init Arrays
+ m_shaderGraph.Array = new float[m_resolution];
+ m_shaderGraphHighestValues.Array = new float[m_resolution];
+
+ m_graphArray = new float[m_resolution];
+ m_graphArrayHighestValue = new float[m_resolution];
+
+ for (int i = 0; i < m_resolution; i++)
+ {
+ m_shaderGraph.Array[i] = 0;
+ m_shaderGraphHighestValues.Array[i] = 0;
+ }
+
+ // Color
+ m_shaderGraph.GoodColor = m_graphyManager.AudioGraphColor;
+ m_shaderGraph.CautionColor = m_graphyManager.AudioGraphColor;
+ m_shaderGraph.CriticalColor = m_graphyManager.AudioGraphColor;
+ m_shaderGraph.UpdateColors();
+
+ m_shaderGraphHighestValues.GoodColor = m_graphyManager.AudioGraphColor;
+ m_shaderGraphHighestValues.CautionColor = m_graphyManager.AudioGraphColor;
+ m_shaderGraphHighestValues.CriticalColor = m_graphyManager.AudioGraphColor;
+ m_shaderGraphHighestValues.UpdateColors();
+
+ // Threshold
+ m_shaderGraph.GoodThreshold = 0;
+ m_shaderGraph.CautionThreshold = 0;
+ m_shaderGraph.UpdateThresholds();
+
+ m_shaderGraphHighestValues.GoodThreshold = 0;
+ m_shaderGraphHighestValues.CautionThreshold = 0;
+ m_shaderGraphHighestValues.UpdateThresholds();
+
+ // Update Array
+ m_shaderGraph.UpdateArray();
+ m_shaderGraphHighestValues.UpdateArray();
+
+ // Average
+ m_shaderGraph.Average = 0;
+ m_shaderGraph.UpdateAverage();
+
+ m_shaderGraphHighestValues.Average = 0;
+ m_shaderGraphHighestValues.UpdateAverage();
+ }
+
+ #endregion
+
+ #region Methods -> Private
+
+ private void Init()
+ {
+ m_graphyManager = transform.root.GetComponentInChildren<GraphyManager>();
+
+ m_audioMonitor = GetComponent<G_AudioMonitor>();
+
+ m_shaderGraph = new G_GraphShader
+ {
+ Image = m_imageGraph
+ };
+
+ m_shaderGraphHighestValues = new G_GraphShader
+ {
+ Image = m_imageGraphHighestValues
+ };
+
+ UpdateParameters();
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioGraph.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioGraph.cs.meta
new file mode 100644
index 0000000..b2124dc
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioGraph.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f2d6ca19dafe21b4b983441274e7f12a
+timeCreated: 1513169449
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioManager.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioManager.cs
new file mode 100644
index 0000000..2cfc4ad
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioManager.cs
@@ -0,0 +1,242 @@
+/* ---------------------------------------
+ * 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 UnityEngine.UI;
+using System.Collections.Generic;
+using Tayx.Graphy.UI;
+using Tayx.Graphy.Utils;
+
+namespace Tayx.Graphy.Audio
+{
+ public class G_AudioManager : 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 "AudioGraph".
+ * Check if we should add a "RequireComponent" for "AudioMonitor".
+ * Check if we should add a "RequireComponent" for "AudioText".
+ * --------------------------------------*/
+
+ #region Variables -> Serialized Private
+
+ [SerializeField] private GameObject m_audioGraphGameObject = null;
+ [SerializeField] private Text m_audioDbText = null;
+
+ [SerializeField] private List<Image> m_backgroundImages = new List<Image>();
+
+ #endregion
+
+ #region Variables -> Private
+
+ private GraphyManager m_graphyManager = null;
+
+ private G_AudioGraph m_audioGraph = null;
+ private G_AudioMonitor m_audioMonitor = null;
+ private G_AudioText m_audioText = 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);
+
+ m_audioDbText.alignment = TextAnchor.UpperRight;
+
+ 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_audioGraph .UpdateParameters();
+ m_audioMonitor .UpdateParameters();
+ m_audioText .UpdateParameters();
+
+ SetState(m_graphyManager.AudioModuleState);
+ }
+
+ public void RefreshParameters()
+ {
+ foreach (var image in m_backgroundImages)
+ {
+ image.color = m_graphyManager.BackgroundColor;
+ }
+
+ m_audioGraph .UpdateParameters();
+ m_audioMonitor .UpdateParameters();
+ m_audioText .UpdateParameters();
+
+ SetState(m_currentModuleState, true);
+ }
+
+ #endregion
+
+ #region Methods -> Private
+
+ private void Init()
+ {
+ m_graphyManager = transform.root.GetComponentInChildren<GraphyManager>();
+
+ m_rectTransform = GetComponent<RectTransform>();
+
+ m_audioGraph = GetComponent<G_AudioGraph>();
+ m_audioMonitor = GetComponent<G_AudioMonitor>();
+ m_audioText = GetComponent<G_AudioText>();
+
+ foreach (Transform child in transform)
+ {
+ if (child.parent == transform)
+ {
+ m_childrenGameObjects.Add(child.gameObject);
+ }
+ }
+ }
+
+ private void SetGraphActive(bool active)
+ {
+ m_audioGraph.enabled = active;
+ m_audioGraphGameObject.SetActive(active);
+ }
+
+ #endregion
+ }
+}
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioManager.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioManager.cs.meta
new file mode 100644
index 0000000..86870f1
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioManager.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 8c0448d8db852b54480670d291c04f1a
+timeCreated: 1514998347
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioMonitor.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioMonitor.cs
new file mode 100644
index 0000000..74ce757
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioMonitor.cs
@@ -0,0 +1,216 @@
+/* ---------------------------------------
+ * 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;
+using UnityEngine.SceneManagement;
+
+namespace Tayx.Graphy.Audio
+{
+ public class G_AudioMonitor : MonoBehaviour
+ {
+ /* ----- TODO: ----------------------------
+ * Add summaries to the variables.
+ * Add summaries to the functions.
+ * Make the "FindAudioListener" not constantly use "Camera.main".
+ * --------------------------------------*/
+
+ #region Variables -> Private
+
+ private const float m_refValue = 1f;
+
+ private GraphyManager m_graphyManager = null;
+
+ private AudioListener m_audioListener = null;
+
+ private GraphyManager.LookForAudioListener m_findAudioListenerInCameraIfNull = GraphyManager.LookForAudioListener.ON_SCENE_LOAD;
+
+ private FFTWindow m_FFTWindow = FFTWindow.Blackman;
+
+ private int m_spectrumSize = 512;
+
+ private float[] m_spectrum;
+ private float[] m_spectrumHighestValues;
+
+ private float m_maxDB;
+
+ #endregion
+
+ #region Properties -> Public
+
+ /// <summary>
+ /// Current audio spectrum from the specified AudioListener.
+ /// </summary>
+ public float[] Spectrum { get { return m_spectrum; } }
+
+ /// <summary>
+ /// Highest audio spectrum from the specified AudioListener in the last few seconds.
+ /// </summary>
+ public float[] SpectrumHighestValues { get { return m_spectrumHighestValues; } }
+
+ /// <summary>
+ /// Maximum DB registered in the current spectrum.
+ /// </summary>
+ public float MaxDB { get { return m_maxDB; } }
+
+ /// <summary>
+ /// Returns true if there is a reference to the audio listener.
+ /// </summary>
+ public bool SpectrumDataAvailable { get { return m_audioListener != null;} }
+
+ #endregion
+
+ #region Methods -> Unity Callbacks
+
+ private void Awake()
+ {
+ Init();
+ }
+
+ private void Update()
+ {
+ if (m_audioListener != null)
+ {
+ // Use this data to calculate the dB value
+
+ AudioListener.GetOutputData(m_spectrum, 0);
+
+ float sum = 0;
+
+ for (int i = 0; i < m_spectrum.Length; i++)
+ {
+ sum += m_spectrum[i] * m_spectrum[i]; // sum squared samples
+ }
+
+ float rmsValue = Mathf.Sqrt(sum / m_spectrum.Length); // rms = square root of average
+
+ m_maxDB = 20 * Mathf.Log10(rmsValue / m_refValue); // calculate dB
+
+ if (m_maxDB < -80) m_maxDB = -80; // clamp it to -80dB min
+
+ // Use this data to draw the spectrum in the graphs
+
+ AudioListener.GetSpectrumData(m_spectrum, 0, m_FFTWindow);
+
+ for (int i = 0; i < m_spectrum.Length; i++)
+ {
+ // Update the highest value if its lower than the current one
+ if (m_spectrum[i] > m_spectrumHighestValues[i])
+ {
+ m_spectrumHighestValues[i] = m_spectrum[i];
+ }
+
+ // Slowly lower the value
+ else
+ {
+ m_spectrumHighestValues[i] = Mathf.Clamp
+ (
+ value: m_spectrumHighestValues[i] - m_spectrumHighestValues[i] * Time.deltaTime * 2,
+ min: 0,
+ max: 1
+ );
+ }
+ }
+ }
+ else if( m_audioListener == null
+ && m_findAudioListenerInCameraIfNull == GraphyManager.LookForAudioListener.ALWAYS)
+ {
+ m_audioListener = FindAudioListener();
+ }
+ }
+
+ private void OnDestroy()
+ {
+ UnityEngine.SceneManagement.SceneManager.sceneLoaded -= OnSceneLoaded;
+ }
+
+ #endregion
+
+ #region Methods -> Public
+
+ public void UpdateParameters()
+ {
+ m_findAudioListenerInCameraIfNull = m_graphyManager.FindAudioListenerInCameraIfNull;
+
+ m_audioListener = m_graphyManager.AudioListener;
+ m_FFTWindow = m_graphyManager.FftWindow;
+ m_spectrumSize = m_graphyManager.SpectrumSize;
+
+ if (m_audioListener == null
+ && m_findAudioListenerInCameraIfNull != GraphyManager.LookForAudioListener.NEVER)
+ {
+ m_audioListener = FindAudioListener();
+ }
+
+ m_spectrum = new float[m_spectrumSize];
+ m_spectrumHighestValues = new float[m_spectrumSize];
+ }
+
+ /// <summary>
+ /// Converts spectrum values to decibels using logarithms.
+ /// </summary>
+ /// <param name="linear"></param>
+ /// <returns></returns>
+ public float lin2dB(float linear)
+ {
+ return Mathf.Clamp(Mathf.Log10(linear) * 20.0f, -160.0f, 0.0f);
+ }
+
+ /// <summary>
+ /// Normalizes a value in decibels between 0-1.
+ /// </summary>
+ /// <param name="db"></param>
+ /// <returns></returns>
+ public float dBNormalized(float db)
+ {
+ return (db + 160f) / 160f;
+ }
+
+ #endregion
+
+ #region Methods -> Private
+
+ /// <summary>
+ /// Tries to find an audio listener in the main camera.
+ /// </summary>
+ private AudioListener FindAudioListener()
+ {
+ Camera mainCamera = Camera.main;
+
+ if (mainCamera != null)
+ {
+ return mainCamera.GetComponent<AudioListener>();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private void OnSceneLoaded(Scene scene, LoadSceneMode loadSceneMode)
+ {
+ if (m_findAudioListenerInCameraIfNull == GraphyManager.LookForAudioListener.ON_SCENE_LOAD)
+ {
+ m_audioListener = FindAudioListener();
+ }
+ }
+
+ private void Init()
+ {
+ m_graphyManager = transform.root.GetComponentInChildren<GraphyManager>();
+
+ UpdateParameters();
+
+ UnityEngine.SceneManagement.SceneManager.sceneLoaded += OnSceneLoaded;
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioMonitor.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioMonitor.cs.meta
new file mode 100644
index 0000000..d3c2dc2
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioMonitor.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 2216f4eff6a7a8a43b38b180fdd2fd9e
+timeCreated: 1513377074
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioText.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioText.cs
new file mode 100644
index 0000000..44394c3
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioText.cs
@@ -0,0 +1,103 @@
+/* ---------------------------------------
+ * 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;
+using UnityEngine.UI;
+using Tayx.Graphy.Utils.NumString;
+
+namespace Tayx.Graphy.Audio
+{
+ public class G_AudioText : MonoBehaviour
+ {
+ /* ----- TODO: ----------------------------
+ * Add summaries to the variables.
+ * Add summaries to the functions.
+ * Check if we should add a "RequireComponent" for "AudioMonitor".
+ * Improve the FloatString Init to come from the core instead.
+ * --------------------------------------*/
+
+ #region Variables -> Serialized Private
+
+ [SerializeField] private Text m_DBText = null;
+
+ #endregion
+
+ #region Variables -> Private
+
+ private GraphyManager m_graphyManager = null;
+
+ private G_AudioMonitor m_audioMonitor = null;
+
+ private int m_updateRate = 4;
+
+ private float m_deltaTimeOffset = 0;
+
+ #endregion
+
+ #region Methods -> Unity Callbacks
+
+ private void Awake()
+ {
+ Init();
+ }
+
+ private void Update()
+ {
+ if (m_audioMonitor.SpectrumDataAvailable)
+ {
+ if (m_deltaTimeOffset > 1f / m_updateRate)
+ {
+ m_deltaTimeOffset = 0f;
+
+ m_DBText.text = Mathf.Clamp(m_audioMonitor.MaxDB, -80f, 0f).ToStringNonAlloc();
+ }
+ else
+ {
+ m_deltaTimeOffset += Time.deltaTime;
+ }
+ }
+ }
+
+ #endregion
+
+ #region Methods -> Public
+
+ public void UpdateParameters()
+ {
+ m_updateRate = m_graphyManager.AudioTextUpdateRate;
+ }
+
+ #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_audioMonitor = GetComponent<G_AudioMonitor>();
+
+ UpdateParameters();
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioText.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioText.cs.meta
new file mode 100644
index 0000000..8b4fcd1
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioText.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 766a588f9a6cb55499c66ea772072e11
+timeCreated: 1513377063
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Editor.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Editor.meta
new file mode 100644
index 0000000..79782ad
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Editor.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: eda2a9e69ce988143894f7442b8cfc30
+folderAsset: yes
+timeCreated: 1513764375
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Editor/GraphyDebuggerEditor.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Editor/GraphyDebuggerEditor.cs
new file mode 100644
index 0000000..23e4426
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Editor/GraphyDebuggerEditor.cs
@@ -0,0 +1,658 @@
+/* ---------------------------------------
+ * Author: Martin Pane (martintayx@gmail.com) (@tayx94)
+ * Collaborators: Lars Aalbertsen (@Rockylars)
+ * Project: Graphy - Ultimate Stats Monitor
+ * Date: 02-Jan-18
+ * Studio: Tayx
+ *
+ * This project is released under the MIT license.
+ * Attribution is not required, but it is always welcomed!
+ * -------------------------------------*/
+
+using System;
+using UnityEngine;
+using System.Collections.Generic;
+using System.IO;
+using UnityEditor;
+
+namespace Tayx.Graphy
+{
+ [CustomEditor(typeof(GraphyDebugger))]
+ internal class GraphyDebuggerEditor : Editor
+ {
+ /* ----- TODO: ----------------------------
+ * Add summaries to the variables.
+ * Add summaries to the functions.
+ * Finish spacing on "OnInspectorGUI".
+ * Add sections to "OnInspectorGUI".
+ * Fix the use of Space to be consistent with "GraphyManagerEditor".
+ * --------------------------------------*/
+
+ #region Variables -> Private
+
+ private GraphyDebugger m_target;
+
+ private int m_newDebugPacketListSize = 0;
+
+ private int m_previouslySelectedDebugPacketIndex = 0;
+ private int m_currentlySelectedDebugPacketIndex = 0;
+
+ private int m_selectedDebugPacketCondition = 0;
+
+ private GUISkin m_skin;
+
+ private GUIStyle m_headerStyle1;
+ private GUIStyle m_headerStyle2;
+
+ private Texture2D m_logoTexture;
+
+ #endregion
+
+ #region Methods -> Unity Callbacks
+
+ private void OnEnable()
+ {
+ m_target = (GraphyDebugger) target;
+ }
+
+ #endregion
+
+ #region Methods -> Public Override
+
+ public override void OnInspectorGUI()
+ {
+ if (m_target == null && target == null)
+ {
+ base.OnInspectorGUI();
+
+ return;
+ }
+
+ LoadGuiStyles();
+
+ float defaultLabelWidth = EditorGUIUtility.labelWidth;
+ float defaultFieldWidth = EditorGUIUtility.fieldWidth;
+
+ //===== CONTENT REGION ========================================================================
+
+ GUILayout.Space(20);
+
+ #region Section -> Logo
+
+ if (m_logoTexture != null)
+ {
+ GUILayout.Label
+ (
+ image: m_logoTexture,
+ style: new GUIStyle(GUI.skin.GetStyle("Label"))
+ {
+ alignment = TextAnchor.UpperCenter
+ }
+ );
+
+ GUILayout.Space(10);
+ }
+ else
+ {
+ EditorGUILayout.LabelField
+ (
+ label: "[ GRAPHY - DEBUGGER ]",
+ style: m_headerStyle1
+ );
+ }
+
+ #endregion
+
+ GUILayout.Space(5); //Extra pixels added when the logo is used.
+
+ #region Section -> Settings
+
+ SerializedObject serObj = serializedObject;
+
+ SerializedProperty debugPacketList = serObj.FindProperty("m_debugPackets"); // Find the List in our script and create a refrence of it
+
+ //Update our list
+ serObj.Update();
+
+ EditorGUILayout.LabelField("Current [Debug Packets] list size: " + debugPacketList.arraySize);
+
+ EditorGUIUtility.fieldWidth = 32;
+ EditorGUILayout.BeginHorizontal();
+
+
+
+ m_newDebugPacketListSize = EditorGUILayout.IntField
+ (
+ label: "Define a new list size",
+ value: m_newDebugPacketListSize
+ );
+
+ if (GUILayout.Button("Resize List"))
+ {
+ if (EditorUtility.DisplayDialog
+ (
+ title:
+ "Resize List",
+
+ message:
+ "Are you sure you want to resize the entire List?\n\n" +
+ "Current List Size -> " +
+ debugPacketList.arraySize +
+ "\n" +
+ "New List Size -> " +
+ m_newDebugPacketListSize +
+ "\n" +
+ "This will add default entries if the value is greater than the list size, or erase the bottom values until the new size specified.",
+
+ ok:
+ "Resize",
+
+ cancel:
+ "Cancel")
+ )
+ {
+ m_currentlySelectedDebugPacketIndex = 0;
+
+ if (m_newDebugPacketListSize != debugPacketList.arraySize)
+ {
+ while (m_newDebugPacketListSize > debugPacketList.arraySize)
+ {
+ debugPacketList.InsertArrayElementAtIndex(debugPacketList.arraySize);
+ SetDefaultDebugPacketValues(debugPacketList);
+ }
+ while (m_newDebugPacketListSize < debugPacketList.arraySize)
+ {
+ debugPacketList.DeleteArrayElementAtIndex(debugPacketList.arraySize - 1);
+ }
+ }
+ }
+ }
+
+ EditorGUILayout.EndHorizontal();
+
+ EditorGUILayout.LabelField("NOT RECOMMENDED (Only use for first initialization)", EditorStyles.centeredGreyMiniLabel);
+
+ EditorGUILayout.Space();
+ EditorGUILayout.Space();
+
+ if (debugPacketList.arraySize < 1)
+ {
+ m_previouslySelectedDebugPacketIndex = 0;
+ m_currentlySelectedDebugPacketIndex = 0;
+ m_selectedDebugPacketCondition = 0;
+
+ serializedObject.ApplyModifiedProperties();
+ return;
+ }
+
+ m_headerStyle2.contentOffset = Vector2.down * 3f;
+
+ EditorGUILayout.LabelField("Selected debug packet:");
+
+ EditorGUILayout.BeginHorizontal();
+
+ List<string> debugPacketNames = new List<string>();
+ for (int i = 0; i < debugPacketList.arraySize; i++)
+ {
+ SerializedProperty listItem = debugPacketList.GetArrayElementAtIndex(i);
+ // NOTE: If the Popup detects two equal strings, it just paints 1, that's why I always add the "i"
+ char checkMark = listItem.FindPropertyRelative("Active").boolValue ? '\u2714' : '\u2718';
+ debugPacketNames.Add
+ (
+ (i + 1) +
+ " (" +
+ checkMark +
+ ") " +
+ " - ID: " +
+ listItem.FindPropertyRelative("Id").intValue +
+ " (Conditions: " +
+ listItem.FindPropertyRelative("DebugConditions").arraySize +
+ ")"
+ );
+ }
+
+ m_currentlySelectedDebugPacketIndex = EditorGUILayout.Popup(m_currentlySelectedDebugPacketIndex, debugPacketNames.ToArray());
+
+ if (m_currentlySelectedDebugPacketIndex != m_previouslySelectedDebugPacketIndex)
+ {
+ m_selectedDebugPacketCondition = 0;
+
+ m_previouslySelectedDebugPacketIndex = m_currentlySelectedDebugPacketIndex;
+ }
+
+ Color defaultGUIColor = GUI.color;
+
+ GUI.color = new Color(0.7f, 1f, 0.0f, 1f);
+
+ //Or add a new item to the List<> with a button
+
+ if (GUILayout.Button("Add", GUILayout.Width(60)))
+ {
+ debugPacketList.InsertArrayElementAtIndex(debugPacketList.arraySize);
+ SetDefaultDebugPacketValues(debugPacketList);
+ }
+
+ GUI.color = new Color(1f, 0.7f, 0.0f, 1f);
+
+ //Remove this index from the List
+
+ if (GUILayout.Button("Remove", GUILayout.Width(60)))
+ {
+ debugPacketList.DeleteArrayElementAtIndex(m_currentlySelectedDebugPacketIndex);
+ if (m_currentlySelectedDebugPacketIndex > 0)
+ {
+ m_currentlySelectedDebugPacketIndex--;
+ }
+
+ if (debugPacketList.arraySize < 1)
+ {
+ serializedObject.ApplyModifiedProperties();
+ return;
+ }
+ }
+
+ GUI.color = defaultGUIColor;
+
+ EditorGUILayout.EndHorizontal();
+
+ EditorGUILayout.Space();
+ EditorGUILayout.Space();
+ EditorGUILayout.Space();
+
+ //Display our list to the inspector window
+
+ SerializedProperty listItemSelected = debugPacketList.GetArrayElementAtIndex(m_currentlySelectedDebugPacketIndex);
+
+ SerializedProperty Active = listItemSelected.FindPropertyRelative("Active");
+ SerializedProperty Id = listItemSelected.FindPropertyRelative("Id");
+ SerializedProperty ExecuteOnce = listItemSelected.FindPropertyRelative("ExecuteOnce");
+ SerializedProperty InitSleepTime = listItemSelected.FindPropertyRelative("InitSleepTime");
+ SerializedProperty ExecuteSleepTime = listItemSelected.FindPropertyRelative("ExecuteSleepTime");
+ SerializedProperty ConditionEvaluation = listItemSelected.FindPropertyRelative("ConditionEvaluation");
+ SerializedProperty DebugConditions = listItemSelected.FindPropertyRelative("DebugConditions");
+ SerializedProperty MessageType = listItemSelected.FindPropertyRelative("MessageType");
+ SerializedProperty Message = listItemSelected.FindPropertyRelative("Message");
+ SerializedProperty TakeScreenshot = listItemSelected.FindPropertyRelative("TakeScreenshot");
+ SerializedProperty ScreenshotFileName = listItemSelected.FindPropertyRelative("ScreenshotFileName");
+ SerializedProperty DebugBreak = listItemSelected.FindPropertyRelative("DebugBreak");
+ SerializedProperty UnityEvents = listItemSelected.FindPropertyRelative("UnityEvents");
+
+ #endregion
+
+ EditorGUILayout.LabelField
+ (
+ label:
+ "[ PACKET ] - ID: " +
+ Id.intValue +
+ " (Conditions: " +
+ DebugConditions.arraySize +
+ ")",
+
+ style: m_headerStyle2
+ );
+
+ EditorGUIUtility.labelWidth = 150;
+ EditorGUIUtility.fieldWidth = 35;
+
+ Active.boolValue = EditorGUILayout.Toggle
+ (
+ new GUIContent
+ (
+ text: "Active",
+ tooltip: "If false, it will not be checked"
+ ),
+ value: Active.boolValue
+ );
+
+ Id.intValue = EditorGUILayout.IntField
+ (
+ new GUIContent
+ (
+ text: "ID",
+ tooltip: "Optional Id. It's used to get or remove DebugPackets in runtime"
+ ),
+ value: Id.intValue
+ );
+
+ ExecuteOnce.boolValue = EditorGUILayout.Toggle
+ (
+ new GUIContent
+ (
+ text: "Execute once",
+ tooltip: "If true, once the actions are executed, this DebugPacket will delete itself"
+ ),
+ value: ExecuteOnce.boolValue
+ );
+
+ InitSleepTime.floatValue = EditorGUILayout.FloatField
+ (
+ new GUIContent
+ (
+ text: "Init sleep time",
+ tooltip: "Time to wait before checking if conditions are met (use this to avoid low fps drops triggering the conditions when loading the game)"
+ ),
+ value: InitSleepTime.floatValue
+ );
+
+ ExecuteSleepTime.floatValue = EditorGUILayout.FloatField
+ (
+ new GUIContent
+ (
+ text: "Sleep time after execute",
+ tooltip: "Time to wait before checking if conditions are met again (once they have already been met and if ExecuteOnce is false)"
+ ),
+ value: ExecuteSleepTime.floatValue
+ );
+
+
+
+ EditorGUIUtility.labelWidth = defaultLabelWidth;
+ EditorGUIUtility.fieldWidth = defaultFieldWidth;
+
+ EditorGUILayout.Space();
+ EditorGUILayout.Space();
+
+ EditorGUILayout.LabelField("[ CONDITIONS ] (" + DebugConditions.arraySize + ")", m_headerStyle2);
+
+ EditorGUILayout.PropertyField
+ (
+ ConditionEvaluation,
+ new GUIContent("Condition evaluation")
+ );
+
+ EditorGUILayout.Space();
+
+ if (DebugConditions.arraySize < 1)
+ {
+ DebugConditions.InsertArrayElementAtIndex(DebugConditions.arraySize);
+ m_selectedDebugPacketCondition = 0;
+ }
+
+ EditorGUILayout.BeginHorizontal();
+
+ List<string> debugPacketConditionNames = new List<string>();
+ for (int i = 0; i < DebugConditions.arraySize; i++)
+ {
+ SerializedProperty listItem = DebugConditions.GetArrayElementAtIndex(i);
+ // NOTE: If the Popup detects two equal strings, it just paints 1, that's why I always add the "i"
+
+ string conditionName = (i + 1).ToString() + " - ";
+ conditionName += GetComparerStringFromDebugVariable((GraphyDebugger.DebugVariable)listItem.FindPropertyRelative("Variable").intValue) + " ";
+ conditionName += GetComparerStringFromDebugComparer((GraphyDebugger.DebugComparer)listItem.FindPropertyRelative("Comparer").intValue) + " ";
+ conditionName += listItem.FindPropertyRelative("Value").floatValue.ToString();
+
+ debugPacketConditionNames.Add(conditionName);
+ }
+
+ m_selectedDebugPacketCondition = EditorGUILayout.Popup(m_selectedDebugPacketCondition, debugPacketConditionNames.ToArray());
+
+ GUI.color = new Color(0.7f, 1f, 0.0f, 1f);
+
+ if (GUILayout.Button("Add", GUILayout.Width(60)))
+ {
+ DebugConditions.InsertArrayElementAtIndex(DebugConditions.arraySize);
+ }
+
+ if (DebugConditions.arraySize > 1)
+ {
+ GUI.color = new Color(1f, 0.7f, 0.0f, 1f);
+ }
+ else
+ {
+ GUI.color = new Color(1f, 0.7f, 0.0f, 0.5f);
+ }
+
+ //Remove this index from the List
+ if (GUILayout.Button("Remove", GUILayout.Width(60)))
+ {
+ if (DebugConditions.arraySize > 1)
+ {
+ DebugConditions.DeleteArrayElementAtIndex(m_selectedDebugPacketCondition);
+ if (m_selectedDebugPacketCondition > 0)
+ {
+ m_selectedDebugPacketCondition--;
+ }
+ }
+ }
+
+ GUI.color = defaultGUIColor;
+
+ EditorGUILayout.EndHorizontal();
+
+ SerializedProperty conditionListItemSelected = DebugConditions.GetArrayElementAtIndex(m_selectedDebugPacketCondition);
+
+ SerializedProperty Variable = conditionListItemSelected.FindPropertyRelative("Variable");
+ SerializedProperty Comparer = conditionListItemSelected.FindPropertyRelative("Comparer");
+ SerializedProperty Value = conditionListItemSelected.FindPropertyRelative("Value");
+
+ EditorGUILayout.PropertyField
+ (
+ Variable,
+ new GUIContent("Variable")
+ );
+
+ EditorGUILayout.PropertyField
+ (
+ Comparer,
+ new GUIContent("Comparer")
+ );
+
+ EditorGUILayout.PropertyField
+ (
+ Value,
+ new GUIContent("Value")
+ );
+
+ EditorGUILayout.Space();
+ EditorGUILayout.Space();
+
+ EditorGUILayout.LabelField("[ ACTIONS ]", m_headerStyle2);
+
+ EditorGUIUtility.labelWidth = 140;
+ EditorGUIUtility.fieldWidth = 35;
+
+ EditorGUILayout.PropertyField
+ (
+ MessageType,
+ new GUIContent("Message type")
+ );
+
+ EditorGUILayout.PropertyField(Message);
+
+ TakeScreenshot.boolValue = EditorGUILayout.Toggle
+ (
+ new GUIContent
+ (
+ text: "Take screenshot",
+ tooltip: "If true, it takes a screenshot and stores it. The location where the image is written to can include a directory/folder list. With no directory/folder list the image will be written into the Project folder. On mobile platforms the filename is appended to the persistent data path."
+ ),
+ value: TakeScreenshot.boolValue
+ );
+
+ if (TakeScreenshot.boolValue)
+ {
+ EditorGUILayout.PropertyField
+ (
+ ScreenshotFileName,
+ new GUIContent
+ (
+ text: "Screenshot file name",
+ tooltip: "Avoid this characters: * . \" / \\ [ ] : ; | = , \n\nIt will have the date appended at the end to avoid overwriting."
+ )
+ );
+ }
+
+ DebugBreak.boolValue = EditorGUILayout.Toggle
+ (
+ new GUIContent
+ (
+ text: "Debug Break",
+ tooltip: "If true, it pauses the editor"
+ ),
+ DebugBreak.boolValue
+ );
+
+ EditorGUILayout.PropertyField(UnityEvents);
+
+ EditorGUIUtility.labelWidth = defaultLabelWidth;
+ EditorGUIUtility.fieldWidth = defaultFieldWidth;
+
+ serializedObject.ApplyModifiedProperties();
+
+ }
+
+ #endregion
+
+ #region Methods -> Private
+
+ private void LoadGuiStyles()
+ {
+ string path = GetMonoScriptFilePath(this);
+
+ path = path.Split(new string[] { "Assets" }, StringSplitOptions.None)[1]
+ .Split(new string[] { "Tayx" }, StringSplitOptions.None)[0];
+
+ m_logoTexture = AssetDatabase.LoadAssetAtPath<Texture2D>
+ (
+ "Assets" +
+ path +
+ "Tayx/Graphy - Ultimate Stats Monitor/Textures/Debugger_Logo_" +
+ (EditorGUIUtility.isProSkin ? "White.png" : "Dark.png")
+ );
+
+ m_skin = AssetDatabase.LoadAssetAtPath<GUISkin>
+ (
+ "Assets" +
+ path +
+ "Tayx/Graphy - Ultimate Stats Monitor/GUI/Graphy.guiskin"
+ );
+
+ if (m_skin != null)
+ {
+ m_headerStyle1 = m_skin.GetStyle("Header1");
+ m_headerStyle2 = m_skin.GetStyle("Header2");
+
+ SetGuiStyleFontColor
+ (
+ guiStyle: m_headerStyle2,
+ color: EditorGUIUtility.isProSkin ? Color.white : Color.black
+ );
+ }
+ else
+ {
+ m_headerStyle1 = EditorStyles.boldLabel;
+ m_headerStyle2 = EditorStyles.boldLabel;
+ }
+ }
+
+ private void SetGuiStyleFontColor(GUIStyle guiStyle, Color color)
+ {
+ guiStyle.normal .textColor = color;
+ guiStyle.hover .textColor = color;
+ guiStyle.active .textColor = color;
+ guiStyle.focused .textColor = color;
+ guiStyle.onNormal .textColor = color;
+ guiStyle.onHover .textColor = color;
+ guiStyle.onActive .textColor = color;
+ guiStyle.onFocused .textColor = color;
+ }
+
+ private string GetMonoScriptFilePath(ScriptableObject scriptableObject)
+ {
+ MonoScript ms = MonoScript.FromScriptableObject(scriptableObject);
+
+ string filePath = AssetDatabase.GetAssetPath(ms);
+
+ FileInfo fi = new FileInfo(filePath);
+
+ if (fi.Directory != null)
+ {
+ filePath = fi.Directory.ToString();
+
+ return filePath.Replace
+ (
+ oldChar: '\\',
+ newChar: '/'
+ );
+ }
+ return null;
+
+ }
+
+ private void SetDefaultDebugPacketValues(SerializedProperty debugPacketSerializedProperty)
+ {
+ GraphyDebugger.DebugPacket debugPacket = new GraphyDebugger.DebugPacket();
+
+ debugPacketSerializedProperty.GetArrayElementAtIndex(debugPacketSerializedProperty.arraySize - 1)
+ .FindPropertyRelative("Active")
+ .boolValue = debugPacket.Active;
+
+ debugPacketSerializedProperty.GetArrayElementAtIndex(debugPacketSerializedProperty.arraySize - 1)
+ .FindPropertyRelative("Id")
+ .intValue = debugPacketSerializedProperty.arraySize;
+
+ debugPacketSerializedProperty.GetArrayElementAtIndex(debugPacketSerializedProperty.arraySize - 1)
+ .FindPropertyRelative("ExecuteOnce")
+ .boolValue = debugPacket.ExecuteOnce;
+
+ debugPacketSerializedProperty.GetArrayElementAtIndex(debugPacketSerializedProperty.arraySize - 1)
+ .FindPropertyRelative("InitSleepTime")
+ .floatValue = debugPacket.InitSleepTime;
+
+ debugPacketSerializedProperty.GetArrayElementAtIndex(debugPacketSerializedProperty.arraySize - 1)
+ .FindPropertyRelative("ExecuteSleepTime")
+ .floatValue = debugPacket.ExecuteSleepTime;
+ }
+
+ private string GetComparerStringFromDebugVariable(GraphyDebugger.DebugVariable debugVariable)
+ {
+ switch (debugVariable)
+ {
+ case GraphyDebugger.DebugVariable.Fps:
+ return "FPS Current";
+ case GraphyDebugger.DebugVariable.Fps_Min:
+ return "FPS Min";
+ case GraphyDebugger.DebugVariable.Fps_Max:
+ return "FPS Max";
+ case GraphyDebugger.DebugVariable.Fps_Avg:
+ return "FPS Avg";
+
+ case GraphyDebugger.DebugVariable.Ram_Allocated:
+ return "Ram Allocated";
+ case GraphyDebugger.DebugVariable.Ram_Reserved:
+ return "Ram Reserved";
+ case GraphyDebugger.DebugVariable.Ram_Mono:
+ return "Ram Mono";
+
+ case GraphyDebugger.DebugVariable.Audio_DB:
+ return "Audio DB";
+
+ default:
+ return null;
+
+ }
+ }
+
+ private string GetComparerStringFromDebugComparer(GraphyDebugger.DebugComparer debugComparer)
+ {
+ switch (debugComparer)
+ {
+ case GraphyDebugger.DebugComparer.Less_than:
+ return "<";
+ case GraphyDebugger.DebugComparer.Equals_or_less_than:
+ return "<=";
+ case GraphyDebugger.DebugComparer.Equals:
+ return "==";
+ case GraphyDebugger.DebugComparer.Equals_or_greater_than:
+ return ">=";
+ case GraphyDebugger.DebugComparer.Greater_than:
+ return ">";
+
+ default:
+ return null;
+ }
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Editor/GraphyDebuggerEditor.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Editor/GraphyDebuggerEditor.cs.meta
new file mode 100644
index 0000000..576169a
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Editor/GraphyDebuggerEditor.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 4a96825e094d61441b5247d0c32652b3
+timeCreated: 1514907656
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Editor/GraphyManagerEditor.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Editor/GraphyManagerEditor.cs
new file mode 100644
index 0000000..c609189
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Editor/GraphyManagerEditor.cs
@@ -0,0 +1,961 @@
+/* ---------------------------------------
+ * Author: Martin Pane (martintayx@gmail.com) (@tayx94)
+ * Collaborators: Lars Aalbertsen (@Rockylars)
+ * Project: Graphy - Ultimate Stats Monitor
+ * Date: 20-Dec-17
+ * Studio: Tayx
+ *
+ * This project is released under the MIT license.
+ * Attribution is not required, but it is always welcomed!
+ * -------------------------------------*/
+
+using System;
+using UnityEngine;
+using System.IO;
+using UnityEditor;
+
+namespace Tayx.Graphy
+{
+ [CustomEditor(typeof(GraphyManager))]
+ internal class GraphyManagerEditor : Editor
+ {
+ /* ----- TODO: ----------------------------
+ * Add summaries to the variables.
+ * Add summaries to the functions.
+ * --------------------------------------*/
+
+ #region Variables -> Private
+
+ private GraphyManager m_target;
+
+ private GUISkin m_skin;
+
+ private GUIStyle m_headerStyle1;
+ private GUIStyle m_headerStyle2;
+
+ private Texture2D m_logoTexture;
+
+ private int[] m_spectrumSizeValues =
+ {
+ 128,
+ 256,
+ 512,
+ 1024,
+ 2048,
+ 4096,
+ 8192
+ };
+
+ #region Section -> Settings
+
+ private SerializedProperty m_graphyMode;
+
+ private SerializedProperty m_enableOnStartup;
+
+ private SerializedProperty m_keepAlive;
+
+ private SerializedProperty m_background;
+ private SerializedProperty m_backgroundColor;
+
+ private SerializedProperty m_enableHotkeys;
+
+ private SerializedProperty m_toggleModeKeyCode;
+ private SerializedProperty m_toggleModeCtrl;
+ private SerializedProperty m_toggleModeAlt;
+
+ private SerializedProperty m_toggleActiveKeyCode;
+ private SerializedProperty m_toggleActiveCtrl;
+ private SerializedProperty m_toggleActiveAlt;
+
+
+ private SerializedProperty m_graphModulePosition;
+
+ #endregion
+
+ #region Section -> FPS
+
+ private bool m_fpsModuleInspectorToggle = true;
+
+ private SerializedProperty m_fpsModuleState;
+
+ private SerializedProperty m_timeToResetMinMaxFps;
+
+ private SerializedProperty m_goodFpsColor;
+ private SerializedProperty m_goodFpsThreshold;
+
+ private SerializedProperty m_cautionFpsColor;
+ private SerializedProperty m_cautionFpsThreshold;
+
+ private SerializedProperty m_criticalFpsColor;
+
+ private SerializedProperty m_fpsGraphResolution;
+
+ private SerializedProperty m_fpsTextUpdateRate;
+
+ #endregion
+
+ #region Section -> RAM
+
+ private bool m_ramModuleInspectorToggle = true;
+
+ private SerializedProperty m_ramModuleState;
+
+ private SerializedProperty m_allocatedRamColor;
+ private SerializedProperty m_reservedRamColor;
+ private SerializedProperty m_monoRamColor;
+
+ private SerializedProperty m_ramGraphResolution;
+
+ private SerializedProperty m_ramTextUpdateRate;
+
+ #endregion
+
+ #region Section -> Audio
+
+ private bool m_audioModuleInspectorToggle = true;
+
+ private SerializedProperty m_findAudioListenerInCameraIfNull;
+
+ private SerializedProperty m_audioListener;
+
+ private SerializedProperty m_audioModuleState;
+
+ private SerializedProperty m_audioGraphColor;
+
+ private SerializedProperty m_audioGraphResolution;
+
+ private SerializedProperty m_audioTextUpdateRate;
+
+ private SerializedProperty m_FFTWindow;
+
+ private SerializedProperty m_spectrumSize;
+
+ #endregion
+
+ #region Section -> Advanced Settings
+
+ private bool m_advancedModuleInspectorToggle = true;
+
+ private SerializedProperty m_advancedModulePosition;
+
+ private SerializedProperty m_advancedModuleState;
+
+ #endregion
+
+ #endregion
+
+ #region Methods -> Unity Callbacks
+
+ private void OnEnable()
+ {
+ m_target = (GraphyManager)target;
+
+ SerializedObject serObj = serializedObject;
+
+ #region Section -> Settings
+
+ m_graphyMode = serObj.FindProperty("m_graphyMode");
+
+ m_enableOnStartup = serObj.FindProperty("m_enableOnStartup");
+
+ m_keepAlive = serObj.FindProperty("m_keepAlive");
+
+ m_background = serObj.FindProperty("m_background");
+ m_backgroundColor = serObj.FindProperty("m_backgroundColor");
+
+ m_enableHotkeys = serObj.FindProperty("m_enableHotkeys");
+
+ m_toggleModeKeyCode = serObj.FindProperty("m_toggleModeKeyCode");
+
+ m_toggleModeCtrl = serObj.FindProperty("m_toggleModeCtrl");
+ m_toggleModeAlt = serObj.FindProperty("m_toggleModeAlt");
+
+ m_toggleActiveKeyCode = serObj.FindProperty("m_toggleActiveKeyCode");
+
+ m_toggleActiveCtrl = serObj.FindProperty("m_toggleActiveCtrl");
+ m_toggleActiveAlt = serObj.FindProperty("m_toggleActiveAlt");
+
+ m_graphModulePosition = serObj.FindProperty("m_graphModulePosition");
+
+ #endregion
+
+ #region Section -> FPS
+
+ m_fpsModuleState = serObj.FindProperty("m_fpsModuleState");
+
+ m_timeToResetMinMaxFps = serObj.FindProperty("m_timeToResetMinMaxFps");
+
+ m_goodFpsColor = serObj.FindProperty("m_goodFpsColor");
+ m_goodFpsThreshold = serObj.FindProperty("m_goodFpsThreshold");
+
+ m_cautionFpsColor = serObj.FindProperty("m_cautionFpsColor");
+ m_cautionFpsThreshold = serObj.FindProperty("m_cautionFpsThreshold");
+
+ m_criticalFpsColor = serObj.FindProperty("m_criticalFpsColor");
+
+ m_fpsGraphResolution = serObj.FindProperty("m_fpsGraphResolution");
+
+ m_fpsTextUpdateRate = serObj.FindProperty("m_fpsTextUpdateRate");
+
+ #endregion
+
+ #region Section -> RAM
+
+ m_ramModuleState = serObj.FindProperty("m_ramModuleState");
+
+ m_allocatedRamColor = serObj.FindProperty("m_allocatedRamColor");
+ m_reservedRamColor = serObj.FindProperty("m_reservedRamColor");
+ m_monoRamColor = serObj.FindProperty("m_monoRamColor");
+
+ m_ramGraphResolution = serObj.FindProperty("m_ramGraphResolution");
+
+ m_ramTextUpdateRate = serObj.FindProperty("m_ramTextUpdateRate");
+
+ #endregion
+
+ #region Section -> Audio
+
+ m_findAudioListenerInCameraIfNull = serObj.FindProperty("m_findAudioListenerInCameraIfNull");
+
+ m_audioListener = serObj.FindProperty("m_audioListener");
+
+ m_audioModuleState = serObj.FindProperty("m_audioModuleState");
+
+ m_audioGraphColor = serObj.FindProperty("m_audioGraphColor");
+
+ m_audioGraphResolution = serObj.FindProperty("m_audioGraphResolution");
+
+ m_audioTextUpdateRate = serObj.FindProperty("m_audioTextUpdateRate");
+
+ m_FFTWindow = serObj.FindProperty("m_FFTWindow");
+
+ m_spectrumSize = serObj.FindProperty("m_spectrumSize");
+
+ #endregion
+
+ #region Section -> Advanced Settings
+
+ m_advancedModulePosition = serObj.FindProperty("m_advancedModulePosition");
+
+ m_advancedModuleState = serObj.FindProperty("m_advancedModuleState");
+
+ #endregion
+
+ }
+
+ #endregion
+
+ #region Methods -> Public Override
+
+ public override void OnInspectorGUI()
+ {
+ if (m_target == null && target == null)
+ {
+ base.OnInspectorGUI();
+ return;
+ }
+
+ LoadGuiStyles();
+
+ float defaultLabelWidth = EditorGUIUtility.labelWidth;
+ float defaultFieldWidth = EditorGUIUtility.fieldWidth;
+
+ GUIStyle foldoutStyle = new GUIStyle(EditorStyles.foldout)
+ {
+ font = m_headerStyle2.font,
+ fontStyle = m_headerStyle2.fontStyle,
+ contentOffset = Vector2.down * 3f //TODO: Maybe replace this with "new Vector2(0f, -3f);"
+ };
+
+ SetGuiStyleFontColor
+ (
+ guiStyle: foldoutStyle,
+ color: EditorGUIUtility.isProSkin ? Color.white : Color.black
+ );
+
+ //===== CONTENT REGION ========================================================================
+
+ GUILayout.Space(20);
+
+ #region Section -> Logo
+
+ if (m_logoTexture != null)
+ {
+ GUILayout.Label
+ (
+ image: m_logoTexture,
+ style: new GUIStyle(GUI.skin.GetStyle("Label"))
+ {
+ alignment = TextAnchor.UpperCenter
+ }
+ );
+
+ GUILayout.Space(10);
+ }
+ else
+ {
+ EditorGUILayout.LabelField
+ (
+ label: "[ GRAPHY - MANAGER ]",
+ style: m_headerStyle1
+ );
+ }
+
+ #endregion
+
+ GUILayout.Space(5); //Extra pixels added when the logo is used.
+
+ #region Section -> Settings
+
+ EditorGUIUtility.labelWidth = 130;
+ EditorGUIUtility.fieldWidth = 35;
+
+ EditorGUILayout.PropertyField
+ (
+ m_graphyMode,
+ new GUIContent
+ (
+ text: "Graphy Mode",
+ tooltip: "LIGHT mode increases compatibility with mobile and older, less powerful GPUs, but reduces the maximum graph resolutions to 128."
+ )
+ );
+
+ GUILayout.Space(10);
+
+ m_enableOnStartup.boolValue = EditorGUILayout.Toggle
+ (
+ new GUIContent
+ (
+ text: "Enable On Startup",
+ tooltip: "If ticked, Graphy will be displayed by default on startup, otherwise it will initiate and hide."
+ ),
+ value: m_enableOnStartup.boolValue
+ );
+
+ // This is a neat trick to hide Graphy in the Scene if it's going to be deactivated in play mode so that it doesn't use screen space.
+ if (!Application.isPlaying)
+ {
+ m_target.GetComponent<Canvas>().enabled = m_enableOnStartup.boolValue;
+ }
+
+ m_keepAlive.boolValue = EditorGUILayout.Toggle
+ (
+ new GUIContent
+ (
+ text: "Keep Alive",
+ tooltip: "If ticked, it will survive scene changes.\n\nCAREFUL, if you set Graphy as a child of another GameObject, the root GameObject will also survive scene changes. If you want to avoid that put Graphy in the root of the Scene as its own entity."
+ ),
+ value: m_keepAlive.boolValue
+ );
+
+ GUILayout.Space(10);
+
+ EditorGUILayout.BeginHorizontal();
+
+ m_background.boolValue = EditorGUILayout.Toggle
+ (
+ new GUIContent
+ (
+ text: "Background",
+ tooltip: "If ticked, it will show a background overlay to improve readability in cluttered scenes."
+ ),
+ value: m_background.boolValue
+ );
+
+ m_backgroundColor.colorValue = EditorGUILayout.ColorField(m_backgroundColor.colorValue);
+
+ EditorGUILayout.EndHorizontal();
+
+ GUILayout.Space(10);
+
+ m_enableHotkeys.boolValue = EditorGUILayout.Toggle
+ (
+ new GUIContent
+ (
+ text: "Enable Hotkeys",
+ tooltip: "If ticked, it will enable the hotkeys to be able to modify Graphy in runtime with custom keyboard shortcuts."
+ ),
+ value: m_enableHotkeys.boolValue
+ );
+
+ if (m_enableHotkeys.boolValue)
+ {
+ EditorGUILayout.BeginHorizontal();
+
+ EditorGUIUtility.labelWidth = 130;
+ EditorGUIUtility.fieldWidth = 35;
+
+ EditorGUILayout.PropertyField
+ (
+ m_toggleModeKeyCode,
+ new GUIContent
+ (
+ text: "Toggle Mode Key",
+ tooltip: "If ticked, it will require clicking this key and the other ones you have set up."
+ )
+ );
+
+ EditorGUIUtility.labelWidth = 30;
+ EditorGUIUtility.fieldWidth = 35;
+
+ m_toggleModeCtrl.boolValue = EditorGUILayout.Toggle
+ (
+ new GUIContent
+ (
+ text: "Ctrl",
+ tooltip: "If ticked, it will require clicking Ctrl and the other keys you have set up."
+ ),
+ value: m_toggleModeCtrl.boolValue
+ );
+
+ m_toggleModeAlt.boolValue = EditorGUILayout.Toggle
+ (
+ new GUIContent
+ (
+ text: "Alt",
+ tooltip: "If ticked, it will require clicking Alt and the other keys you have set up."
+ ),
+ value: m_toggleModeAlt.boolValue
+ );
+
+ EditorGUILayout.EndHorizontal();
+
+ EditorGUILayout.BeginHorizontal();
+
+ EditorGUIUtility.labelWidth = 130;
+ EditorGUIUtility.fieldWidth = 35;
+
+ EditorGUILayout.PropertyField
+ (
+ m_toggleActiveKeyCode,
+ new GUIContent
+ (
+ text: "Toggle Active Key",
+ tooltip: "If ticked, it will require clicking this key and the other ones you have set up."
+ )
+ );
+
+ EditorGUIUtility.labelWidth = 30;
+ EditorGUIUtility.fieldWidth = 35;
+
+ m_toggleActiveCtrl.boolValue = EditorGUILayout.Toggle
+ (
+ new GUIContent
+ (
+ text: "Ctrl",
+ tooltip: "If ticked, it will require clicking Ctrl and the other kesy you have set up."
+ ),
+ value: m_toggleActiveCtrl.boolValue
+ );
+
+ m_toggleActiveAlt.boolValue = EditorGUILayout.Toggle
+ (
+ new GUIContent
+ (
+ text: "Alt",
+ tooltip: "If ticked, it will require clicking Alt and the other keys you have set up."
+ ),
+ value: m_toggleActiveAlt.boolValue
+ );
+
+ EditorGUILayout.EndHorizontal();
+ }
+
+ GUILayout.Space(15);
+
+ EditorGUIUtility.labelWidth = 155;
+ EditorGUIUtility.fieldWidth = 35;
+
+ EditorGUILayout.PropertyField
+ (
+ m_graphModulePosition,
+ new GUIContent
+ (
+ text: "Graph modules position",
+ tooltip: "Defines in which corner the modules will be located."
+ )
+ );
+
+ #endregion
+
+ GUILayout.Space(20);
+
+ #region Section -> FPS
+
+ m_fpsModuleInspectorToggle = EditorGUILayout.Foldout
+ (
+ m_fpsModuleInspectorToggle,
+ content: " [ FPS ]",
+ style: foldoutStyle
+ );
+
+ GUILayout.Space(5);
+
+ if (m_fpsModuleInspectorToggle)
+ {
+ EditorGUILayout.PropertyField
+ (
+ m_fpsModuleState,
+ new GUIContent
+ (
+ text: "Module state",
+ tooltip: "FULL -> Text + Graph \nTEXT -> Just text \nOFF -> Turned off"
+ )
+ );
+
+ GUILayout.Space(5);
+
+ EditorGUILayout.LabelField("Fps thresholds and colors:");
+
+ EditorGUI.indentLevel++;
+
+ EditorGUILayout.BeginHorizontal();
+
+ m_goodFpsThreshold.intValue = EditorGUILayout.IntField
+ (
+ new GUIContent
+ (
+ text: "- Good",
+ tooltip: "When FPS rise above this value, this color will be used."
+ ),
+ value: m_goodFpsThreshold.intValue
+ );
+
+ m_goodFpsColor.colorValue = EditorGUILayout.ColorField(m_goodFpsColor.colorValue);
+
+ EditorGUILayout.EndHorizontal();
+
+ if (m_goodFpsThreshold.intValue <= m_cautionFpsThreshold.intValue && m_goodFpsThreshold.intValue > 1)
+ {
+ m_cautionFpsThreshold.intValue = m_goodFpsThreshold.intValue - 1;
+ }
+ else if (m_goodFpsThreshold.intValue <= 1)
+ {
+ m_goodFpsThreshold.intValue = 2;
+ }
+
+ EditorGUILayout.BeginHorizontal();
+
+ m_cautionFpsThreshold.intValue = EditorGUILayout.IntField
+ (
+ new GUIContent
+ (
+ text: "- Caution",
+ tooltip: "When FPS falls between this and the Good value, this color will be used."
+ ),
+ value: m_cautionFpsThreshold.intValue
+ );
+
+ m_cautionFpsColor.colorValue = EditorGUILayout.ColorField(m_cautionFpsColor.colorValue);
+
+ EditorGUILayout.EndHorizontal();
+
+ if (m_cautionFpsThreshold.intValue >= m_goodFpsThreshold.intValue)
+ {
+ m_cautionFpsThreshold.intValue = m_goodFpsThreshold.intValue - 1;
+ }
+ else if (m_cautionFpsThreshold.intValue <= 0)
+ {
+ m_cautionFpsThreshold.intValue = 1;
+ }
+
+ EditorGUILayout.BeginHorizontal();
+
+ EditorGUILayout.IntField
+ (
+ new GUIContent
+ (
+ text: "- Critical",
+ tooltip: "When FPS falls below the Caution value, this color will be used. (You can't have negative FPS, so this value is just for reference, it can't be changed)."
+ ),
+ value: 0
+ );
+
+ m_criticalFpsColor.colorValue = EditorGUILayout.ColorField(m_criticalFpsColor.colorValue);
+
+ EditorGUILayout.EndHorizontal();
+
+ EditorGUI.indentLevel--;
+
+ if (m_fpsModuleState.intValue == 0)
+ {
+ m_fpsGraphResolution.intValue = EditorGUILayout.IntSlider
+ (
+ new GUIContent
+ (
+ text: "Graph resolution",
+ tooltip: "Defines the amount of points in the graph"
+ ),
+ m_fpsGraphResolution.intValue,
+ leftValue: 20,
+ rightValue: m_graphyMode.intValue == 0 ? 300 : 128
+ );
+ }
+
+ EditorGUIUtility.labelWidth = 180;
+ EditorGUIUtility.fieldWidth = 35;
+
+ m_timeToResetMinMaxFps.intValue = EditorGUILayout.IntSlider
+ (
+ new GUIContent
+ (
+ text: "Time to reset min/max values",
+ tooltip: "If the min/max value doesn't change in the specified time, they will be reset. This allows tracking the min/max fps in a shorter interval. \n\nSet it to 0 if you don't want it to reset."
+ ),
+ m_timeToResetMinMaxFps.intValue,
+ leftValue: 0,
+ rightValue: 120
+ );
+
+ EditorGUIUtility.labelWidth = 155;
+ EditorGUIUtility.fieldWidth = 35;
+
+ m_fpsTextUpdateRate.intValue = EditorGUILayout.IntSlider
+ (
+ new GUIContent
+ (
+ text: "Text update rate",
+ tooltip: "Defines the amount times the text is updated in 1 second."
+ ),
+ m_fpsTextUpdateRate.intValue,
+ leftValue: 1,
+ rightValue: 60
+ );
+ }
+
+ #endregion
+
+ GUILayout.Space(20);
+
+ #region Section -> RAM
+
+ m_ramModuleInspectorToggle = EditorGUILayout.Foldout
+ (
+ m_ramModuleInspectorToggle,
+ content: " [ RAM ]",
+ style: foldoutStyle
+ );
+
+ GUILayout.Space(5);
+
+ if (m_ramModuleInspectorToggle)
+ {
+ EditorGUILayout.PropertyField
+ (
+ m_ramModuleState,
+ new GUIContent
+ (
+ text: "Module state",
+ tooltip: "FULL -> Text + Graph \nTEXT -> Just text \nOFF -> Turned off"
+ )
+ );
+
+ GUILayout.Space(5);
+
+ EditorGUILayout.LabelField("Graph colors:");
+
+ EditorGUI.indentLevel++;
+
+ m_allocatedRamColor.colorValue = EditorGUILayout.ColorField
+ (
+ label: "- Allocated",
+ value: m_allocatedRamColor.colorValue
+ );
+
+ m_reservedRamColor.colorValue = EditorGUILayout.ColorField
+ (
+ label: "- Reserved",
+ value: m_reservedRamColor.colorValue
+ );
+
+ m_monoRamColor.colorValue = EditorGUILayout.ColorField
+ (
+ label: "- Mono",
+ value: m_monoRamColor.colorValue
+ );
+
+ EditorGUI.indentLevel--;
+
+ if (m_ramModuleState.intValue == 0)
+ {
+ m_ramGraphResolution.intValue = EditorGUILayout.IntSlider(
+ new GUIContent
+ (
+ text: "Graph resolution",
+ tooltip: "Defines the amount of points are in the graph"
+ ),
+ m_ramGraphResolution.intValue,
+ leftValue: 20,
+ rightValue: m_graphyMode.intValue == 0 ? 300 : 128
+ );
+ }
+
+ m_ramTextUpdateRate.intValue = EditorGUILayout.IntSlider
+ (
+ new GUIContent
+ (
+ text: "Text update rate",
+ tooltip: "Defines the amount times the text is updated in 1 second."
+ ),
+ m_ramTextUpdateRate.intValue,
+ leftValue: 1,
+ rightValue: 60
+ );
+ }
+
+ #endregion
+
+ GUILayout.Space(20);
+
+ #region Section -> Audio
+
+ m_audioModuleInspectorToggle = EditorGUILayout.Foldout
+ (
+ m_audioModuleInspectorToggle,
+ content: " [ AUDIO ]",
+ style: foldoutStyle
+ );
+
+ GUILayout.Space(5);
+
+ if (m_audioModuleInspectorToggle)
+ {
+ EditorGUILayout.PropertyField
+ (
+ m_audioModuleState,
+ new GUIContent
+ (
+ text: "Module state",
+ tooltip: "FULL -> Text + Graph \nTEXT -> Just text \nOFF -> Turned off"
+ )
+ );
+
+ GUILayout.Space(5);
+
+ EditorGUILayout.PropertyField
+ (
+ m_findAudioListenerInCameraIfNull,
+ new GUIContent
+ (
+ text: "Find audio listener",
+ tooltip: "Tries to find the AudioListener in the Main camera in the scene. (if AudioListener is null)"
+ )
+ );
+
+ EditorGUILayout.PropertyField
+ (
+ m_audioListener,
+ new GUIContent
+ (
+ text: "Audio Listener",
+ tooltip: "Graphy will take the data from this Listener. If none are specified, it will try to get it from the Main Camera in the scene."
+ )
+ );
+
+ if (m_audioModuleState.intValue == 0)
+ {
+ m_audioGraphColor.colorValue = EditorGUILayout.ColorField
+ (
+ label: "Graph color",
+ value: m_audioGraphColor.colorValue
+ );
+
+ m_audioGraphResolution.intValue = EditorGUILayout.IntSlider
+ (
+ new GUIContent
+ (
+ text: "Graph resolution",
+ tooltip: "Defines the amount of points that are in the graph."
+ ),
+ m_audioGraphResolution.intValue,
+ leftValue: 20,
+ rightValue: m_graphyMode.intValue == 0 ? 300 : 128
+ );
+
+ // Forces the value to be a multiple of 3, this way the audio graph is painted correctly
+ if (m_audioGraphResolution.intValue % 3 != 0 && m_audioGraphResolution.intValue < 300)
+ {
+ m_audioGraphResolution.intValue += 3 - m_audioGraphResolution.intValue % 3;
+ }
+ //TODO: Figure out why a static version of the ForceMultipleOf3 isnt used.
+ }
+
+ EditorGUILayout.PropertyField
+ (
+ m_FFTWindow,
+ new GUIContent
+ (
+ text: "FFT Window",
+ tooltip: "Used to reduce leakage between frequency bins/bands. Note, the more complex window type, the better the quality, but reduced speed. \n\nSimplest is rectangular. Most complex is BlackmanHarris"
+ )
+ );
+
+ m_spectrumSize.intValue = EditorGUILayout.IntSlider
+ (
+ new GUIContent
+ (
+ text: "Spectrum size",
+ tooltip: "Has to be a power of 2 between 128-8192. The higher sample rate, the less precision but also more impact on performance. Careful with mobile devices"
+ ),
+ m_spectrumSize.intValue,
+ leftValue: 128,
+ rightValue: 8192
+ );
+
+ int closestSpectrumIndex = 0;
+ int minDistanceToSpectrumValue = 100000;
+
+ for (int i = 0; i < m_spectrumSizeValues.Length; i++)
+ {
+ int newDistance = Mathf.Abs
+ (
+ value: m_spectrumSize.intValue - m_spectrumSizeValues[i]
+ );
+
+ if (newDistance < minDistanceToSpectrumValue)
+ {
+ minDistanceToSpectrumValue = newDistance;
+ closestSpectrumIndex = i;
+ }
+ }
+
+ m_spectrumSize.intValue = m_spectrumSizeValues[closestSpectrumIndex];
+
+ m_audioTextUpdateRate.intValue = EditorGUILayout.IntSlider
+ (
+ new GUIContent
+ (
+ text: "Text update rate",
+ tooltip: "Defines the amount times the text is updated in 1 second"
+ ),
+ m_audioTextUpdateRate.intValue,
+ leftValue: 1,
+ rightValue: 60
+ );
+ }
+
+ #endregion
+
+ GUILayout.Space(20);
+
+ #region Section -> Advanced Settings
+
+ m_advancedModuleInspectorToggle = EditorGUILayout.Foldout
+ (
+ m_advancedModuleInspectorToggle,
+ content: " [ ADVANCED DATA ]",
+ style: foldoutStyle
+ );
+
+ GUILayout.Space(5);
+
+ if (m_advancedModuleInspectorToggle)
+ {
+ EditorGUILayout.PropertyField(m_advancedModulePosition);
+
+ EditorGUILayout.PropertyField
+ (
+ m_advancedModuleState,
+ new GUIContent
+ (
+ text: "Module state",
+ tooltip: "FULL -> Text \nOFF -> Turned off"
+ )
+ );
+ }
+
+ #endregion;
+
+ EditorGUIUtility.labelWidth = defaultLabelWidth;
+ EditorGUIUtility.fieldWidth = defaultFieldWidth;
+
+ serializedObject.ApplyModifiedProperties();
+ }
+
+ #endregion
+
+ #region Methods -> Private
+
+ private void LoadGuiStyles()
+ {
+ string path = GetMonoScriptFilePath(this);
+
+ path = path.Split(separator: new string[] { "Assets" }, options: StringSplitOptions.None)[1]
+ .Split(separator: new string[] { "Tayx" }, options: StringSplitOptions.None)[0];
+
+ m_logoTexture = AssetDatabase.LoadAssetAtPath<Texture2D>
+ (
+ "Assets" +
+ path +
+ "Tayx/Graphy - Ultimate Stats Monitor/Textures/Manager_Logo_" +
+ (EditorGUIUtility.isProSkin ? "White.png" : "Dark.png")
+ );
+
+ m_skin = AssetDatabase.LoadAssetAtPath<GUISkin>
+ (
+ "Assets" +
+ path +
+ "Tayx/Graphy - Ultimate Stats Monitor/GUI/Graphy.guiskin"
+ );
+
+ if (m_skin != null)
+ {
+ m_headerStyle1 = m_skin.GetStyle("Header1");
+ m_headerStyle2 = m_skin.GetStyle("Header2");
+
+ SetGuiStyleFontColor
+ (
+ guiStyle: m_headerStyle2,
+ color: EditorGUIUtility.isProSkin ? Color.white : Color.black
+ );
+ }
+ else
+ {
+ m_headerStyle1 = EditorStyles.boldLabel;
+ m_headerStyle2 = EditorStyles.boldLabel;
+ }
+ }
+
+ /// <summary>
+ /// Sets the colors of the GUIStyle's text.
+ /// </summary>
+ /// <param name="guiStyle">
+ /// The GUIStyle to be altered.
+ /// </param>
+ /// <param name="color">
+ /// The color for the text.
+ /// </param>
+ private void SetGuiStyleFontColor(GUIStyle guiStyle, Color color) //TODO: Perhaps add a null check.
+ {
+ guiStyle.normal .textColor = color;
+ guiStyle.hover .textColor = color;
+ guiStyle.active .textColor = color;
+ guiStyle.focused .textColor = color;
+ guiStyle.onNormal .textColor = color;
+ guiStyle.onHover .textColor = color;
+ guiStyle.onActive .textColor = color;
+ guiStyle.onFocused .textColor = color;
+ }
+
+ private string GetMonoScriptFilePath(ScriptableObject scriptableObject) //TODO: Perhaps add a null check.
+ {
+ MonoScript ms = MonoScript.FromScriptableObject(scriptableObject);
+ string filePath = AssetDatabase.GetAssetPath(ms);
+
+ FileInfo fi = new FileInfo(filePath);
+
+ if (fi.Directory != null)
+ {
+ filePath = fi.Directory.ToString();
+ return filePath.Replace
+ (
+ oldChar: '\\',
+ newChar: '/'
+ );
+ }
+ return null;
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Editor/GraphyManagerEditor.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Editor/GraphyManagerEditor.cs.meta
new file mode 100644
index 0000000..0d1145c
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Editor/GraphyManagerEditor.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f01a5c28e5127404da343db2a7409c10
+timeCreated: 1513764399
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps.meta
new file mode 100644
index 0000000..844e57b
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 3232b12a3422d1a4d8ff3eaa000c43ae
+folderAsset: yes
+timeCreated: 1513377102
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsGraph.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsGraph.cs
new file mode 100644
index 0000000..6cc0d6a
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsGraph.cs
@@ -0,0 +1,178 @@
+/* ---------------------------------------
+ * 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;
+
+namespace Tayx.Graphy.Fps
+{
+ public class G_FpsGraph : G_Graph
+ {
+ /* ----- TODO: ----------------------------
+ * Add summaries to the variables.
+ * Add summaries to the functions.
+ * Check if we should add a "RequireComponent" for "FpsMonitor".
+ * --------------------------------------*/
+
+ #region Variables -> Serialized Private
+
+ [SerializeField] private Image m_imageGraph = null;
+
+ [SerializeField] private Shader ShaderFull = null;
+ [SerializeField] private Shader ShaderLight = null;
+
+ #endregion
+
+ #region Variables -> Private
+
+ private GraphyManager m_graphyManager = null;
+
+ private G_FpsMonitor m_fpsMonitor = null;
+
+ private int m_resolution = 150;
+
+ private G_GraphShader m_shaderGraph = null;
+
+ private int[] m_fpsArray;
+
+ private int m_highestFps;
+
+ #endregion
+
+ #region Methods -> Unity Callbacks
+
+ private void OnEnable()
+ {
+ Init();
+ }
+
+ private void Update()
+ {
+ UpdateGraph();
+ }
+
+ #endregion
+
+ #region Methods -> Public
+
+ public void UpdateParameters()
+ {
+ switch (m_graphyManager.GraphyMode)
+ {
+ case GraphyManager.Mode.FULL:
+ m_shaderGraph.ArrayMaxSize = G_GraphShader.ArrayMaxSizeFull;
+ m_shaderGraph.Image.material = new Material(ShaderFull);
+ break;
+
+ case GraphyManager.Mode.LIGHT:
+ m_shaderGraph.ArrayMaxSize = G_GraphShader.ArrayMaxSizeLight;
+ m_shaderGraph.Image.material = new Material(ShaderLight);
+ break;
+ }
+
+ m_shaderGraph.InitializeShader();
+
+ m_resolution = m_graphyManager.FpsGraphResolution;
+
+ CreatePoints();
+ }
+
+ #endregion
+
+ #region Methods -> Protected Override
+
+ protected override void UpdateGraph()
+ {
+ int fps = (int)(1 / Time.unscaledDeltaTime);
+
+ int currentMaxFps = 0;
+
+ for (int i = 0; i <= m_resolution - 1; i++)
+ {
+ if (i >= m_resolution - 1)
+ {
+ m_fpsArray[i] = fps;
+ }
+ else
+ {
+ m_fpsArray[i] = m_fpsArray[i + 1];
+ }
+
+ // Store the highest fps to use as the highest point in the graph
+
+ if (currentMaxFps < m_fpsArray[i])
+ {
+ currentMaxFps = m_fpsArray[i];
+ }
+
+ }
+
+ m_highestFps = m_highestFps < 1 || m_highestFps <= currentMaxFps ? currentMaxFps : m_highestFps - 1;
+
+ for (int i = 0; i <= m_resolution - 1; i++)
+ {
+ m_shaderGraph.Array[i] = m_fpsArray[i] / (float) m_highestFps;
+ }
+
+ // Update the material values
+
+ m_shaderGraph.UpdatePoints();
+
+ m_shaderGraph.Average = m_fpsMonitor.AverageFPS / m_highestFps;
+ m_shaderGraph.UpdateAverage();
+
+ m_shaderGraph.GoodThreshold = (float)m_graphyManager.GoodFPSThreshold / m_highestFps;
+ m_shaderGraph.CautionThreshold = (float)m_graphyManager.CautionFPSThreshold / m_highestFps;
+ m_shaderGraph.UpdateThresholds();
+ }
+
+ protected override void CreatePoints()
+ {
+ m_shaderGraph.Array = new float[m_resolution];
+
+ m_fpsArray = new int[m_resolution];
+
+ for (int i = 0; i < m_resolution; i++)
+ {
+ m_shaderGraph.Array[i] = 0;
+ }
+
+ m_shaderGraph.GoodColor = m_graphyManager.GoodFPSColor;
+ m_shaderGraph.CautionColor = m_graphyManager.CautionFPSColor;
+ m_shaderGraph.CriticalColor = m_graphyManager.CriticalFPSColor;
+
+ m_shaderGraph.UpdateColors();
+
+ m_shaderGraph.UpdateArray();
+ }
+
+ #endregion
+
+ #region Methods -> Private
+
+ private void Init()
+ {
+ m_graphyManager = transform.root.GetComponentInChildren<GraphyManager>();
+
+ m_fpsMonitor = GetComponent<G_FpsMonitor>();
+
+ m_shaderGraph = new G_GraphShader
+ {
+ Image = m_imageGraph
+ };
+
+ UpdateParameters();
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsGraph.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsGraph.cs.meta
new file mode 100644
index 0000000..66d52c8
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsGraph.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 2e119c7747ac400478c7cfcaea03214e
+timeCreated: 1511794194
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsManager.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsManager.cs
new file mode 100644
index 0000000..ee3d172
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsManager.cs
@@ -0,0 +1,257 @@
+/* ---------------------------------------
+ * 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.Fps
+{
+ public class G_FpsManager : MonoBehaviour, IMovable, IModifiableState
+ {
+ /* ----- TODO: ----------------------------
+ * Check if we can seal this class.
+ * 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 "FpsGraph".
+ * Check if we should add a "RequireComponent" for "FpsMonitor".
+ * Check if we should add a "RequireComponent" for "FpsText".
+ * --------------------------------------*/
+
+ #region Variables -> Serialized Private
+
+ [SerializeField] private GameObject m_fpsGraphGameObject = null;
+
+ [SerializeField] private List<GameObject> m_nonBasicTextGameObjects = new List<GameObject>();
+
+ [SerializeField] private List<Image> m_backgroundImages = new List<Image>();
+
+ #endregion
+
+ #region Variables -> Private
+
+ private GraphyManager m_graphyManager = null;
+
+ private G_FpsGraph m_fpsGraph = null;
+ private G_FpsMonitor m_fpsMonitor = null;
+ private G_FpsText m_fpsText = 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:
+ 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.BASIC:
+ gameObject.SetActive(true);
+ m_childrenGameObjects.SetAllActive(true);
+ m_nonBasicTextGameObjects.SetAllActive(false);
+ SetGraphActive(false);
+
+ if (m_graphyManager.Background)
+ {
+ m_backgroundImages.SetOneActive(2);
+ }
+ else
+ {
+ m_backgroundImages.SetAllActive(false);
+ }
+
+ break;
+
+ case GraphyManager.ModuleState.BACKGROUND:
+ gameObject.SetActive(true);
+ m_childrenGameObjects.SetAllActive(false);
+ SetGraphActive(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_fpsGraph .UpdateParameters();
+ m_fpsMonitor .UpdateParameters();
+ m_fpsText .UpdateParameters();
+
+ SetState(m_graphyManager.FpsModuleState);
+ }
+
+ public void RefreshParameters()
+ {
+ foreach (var image in m_backgroundImages)
+ {
+ image.color = m_graphyManager.BackgroundColor;
+ }
+
+ m_fpsGraph .UpdateParameters();
+ m_fpsMonitor .UpdateParameters();
+ m_fpsText .UpdateParameters();
+
+ SetState(m_currentModuleState, true);
+ }
+
+ #endregion
+
+ #region Methods -> Private
+
+ private void Init()
+ {
+ m_graphyManager = transform.root.GetComponentInChildren<GraphyManager>();
+
+ m_rectTransform = GetComponent<RectTransform>();
+
+ m_fpsGraph = GetComponent<G_FpsGraph>();
+ m_fpsMonitor = GetComponent<G_FpsMonitor>();
+ m_fpsText = GetComponent<G_FpsText>();
+
+ foreach (Transform child in transform)
+ {
+ if (child.parent == transform)
+ {
+ m_childrenGameObjects.Add(child.gameObject);
+ }
+ }
+ }
+
+ private void SetGraphActive(bool active)
+ {
+ m_fpsGraph.enabled = active;
+ m_fpsGraphGameObject.SetActive(active);
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsManager.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsManager.cs.meta
new file mode 100644
index 0000000..588a34c
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsManager.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 221dc0b3655ddb749ace6bad55f0159f
+timeCreated: 1514998359
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsMonitor.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsMonitor.cs
new file mode 100644
index 0000000..4aadfa8
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsMonitor.cs
@@ -0,0 +1,178 @@
+/* ---------------------------------------
+ * 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;
+using System.Runtime.CompilerServices;
+
+namespace Tayx.Graphy.Fps
+{
+ public class G_FpsMonitor : MonoBehaviour
+ {
+ /* ----- TODO: ----------------------------
+ * Add summaries to the variables.
+ * Add summaries to the functions.
+ * --------------------------------------*/
+
+ #region Variables -> Serialized Private
+
+ [SerializeField] private int m_averageSamples = 200;
+
+ #endregion
+
+ #region Variables -> Private
+
+ private GraphyManager m_graphyManager;
+
+ private float m_currentFps = 0f;
+ private float m_avgFps = 0f;
+ private float m_minFps = 0f;
+ private float m_maxFps = 0f;
+
+ private float[] m_averageFpsSamples;
+ private int m_avgFpsSamplesOffset = 0;
+ private int m_indexMask = 0;
+ private int m_avgFpsSamplesCapacity = 0;
+ private int m_avgFpsSamplesCount = 0;
+ private int m_timeToResetMinMaxFps = 10;
+
+ private float m_timeToResetMinFpsPassed = 0f;
+ private float m_timeToResetMaxFpsPassed = 0f;
+
+ private float unscaledDeltaTime = 0f;
+
+ #endregion
+
+ #region Properties -> Public
+
+ public float CurrentFPS { get { return m_currentFps; } }
+ public float AverageFPS { get { return m_avgFps;} }
+
+ public float MinFPS { get { return m_minFps;} }
+ public float MaxFPS { get { return m_maxFps;} }
+
+ #endregion
+
+ #region Methods -> Unity Callbacks
+
+ private void Awake()
+ {
+ Init();
+ }
+
+ private void Update()
+ {
+ unscaledDeltaTime = Time.unscaledDeltaTime;
+
+ m_timeToResetMinFpsPassed += unscaledDeltaTime;
+ m_timeToResetMaxFpsPassed += unscaledDeltaTime;
+
+ // Update fps and ms
+
+ m_currentFps = 1 / unscaledDeltaTime;
+
+ // Update avg fps
+
+ m_avgFps = 0;
+
+ m_averageFpsSamples[ToBufferIndex(m_avgFpsSamplesCount)] = m_currentFps;
+ m_avgFpsSamplesOffset = ToBufferIndex(m_avgFpsSamplesOffset + 1);
+
+ if (m_avgFpsSamplesCount < m_avgFpsSamplesCapacity)
+ {
+ m_avgFpsSamplesCount++;
+ }
+
+ for (int i = 0; i < m_avgFpsSamplesCount; i++)
+ {
+ m_avgFps += m_averageFpsSamples[i];
+ }
+
+ m_avgFps /= m_avgFpsSamplesCount;
+
+ // Checks to reset min and max fps
+
+ if ( m_timeToResetMinMaxFps > 0
+ && m_timeToResetMinFpsPassed > m_timeToResetMinMaxFps)
+ {
+ m_minFps = 0;
+ m_timeToResetMinFpsPassed = 0;
+ }
+
+ if ( m_timeToResetMinMaxFps > 0
+ && m_timeToResetMaxFpsPassed > m_timeToResetMinMaxFps)
+ {
+ m_maxFps = 0;
+ m_timeToResetMaxFpsPassed = 0;
+ }
+
+ // Update min fps
+
+ if (m_currentFps < m_minFps || m_minFps <= 0)
+ {
+ m_minFps = m_currentFps;
+
+ m_timeToResetMinFpsPassed = 0;
+ }
+
+ // Update max fps
+
+ if (m_currentFps > m_maxFps || m_maxFps <= 0)
+ {
+ m_maxFps = m_currentFps;
+
+ m_timeToResetMaxFpsPassed = 0;
+ }
+ }
+
+ #endregion
+
+ #region Methods -> Public
+
+ public void UpdateParameters()
+ {
+ m_timeToResetMinMaxFps = m_graphyManager.TimeToResetMinMaxFps;
+ }
+
+ #endregion
+
+ #region Methods -> Private
+
+ private void Init()
+ {
+ m_graphyManager = transform.root.GetComponentInChildren<GraphyManager>();
+
+ ResizeSamplesBuffer(m_averageSamples);
+
+ UpdateParameters();
+ }
+
+
+ private void ResizeSamplesBuffer(int size)
+ {
+ m_avgFpsSamplesCapacity = Mathf.NextPowerOfTwo(size);
+
+ m_averageFpsSamples = new float[m_avgFpsSamplesCapacity];
+
+ m_indexMask = m_avgFpsSamplesCapacity - 1;
+ m_avgFpsSamplesOffset = 0;
+ }
+
+#if NET_4_6 || NET_STANDARD_2_0
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
+ private int ToBufferIndex(int index)
+ {
+ return (index + m_avgFpsSamplesOffset) & m_indexMask;
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsMonitor.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsMonitor.cs.meta
new file mode 100644
index 0000000..56e47db
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsMonitor.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: b205584e495e4634aa3a332a78102a19
+timeCreated: 1513376950
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsText.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsText.cs
new file mode 100644
index 0000000..7ad691e
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsText.cs
@@ -0,0 +1,170 @@
+/* ---------------------------------------
+ * Author: Martin Pane (martintayx@gmail.com) (@tayx94)
+ * Collaborators: Lars Aalbertsen (@Rockylars)
+ * Project: Graphy - Ultimate Stats Monitor
+ * Date: 22-Nov-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.Fps
+{
+ public class G_FpsText : MonoBehaviour
+ {
+ /* ----- TODO: ----------------------------
+ * Add summaries to the variables.
+ * Add summaries to the functions.
+ * Check if we should add a "RequireComponent" for "FpsMonitor".
+ * Improve the IntString Init to come from the core instead.
+ * --------------------------------------*/
+
+ #region Variables -> Serialized Private
+
+ [SerializeField] private Text m_fpsText = null;
+ [SerializeField] private Text m_msText = null;
+
+ [SerializeField] private Text m_avgFpsText = null;
+ [SerializeField] private Text m_minFpsText = null;
+ [SerializeField] private Text m_maxFpsText = null;
+
+ #endregion
+
+ #region Variables -> Private
+
+ private GraphyManager m_graphyManager = null;
+
+ private G_FpsMonitor m_fpsMonitor = null;
+
+ private int m_updateRate = 4; // 4 updates per sec.
+
+ private int m_frameCount = 0;
+
+ private float m_deltaTime = 0f;
+
+ private float m_fps = 0f;
+
+ private const int m_minFps = 0;
+ private const int m_maxFps = 10000;
+
+ private const string m_msStringFormat = "0.0";
+
+ #endregion
+
+ #region Methods -> Unity Callbacks
+
+ private void Awake()
+ {
+ Init();
+ }
+
+ private void Update()
+ {
+ m_deltaTime += Time.unscaledDeltaTime;
+
+ m_frameCount++;
+
+ // Only update texts 'm_updateRate' times per second
+
+ if (m_deltaTime > 1f / m_updateRate)
+ {
+ m_fps = m_frameCount / m_deltaTime;
+
+ // Update fps and ms
+
+ m_fpsText.text = Mathf.RoundToInt(m_fps).ToStringNonAlloc();
+ m_msText.text = (m_deltaTime / m_frameCount * 1000f).ToStringNonAlloc(m_msStringFormat);
+
+ // Update min fps
+
+ m_minFpsText.text = m_fpsMonitor.MinFPS.ToInt().ToStringNonAlloc();
+
+ SetFpsRelatedTextColor(m_minFpsText, m_fpsMonitor.MinFPS);
+
+ // Update max fps
+
+ m_maxFpsText.text = m_fpsMonitor.MaxFPS.ToInt().ToStringNonAlloc();
+
+ SetFpsRelatedTextColor(m_maxFpsText, m_fpsMonitor.MaxFPS);
+
+ // Update avg fps
+
+ m_avgFpsText.text = m_fpsMonitor.AverageFPS.ToInt().ToStringNonAlloc();
+
+ SetFpsRelatedTextColor(m_avgFpsText, m_fpsMonitor.AverageFPS);
+
+ // Reset variables
+
+ m_deltaTime = 0f;
+ m_frameCount = 0;
+ }
+ }
+
+ #endregion
+
+ #region Methods -> Public
+
+ public void UpdateParameters()
+ {
+ m_updateRate = m_graphyManager.FpsTextUpdateRate;
+ }
+
+ #endregion
+
+ #region Methods -> Private
+
+ /// <summary>
+ /// Assigns color to a text according to their fps numeric value and
+ /// the colors specified in the 3 categories (Good, Caution, Critical).
+ /// </summary>
+ ///
+ /// <param name="text">
+ /// UI Text component to change its color
+ /// </param>
+ ///
+ /// <param name="fps">
+ /// Numeric fps value
+ /// </param>
+ private void SetFpsRelatedTextColor(Text text, float fps)
+ {
+ if (fps > m_graphyManager.GoodFPSThreshold)
+ {
+ text.color = m_graphyManager.GoodFPSColor;
+ }
+ else if (fps > m_graphyManager.CautionFPSThreshold)
+ {
+ text.color = m_graphyManager.CautionFPSColor;
+ }
+ else
+ {
+ text.color = m_graphyManager.CriticalFPSColor;
+ }
+ }
+
+ private void Init()
+ {
+ //TODO: Replace this with one activated from the core and figure out the min value.
+ if (!G_IntString.Inited || G_IntString.MinValue > m_minFps || G_IntString.MaxValue < m_maxFps)
+ {
+ G_IntString.Init
+ (
+ minNegativeValue: m_minFps,
+ maxPositiveValue: m_maxFps
+ );
+ }
+
+ m_graphyManager = transform.root.GetComponentInChildren<GraphyManager>();
+
+ m_fpsMonitor = GetComponent<G_FpsMonitor>();
+
+ UpdateParameters();
+ }
+
+ #endregion
+ }
+}
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsText.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsText.cs.meta
new file mode 100644
index 0000000..41d6fcf
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Fps/G_FpsText.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f74bbf307d92b0d4e81ae60b9eb1e42f
+timeCreated: 1511555604
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Graph.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Graph.meta
new file mode 100644
index 0000000..1deb090
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Graph.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: aca40e3cb2846db40ad6d970f36d4a7f
+folderAsset: yes
+timeCreated: 1516716444
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Graph/G_Graph.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Graph/G_Graph.cs
new file mode 100644
index 0000000..5ec0a14
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Graph/G_Graph.cs
@@ -0,0 +1,37 @@
+/* ---------------------------------------
+ * Author: Martin Pane (martintayx@gmail.com) (@tayx94)
+ * Collaborators: Lars Aalbertsen (@Rockylars)
+ * Project: Graphy - Ultimate Stats Monitor
+ * Date: 23-Jan-18
+ * Studio: Tayx
+ *
+ * This project is released under the MIT license.
+ * Attribution is not required, but it is always welcomed!
+ * -------------------------------------*/
+
+using UnityEngine;
+
+namespace Tayx.Graphy.Graph
+{
+ public abstract class G_Graph : MonoBehaviour
+ {
+ /* ----- TODO: ----------------------------
+ *
+ * --------------------------------------*/
+
+ #region Methods -> Protected
+
+ /// <summary>
+ /// Updates the graph/s.
+ /// </summary>
+ protected abstract void UpdateGraph();
+
+ /// <summary>
+ /// Creates the points for the graph/s.
+ /// </summary>
+ protected abstract void CreatePoints();
+
+ #endregion
+ }
+
+}
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Graph/G_Graph.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Graph/G_Graph.cs.meta
new file mode 100644
index 0000000..c87b143
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Graph/G_Graph.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 67969a520b115cd47a7d955c9b2abfa6
+timeCreated: 1516716468
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/GraphyDebugger.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/GraphyDebugger.cs
new file mode 100644
index 0000000..468d40d
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/GraphyDebugger.cs
@@ -0,0 +1,567 @@
+/* ---------------------------------------
+ * Author: Martin Pane (martintayx@gmail.com) (@tayx94)
+ * Collaborators: Lars Aalbertsen (@Rockylars)
+ * Project: Graphy - Ultimate Stats Monitor
+ * Date: 23-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.Events;
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+using Tayx.Graphy.Audio;
+using Tayx.Graphy.Fps;
+using Tayx.Graphy.Ram;
+using Tayx.Graphy.Utils;
+
+namespace Tayx.Graphy
+{
+ public class GraphyDebugger : G_Singleton<GraphyDebugger>
+ {
+ /* ----- TODO: ----------------------------
+ * Add summaries to the variables.
+ * Add summaries to the functions.
+ * Ask why we're not using System.Serializable instead for the helper class.
+ * Simplify the initializers of the DebugPackets, but check wether we should as some wont work with certain lists.
+ * --------------------------------------*/
+
+ protected GraphyDebugger () { }
+
+ #region Enums -> Public
+
+ public enum DebugVariable
+ {
+ Fps,
+ Fps_Min,
+ Fps_Max,
+ Fps_Avg,
+ Ram_Allocated,
+ Ram_Reserved,
+ Ram_Mono,
+ Audio_DB
+ }
+
+ public enum DebugComparer
+ {
+ Less_than,
+ Equals_or_less_than,
+ Equals,
+ Equals_or_greater_than,
+ Greater_than
+ }
+
+ public enum ConditionEvaluation
+ {
+ All_conditions_must_be_met,
+ Only_one_condition_has_to_be_met,
+
+ }
+
+ public enum MessageType
+ {
+ Log,
+ Warning,
+ Error
+ }
+
+ #endregion
+
+ #region Structs -> Public
+
+ [Serializable]
+ public struct DebugCondition
+ {
+ [Tooltip("Variable to compare against")]
+ public DebugVariable Variable;
+ [Tooltip("Comparer operator to use")]
+ public DebugComparer Comparer;
+ [Tooltip("Value to compare against the chosen variable")]
+ public float Value;
+ }
+
+ #endregion
+
+ #region Helper Classes
+
+ [Serializable]
+ public class DebugPacket
+ {
+
+ [Tooltip("If false, it won't be checked")]
+ public bool Active = true;
+ [Tooltip("Optional Id. It's used to get or remove DebugPackets in runtime")]
+ public int Id;
+ [Tooltip("If true, once the actions are executed, this DebugPacket will delete itself")]
+ public bool ExecuteOnce = true;
+ [Tooltip("Time to wait before checking if conditions are met (use this to avoid low fps drops triggering the conditions when loading the game)")]
+ public float InitSleepTime = 2;
+ [Tooltip("Time to wait before checking if conditions are met again (once they have already been met and if ExecuteOnce is false)")]
+ public float ExecuteSleepTime = 2;
+
+ public ConditionEvaluation ConditionEvaluation = ConditionEvaluation.All_conditions_must_be_met;
+ [Tooltip("List of conditions that will be checked each frame")]
+ public List<DebugCondition> DebugConditions = new List<DebugCondition>();
+
+ // Actions on conditions met
+
+ public MessageType MessageType;
+ [Multiline]
+ public string Message = string.Empty;
+ public bool TakeScreenshot = false;
+ public string ScreenshotFileName = "Graphy_Screenshot";
+ [Tooltip("If true, it pauses the editor")]
+ public bool DebugBreak = false;
+ public UnityEvent UnityEvents;
+ public List<System.Action> Callbacks = new List<System.Action>();
+
+
+ private bool canBeChecked = false;
+ private bool executed = false;
+
+ private float timePassed = 0;
+
+ public bool Check { get { return canBeChecked; } }
+
+ public void Update()
+ {
+ if (!canBeChecked)
+ {
+ timePassed += Time.deltaTime;
+
+ if ( (executed && timePassed >= ExecuteSleepTime)
+ || (!executed && timePassed >= InitSleepTime))
+ {
+ canBeChecked = true;
+
+ timePassed = 0;
+ }
+ }
+ }
+
+ public void Executed()
+ {
+ canBeChecked = false;
+ executed = true;
+ }
+ }
+
+ #endregion
+
+ #region Variables -> Serialized Private
+
+ [SerializeField] private List<DebugPacket> m_debugPackets = new List<DebugPacket>();
+
+ #endregion
+
+ #region Variables -> Private
+
+ private G_FpsMonitor m_fpsMonitor = null;
+ private G_RamMonitor m_ramMonitor = null;
+ private G_AudioMonitor m_audioMonitor = null;
+
+ #endregion
+
+ #region Methods -> Unity Callbacks
+
+ private void Start()
+ {
+ m_fpsMonitor = GetComponentInChildren<G_FpsMonitor>();
+ m_ramMonitor = GetComponentInChildren<G_RamMonitor>();
+ m_audioMonitor = GetComponentInChildren<G_AudioMonitor>();
+ }
+
+ private void Update()
+ {
+ CheckDebugPackets();
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Add a new DebugPacket.
+ /// </summary>
+ public void AddNewDebugPacket(DebugPacket newDebugPacket)
+ {
+ if (m_debugPackets != null)
+ {
+ m_debugPackets.Add(newDebugPacket);
+ }
+ }
+
+ /// <summary>
+ /// Add a new DebugPacket.
+ /// </summary>
+ public void AddNewDebugPacket
+ (
+ int newId,
+ DebugCondition newDebugCondition,
+ MessageType newMessageType,
+ string newMessage,
+ bool newDebugBreak,
+ System.Action newCallback
+ )
+ {
+ DebugPacket newDebugPacket = new DebugPacket();
+
+ newDebugPacket.Id = newId;
+ newDebugPacket.DebugConditions.Add(newDebugCondition);
+ newDebugPacket.MessageType = newMessageType;
+ newDebugPacket.Message = newMessage;
+ newDebugPacket.DebugBreak = newDebugBreak;
+ newDebugPacket.Callbacks.Add(newCallback);
+
+ AddNewDebugPacket(newDebugPacket);
+ }
+
+ /// <summary>
+ /// Add a new DebugPacket.
+ /// </summary>
+ public void AddNewDebugPacket
+ (
+ int newId,
+ List<DebugCondition> newDebugConditions,
+ MessageType newMessageType,
+ string newMessage,
+ bool newDebugBreak,
+ System.Action newCallback
+ )
+ {
+ DebugPacket newDebugPacket = new DebugPacket();
+
+ newDebugPacket.Id = newId;
+ newDebugPacket.DebugConditions = newDebugConditions;
+ newDebugPacket.MessageType = newMessageType;
+ newDebugPacket.Message = newMessage;
+ newDebugPacket.DebugBreak = newDebugBreak;
+ newDebugPacket.Callbacks.Add(newCallback);
+
+ AddNewDebugPacket(newDebugPacket);
+ }
+
+ /// <summary>
+ /// Add a new DebugPacket.
+ /// </summary>
+ public void AddNewDebugPacket
+ (
+ int newId,
+ DebugCondition newDebugCondition,
+ MessageType newMessageType,
+ string newMessage,
+ bool newDebugBreak,
+ List<System.Action> newCallbacks
+ )
+ {
+ DebugPacket newDebugPacket = new DebugPacket();
+
+ newDebugPacket.Id = newId;
+ newDebugPacket.DebugConditions.Add(newDebugCondition);
+ newDebugPacket.MessageType = newMessageType;
+ newDebugPacket.Message = newMessage;
+ newDebugPacket.DebugBreak = newDebugBreak;
+ newDebugPacket.Callbacks = newCallbacks;
+
+ AddNewDebugPacket(newDebugPacket);
+ }
+
+ /// <summary>
+ /// Add a new DebugPacket.
+ /// </summary>
+ public void AddNewDebugPacket
+ (
+ int newId,
+ List<DebugCondition> newDebugConditions,
+ MessageType newMessageType,
+ string newMessage,
+ bool newDebugBreak,
+ List<System.Action> newCallbacks
+ )
+ {
+ DebugPacket newDebugPacket = new DebugPacket();
+
+ newDebugPacket.Id = newId;
+ newDebugPacket.DebugConditions = newDebugConditions;
+ newDebugPacket.MessageType = newMessageType;
+ newDebugPacket.Message = newMessage;
+ newDebugPacket.DebugBreak = newDebugBreak;
+ newDebugPacket.Callbacks = newCallbacks;
+
+ AddNewDebugPacket(newDebugPacket);
+ }
+
+ /// <summary>
+ /// Returns the first Packet with the specified ID in the DebugPacket list.
+ /// </summary>
+ /// <param name="packetId"></param>
+ /// <returns></returns>
+ public DebugPacket GetFirstDebugPacketWithId(int packetId)
+ {
+ return m_debugPackets.First(x => x.Id == packetId);
+ }
+
+ /// <summary>
+ /// Returns a list with all the Packets with the specified ID in the DebugPacket list.
+ /// </summary>
+ /// <param name="packetId"></param>
+ /// <returns></returns>
+ public List<DebugPacket> GetAllDebugPacketsWithId(int packetId)
+ {
+ return m_debugPackets.FindAll(x => x.Id == packetId);
+ }
+
+ /// <summary>
+ /// Removes the first Packet with the specified ID in the DebugPacket list.
+ /// </summary>
+ /// <param name="packetId"></param>
+ /// <returns></returns>
+ public void RemoveFirstDebugPacketWithId(int packetId)
+ {
+ if (m_debugPackets != null && GetFirstDebugPacketWithId(packetId) != null)
+ {
+ m_debugPackets.Remove(GetFirstDebugPacketWithId(packetId));
+ }
+ }
+
+ /// <summary>
+ /// Removes all the Packets with the specified ID in the DebugPacket list.
+ /// </summary>
+ /// <param name="packetId"></param>
+ /// <returns></returns>
+ public void RemoveAllDebugPacketsWithId(int packetId)
+ {
+ if (m_debugPackets != null)
+ {
+ m_debugPackets.RemoveAll(x => x.Id == packetId);
+ }
+ }
+
+ /// <summary>
+ /// Add an Action callback to the first Packet with the specified ID in the DebugPacket list.
+ /// </summary>
+ /// <param name="callback"></param>
+ /// <param name="id"></param>
+ public void AddCallbackToFirstDebugPacketWithId(System.Action callback, int id)
+ {
+ if (GetFirstDebugPacketWithId(id) != null)
+ {
+ GetFirstDebugPacketWithId(id).Callbacks.Add(callback);
+ }
+ }
+
+ /// <summary>
+ /// Add an Action callback to all the Packets with the specified ID in the DebugPacket list.
+ /// </summary>
+ /// <param name="callback"></param>
+ /// <param name="id"></param>
+ public void AddCallbackToAllDebugPacketWithId(System.Action callback, int id)
+ {
+ if (GetAllDebugPacketsWithId(id) != null)
+ {
+ foreach (var debugPacket in GetAllDebugPacketsWithId(id))
+ {
+ if (callback != null)
+ {
+ debugPacket.Callbacks.Add(callback);
+ }
+ }
+ }
+ }
+
+ #endregion
+
+ #region Methods -> Private
+
+ /// <summary>
+ /// Checks all the Debug Packets to see if they have to be executed.
+ /// </summary>
+ private void CheckDebugPackets()
+ {
+ if (m_debugPackets == null)
+ {
+ return;
+ }
+
+ for (var i = 0; i < m_debugPackets.Count; i++)
+ {
+ DebugPacket packet = m_debugPackets[i];
+
+ if (packet != null && packet.Active)
+ {
+ packet.Update();
+
+ if (packet.Check)
+ {
+ switch (packet.ConditionEvaluation)
+ {
+ case ConditionEvaluation.All_conditions_must_be_met:
+ int count = 0;
+
+ foreach (var packetDebugCondition in packet.DebugConditions)
+ {
+ if (CheckIfConditionIsMet(packetDebugCondition))
+ {
+ count++;
+ }
+ }
+
+ if (count >= packet.DebugConditions.Count)
+ {
+ ExecuteOperationsInDebugPacket(packet);
+
+ if (packet.ExecuteOnce)
+ {
+ m_debugPackets[i] = null;
+ }
+ }
+
+ break;
+
+ case ConditionEvaluation.Only_one_condition_has_to_be_met:
+ foreach (var packetDebugCondition in packet.DebugConditions)
+ {
+ if (CheckIfConditionIsMet(packetDebugCondition))
+ {
+ ExecuteOperationsInDebugPacket(packet);
+
+ if (packet.ExecuteOnce)
+ {
+ m_debugPackets[i] = null;
+ }
+
+ break;
+ }
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ m_debugPackets.RemoveAll((packet) => packet == null);
+ }
+
+ /// <summary>
+ /// Returns true if a condition is met.
+ /// </summary>
+ /// <param name="debugCondition"></param>
+ /// <returns></returns>
+ private bool CheckIfConditionIsMet(DebugCondition debugCondition)
+ {
+ switch (debugCondition.Comparer)
+ {
+ case DebugComparer.Less_than:
+ return GetRequestedValueFromDebugVariable(debugCondition.Variable) < debugCondition.Value;
+ case DebugComparer.Equals_or_less_than:
+ return GetRequestedValueFromDebugVariable(debugCondition.Variable) <= debugCondition.Value;
+ case DebugComparer.Equals:
+ return Mathf.Approximately(GetRequestedValueFromDebugVariable(debugCondition.Variable), debugCondition.Value);
+ case DebugComparer.Equals_or_greater_than:
+ return GetRequestedValueFromDebugVariable(debugCondition.Variable) >= debugCondition.Value;
+ case DebugComparer.Greater_than:
+ return GetRequestedValueFromDebugVariable(debugCondition.Variable) > debugCondition.Value;
+
+ default:
+ return false;
+ }
+ }
+
+ /// <summary>
+ /// Obtains the requested value from the specified variable.
+ /// </summary>
+ /// <param name="debugVariable"></param>
+ /// <returns></returns>
+ private float GetRequestedValueFromDebugVariable(DebugVariable debugVariable)
+ {
+ switch (debugVariable)
+ {
+ case DebugVariable.Fps:
+ return m_fpsMonitor != null ? m_fpsMonitor.CurrentFPS : 0;
+ case DebugVariable.Fps_Min:
+ return m_fpsMonitor != null ? m_fpsMonitor.MinFPS : 0;
+ case DebugVariable.Fps_Max:
+ return m_fpsMonitor != null ? m_fpsMonitor.MaxFPS : 0;
+ case DebugVariable.Fps_Avg:
+ return m_fpsMonitor != null ? m_fpsMonitor.AverageFPS : 0;
+
+ case DebugVariable.Ram_Allocated:
+ return m_ramMonitor != null ? m_ramMonitor.AllocatedRam : 0;
+ case DebugVariable.Ram_Reserved:
+ return m_ramMonitor != null ? m_ramMonitor.AllocatedRam : 0;
+ case DebugVariable.Ram_Mono:
+ return m_ramMonitor != null ? m_ramMonitor.AllocatedRam : 0;
+
+ case DebugVariable.Audio_DB:
+ return m_audioMonitor != null ? m_audioMonitor.MaxDB : 0;
+
+ default:
+ return 0;
+
+ }
+ }
+
+ /// <summary>
+ /// Executes the operations in the DebugPacket specified.
+ /// </summary>
+ /// <param name="debugPacket"></param>
+ private void ExecuteOperationsInDebugPacket(DebugPacket debugPacket)
+ {
+ if (debugPacket != null)
+ {
+ if (debugPacket.DebugBreak)
+ {
+ Debug.Break();
+ }
+
+ if (debugPacket.Message != "")
+ {
+ string message = "[Graphy] (" + System.DateTime.Now + "): " + debugPacket.Message;
+
+ switch (debugPacket.MessageType)
+ {
+ case MessageType.Log:
+ Debug.Log(message);
+ break;
+ case MessageType.Warning:
+ Debug.LogWarning(message);
+ break;
+ case MessageType.Error:
+ Debug.LogError(message);
+ break;
+ }
+ }
+
+ if (debugPacket.TakeScreenshot)
+ {
+ string path = debugPacket.ScreenshotFileName + "_" + System.DateTime.Now + ".png";
+ path = path.Replace("/", "-").Replace(" ", "_").Replace(":", "-");
+
+#if UNITY_2017_1_OR_NEWER
+ ScreenCapture.CaptureScreenshot(path);
+#else
+ Application.CaptureScreenshot(path);
+#endif
+ }
+
+ debugPacket.UnityEvents.Invoke();
+
+ foreach (var callback in debugPacket.Callbacks)
+ {
+ if (callback != null) callback();
+ }
+
+ debugPacket.Executed();
+ }
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/GraphyDebugger.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/GraphyDebugger.cs.meta
new file mode 100644
index 0000000..b5c31b0
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/GraphyDebugger.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: cb8428f1f208dcc49b6c04976d44cbc9
+timeCreated: 1514034949
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/GraphyManager.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/GraphyManager.cs
new file mode 100644
index 0000000..7d71a97
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/GraphyManager.cs
@@ -0,0 +1,713 @@
+/* ---------------------------------------
+ * 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 System;
+using UnityEngine;
+using Tayx.Graphy.Audio;
+using Tayx.Graphy.Fps;
+using Tayx.Graphy.Ram;
+using Tayx.Graphy.Utils;
+using Tayx.Graphy.Advanced;
+
+namespace Tayx.Graphy
+{
+ //[ExecuteInEditMode]
+ public class GraphyManager : G_Singleton<GraphyManager>
+ {
+ /* ----- TODO: ----------------------------
+ * Add summaries to the variables.
+ * Add summaries to the functions.
+ * --------------------------------------*/
+
+ protected GraphyManager () { }
+
+ //Enums
+ #region Enums -> Public
+
+ public enum Mode
+ {
+ FULL = 0,
+ LIGHT = 1
+ }
+
+ public enum ModuleType
+ {
+ FPS = 0,
+ RAM = 1,
+ AUDIO = 2,
+ ADVANCED = 3
+ }
+
+ public enum ModuleState
+ {
+ FULL = 0,
+ TEXT = 1,
+ BASIC = 2,
+ BACKGROUND = 3,
+ OFF = 4
+ }
+
+ public enum ModulePosition
+ {
+ TOP_RIGHT = 0,
+ TOP_LEFT = 1,
+ BOTTOM_RIGHT = 2,
+ BOTTOM_LEFT = 3,
+ FREE = 4
+ }
+
+ public enum LookForAudioListener
+ {
+ ALWAYS,
+ ON_SCENE_LOAD,
+ NEVER
+ }
+
+ public enum ModulePreset
+ {
+ FPS_BASIC = 0,
+ FPS_TEXT = 1,
+ FPS_FULL = 2,
+
+ FPS_TEXT_RAM_TEXT = 3,
+ FPS_FULL_RAM_TEXT = 4,
+ FPS_FULL_RAM_FULL = 5,
+
+ FPS_TEXT_RAM_TEXT_AUDIO_TEXT = 6,
+ FPS_FULL_RAM_TEXT_AUDIO_TEXT = 7,
+ FPS_FULL_RAM_FULL_AUDIO_TEXT = 8,
+ FPS_FULL_RAM_FULL_AUDIO_FULL = 9,
+
+ FPS_FULL_RAM_FULL_AUDIO_FULL_ADVANCED_FULL = 10,
+ FPS_BASIC_ADVANCED_FULL = 11
+ }
+
+ #endregion
+
+ #region Variables -> Serialized Private
+
+ [SerializeField] private Mode m_graphyMode = Mode.FULL;
+
+ [SerializeField] private bool m_enableOnStartup = true;
+
+ [SerializeField] private bool m_keepAlive = true;
+
+ [SerializeField] private bool m_background = true;
+ [SerializeField] private Color m_backgroundColor = new Color(0, 0, 0, 0.3f);
+
+ [SerializeField] private bool m_enableHotkeys = true;
+
+ [SerializeField] private KeyCode m_toggleModeKeyCode = KeyCode.G;
+ [SerializeField] private bool m_toggleModeCtrl = true;
+ [SerializeField] private bool m_toggleModeAlt = false;
+
+ [SerializeField] private KeyCode m_toggleActiveKeyCode = KeyCode.H;
+ [SerializeField] private bool m_toggleActiveCtrl = true;
+ [SerializeField] private bool m_toggleActiveAlt = false;
+
+ [SerializeField] private ModulePosition m_graphModulePosition = ModulePosition.TOP_RIGHT;
+
+ // Fps ---------------------------------------------------------------------------
+
+ [SerializeField] private ModuleState m_fpsModuleState = ModuleState.FULL;
+
+ [Range(0, 200)]
+ [Tooltip("Time (in seconds) to reset the minimum and maximum framerates if they don't change in the specified time. Set to 0 if you don't want it to reset.")]
+ [SerializeField] private int m_timeToResetMinMaxFps = 10;
+
+ [SerializeField] private Color m_goodFpsColor = new Color32(118, 212, 58, 255);
+ [SerializeField] private int m_goodFpsThreshold = 60;
+
+ [SerializeField] private Color m_cautionFpsColor = new Color32(243, 232, 0, 255);
+ [SerializeField] private int m_cautionFpsThreshold = 30;
+
+ [SerializeField] private Color m_criticalFpsColor = new Color32(220, 41, 30, 255);
+
+ [Range(10, 300)]
+ [SerializeField] private int m_fpsGraphResolution = 150;
+
+ [Range(1, 200)]
+ [SerializeField] private int m_fpsTextUpdateRate = 3; // 3 updates per sec.
+
+ // Ram ---------------------------------------------------------------------------
+
+ [SerializeField] private ModuleState m_ramModuleState = ModuleState.FULL;
+
+ [SerializeField] private Color m_allocatedRamColor = new Color32(255, 190, 60, 255);
+ [SerializeField] private Color m_reservedRamColor = new Color32(205, 84, 229, 255);
+ [SerializeField] private Color m_monoRamColor = new Color(0.3f, 0.65f, 1f, 1);
+
+ [Range(10, 300)]
+ [SerializeField] private int m_ramGraphResolution = 150;
+
+
+ [Range(1, 200)]
+ [SerializeField] private int m_ramTextUpdateRate = 3; // 3 updates per sec.
+
+ // Audio -------------------------------------------------------------------------
+
+ [SerializeField] private ModuleState m_audioModuleState = ModuleState.FULL;
+
+ [SerializeField] private LookForAudioListener m_findAudioListenerInCameraIfNull = LookForAudioListener.ON_SCENE_LOAD;
+
+ [SerializeField] private AudioListener m_audioListener = null;
+
+ [SerializeField] private Color m_audioGraphColor = Color.white;
+
+ [Range(10, 300)]
+ [SerializeField] private int m_audioGraphResolution = 81;
+
+ [Range(1, 200)]
+ [SerializeField] private int m_audioTextUpdateRate = 3; // 3 updates per sec.
+
+ [SerializeField] private FFTWindow m_FFTWindow = FFTWindow.Blackman;
+
+ [Tooltip("Must be a power of 2 and between 64-8192")]
+ [SerializeField] private int m_spectrumSize = 512;
+
+ // Advanced ----------------------------------------------------------------------
+
+ [SerializeField] private ModulePosition m_advancedModulePosition = ModulePosition.BOTTOM_LEFT;
+
+ [SerializeField] private ModuleState m_advancedModuleState = ModuleState.FULL;
+
+ #endregion
+
+ #region Variables -> Private
+
+ private bool m_initialized = false;
+ private bool m_active = true;
+ private bool m_focused = true;
+
+ private G_FpsManager m_fpsManager = null;
+ private G_RamManager m_ramManager = null;
+ private G_AudioManager m_audioManager = null;
+ private G_AdvancedData m_advancedData = null;
+
+ private G_FpsMonitor m_fpsMonitor = null;
+ private G_RamMonitor m_ramMonitor = null;
+ private G_AudioMonitor m_audioMonitor = null;
+
+ private ModulePreset m_modulePresetState = ModulePreset.FPS_BASIC_ADVANCED_FULL;
+
+ #endregion
+
+ //TODO: Maybe sort these into Get and GetSet sections.
+ #region Properties -> Public
+
+ public Mode GraphyMode { get { return m_graphyMode; }
+ set { m_graphyMode = value; UpdateAllParameters(); } }
+
+ public bool EnableOnStartup { get { return m_enableOnStartup; } }
+
+ public bool KeepAlive { get { return m_keepAlive; } }
+
+ public bool Background { get { return m_background; }
+ set { m_background = value; UpdateAllParameters(); } }
+
+ public Color BackgroundColor { get { return m_backgroundColor; }
+ set { m_backgroundColor = value; UpdateAllParameters(); } }
+
+ public ModulePosition GraphModulePosition
+ {
+ get { return m_graphModulePosition; }
+ set
+ {
+ m_graphModulePosition = value;
+ m_fpsManager .SetPosition(m_graphModulePosition);
+ m_ramManager .SetPosition(m_graphModulePosition);
+ m_audioManager .SetPosition(m_graphModulePosition);
+ }
+ }
+
+ // Fps ---------------------------------------------------------------------------
+
+ // Setters & Getters
+
+ public ModuleState FpsModuleState { get { return m_fpsModuleState; }
+ set { m_fpsModuleState = value; m_fpsManager.SetState(m_fpsModuleState); } }
+
+ public int TimeToResetMinMaxFps { get { return m_timeToResetMinMaxFps; }
+ set { m_timeToResetMinMaxFps = value; m_fpsManager.UpdateParameters(); } }
+
+ public Color GoodFPSColor { get { return m_goodFpsColor; }
+ set { m_goodFpsColor = value; m_fpsManager.UpdateParameters(); } }
+ public Color CautionFPSColor { get { return m_cautionFpsColor; }
+ set { m_cautionFpsColor = value; m_fpsManager.UpdateParameters(); } }
+ public Color CriticalFPSColor { get { return m_criticalFpsColor; }
+ set { m_criticalFpsColor = value; m_fpsManager.UpdateParameters(); } }
+
+ public int GoodFPSThreshold { get { return m_goodFpsThreshold; }
+ set { m_goodFpsThreshold = value; m_fpsManager.UpdateParameters(); } }
+ public int CautionFPSThreshold { get { return m_cautionFpsThreshold; }
+ set { m_cautionFpsThreshold = value; m_fpsManager.UpdateParameters(); } }
+
+ public int FpsGraphResolution { get { return m_fpsGraphResolution; }
+ set { m_fpsGraphResolution = value; m_fpsManager.UpdateParameters(); } }
+
+ public int FpsTextUpdateRate { get { return m_fpsTextUpdateRate; }
+ set { m_fpsTextUpdateRate = value; m_fpsManager.UpdateParameters(); } }
+
+ // Getters
+
+ public float CurrentFPS { get { return m_fpsMonitor.CurrentFPS; } }
+ public float AverageFPS { get { return m_fpsMonitor.AverageFPS; } }
+ public float MinFPS { get { return m_fpsMonitor.MinFPS; } }
+ public float MaxFPS { get { return m_fpsMonitor.MaxFPS; } }
+
+ // Ram ---------------------------------------------------------------------------
+
+ // Setters & Getters
+
+ public ModuleState RamModuleState { get { return m_ramModuleState; }
+ set { m_ramModuleState = value; m_ramManager.SetState(m_ramModuleState); } }
+
+
+ public Color AllocatedRamColor { get { return m_allocatedRamColor; }
+ set { m_allocatedRamColor = value; m_ramManager.UpdateParameters(); } }
+ public Color ReservedRamColor { get { return m_reservedRamColor; }
+ set { m_reservedRamColor = value; m_ramManager.UpdateParameters(); } }
+ public Color MonoRamColor { get { return m_monoRamColor; }
+ set { m_monoRamColor = value; m_ramManager.UpdateParameters(); } }
+
+ public int RamGraphResolution { get { return m_ramGraphResolution; }
+ set { m_ramGraphResolution = value; m_ramManager.UpdateParameters(); } }
+
+ public int RamTextUpdateRate { get { return m_ramTextUpdateRate; }
+ set { m_ramTextUpdateRate = value; m_ramManager.UpdateParameters(); } }
+
+ // Getters
+
+ public float AllocatedRam { get { return m_ramMonitor.AllocatedRam; } }
+ public float ReservedRam { get { return m_ramMonitor.ReservedRam; } }
+ public float MonoRam { get { return m_ramMonitor.MonoRam; } }
+
+ // Audio -------------------------------------------------------------------------
+
+ // Setters & Getters
+
+ public ModuleState AudioModuleState { get { return m_audioModuleState; }
+ set { m_audioModuleState = value; m_audioManager.SetState(m_audioModuleState); } }
+
+ public AudioListener AudioListener { get { return m_audioListener; }
+ set { m_audioListener = value; m_audioManager.UpdateParameters(); } }
+
+ public LookForAudioListener
+ FindAudioListenerInCameraIfNull { get { return m_findAudioListenerInCameraIfNull; }
+ set { m_findAudioListenerInCameraIfNull = value; m_audioManager.UpdateParameters(); } }
+
+ public Color AudioGraphColor { get { return m_audioGraphColor; }
+ set { m_audioGraphColor = value; m_audioManager.UpdateParameters(); } }
+
+ public int AudioGraphResolution { get { return m_audioGraphResolution; }
+ set { m_audioGraphResolution = value; m_audioManager.UpdateParameters(); } }
+
+ public int AudioTextUpdateRate { get { return m_audioTextUpdateRate; }
+ set { m_audioTextUpdateRate = value; m_audioManager.UpdateParameters(); } }
+
+ public FFTWindow FftWindow { get { return m_FFTWindow; }
+ set { m_FFTWindow = value; m_audioManager.UpdateParameters(); } }
+
+ public int SpectrumSize { get { return m_spectrumSize; }
+ set { m_spectrumSize = value; m_audioManager.UpdateParameters(); } }
+
+ // Getters
+
+ /// <summary>
+ /// Current audio spectrum from the specified AudioListener.
+ /// </summary>
+ public float[] Spectrum { get { return m_audioMonitor.Spectrum; } }
+
+ /// <summary>
+ /// Maximum DB registered in the current spectrum.
+ /// </summary>
+ public float MaxDB { get { return m_audioMonitor.MaxDB; } }
+
+
+ // Advanced ---------------------------------------------------------------------
+
+ // Setters & Getters
+
+ public ModuleState AdvancedModuleState { get { return m_advancedModuleState; }
+ set { m_advancedModuleState = value; m_advancedData.SetState(m_advancedModuleState); } }
+
+ public ModulePosition AdvancedModulePosition { get { return m_advancedModulePosition; }
+ set { m_advancedModulePosition = value; m_advancedData.SetPosition(m_advancedModulePosition); } }
+
+ #endregion
+
+ #region Methods -> Unity Callbacks
+
+ private void Start()
+ {
+ Init();
+ }
+
+ private void Update()
+ {
+ if (m_focused && m_enableHotkeys)
+ {
+ CheckForHotkeyPresses();
+ }
+ }
+
+ private void OnApplicationFocus(bool isFocused)
+ {
+ m_focused = isFocused;
+
+ if (m_initialized && isFocused)
+ {
+ RefreshAllParameters();
+ }
+ }
+
+ #endregion
+
+ #region Methods -> Public
+
+ public void SetModulePosition(ModuleType moduleType, ModulePosition modulePosition)
+ {
+ switch (moduleType)
+ {
+ case ModuleType.FPS:
+ case ModuleType.RAM:
+ case ModuleType.AUDIO:
+ m_graphModulePosition = modulePosition;
+
+ m_ramManager.SetPosition(modulePosition);
+ m_fpsManager.SetPosition(modulePosition);
+ m_audioManager.SetPosition(modulePosition);
+ break;
+
+ case ModuleType.ADVANCED:
+ m_advancedData.SetPosition(modulePosition);
+ break;
+ }
+ }
+
+ public void SetModuleMode(ModuleType moduleType, ModuleState moduleState)
+ {
+ switch (moduleType)
+ {
+ case ModuleType.FPS:
+ m_fpsManager.SetState(moduleState);
+ break;
+
+ case ModuleType.RAM:
+ m_ramManager.SetState(moduleState);
+ break;
+
+ case ModuleType.AUDIO:
+ m_audioManager.SetState(moduleState);
+ break;
+
+ case ModuleType.ADVANCED:
+ m_advancedData.SetState(moduleState);
+ break;
+ }
+ }
+
+ public void ToggleModes()
+ {
+ if ((int)m_modulePresetState >= Enum.GetNames(typeof(ModulePreset)).Length - 1)
+ {
+ m_modulePresetState = 0;
+ }
+ else
+ {
+ m_modulePresetState++;
+ }
+
+ SetPreset(m_modulePresetState);
+ }
+
+ public void SetPreset(ModulePreset modulePreset)
+ {
+ m_modulePresetState = modulePreset;
+
+ switch (m_modulePresetState)
+ {
+ case ModulePreset.FPS_BASIC:
+ m_fpsManager.SetState(ModuleState.BASIC);
+ m_ramManager.SetState(ModuleState.OFF);
+ m_audioManager.SetState(ModuleState.OFF);
+ m_advancedData.SetState(ModuleState.OFF);
+ break;
+
+ case ModulePreset.FPS_TEXT:
+ m_fpsManager.SetState(ModuleState.TEXT);
+ m_ramManager.SetState(ModuleState.OFF);
+ m_audioManager.SetState(ModuleState.OFF);
+ m_advancedData.SetState(ModuleState.OFF);
+ break;
+
+ case ModulePreset.FPS_FULL:
+ m_fpsManager.SetState(ModuleState.FULL);
+ m_ramManager.SetState(ModuleState.OFF);
+ m_audioManager.SetState(ModuleState.OFF);
+ m_advancedData.SetState(ModuleState.OFF);
+ break;
+
+ case ModulePreset.FPS_TEXT_RAM_TEXT:
+ m_fpsManager.SetState(ModuleState.TEXT);
+ m_ramManager.SetState(ModuleState.TEXT);
+ m_audioManager.SetState(ModuleState.OFF);
+ m_advancedData.SetState(ModuleState.OFF);
+ break;
+
+ case ModulePreset.FPS_FULL_RAM_TEXT:
+ m_fpsManager.SetState(ModuleState.FULL);
+ m_ramManager.SetState(ModuleState.TEXT);
+ m_audioManager.SetState(ModuleState.OFF);
+ m_advancedData.SetState(ModuleState.OFF);
+ break;
+
+ case ModulePreset.FPS_FULL_RAM_FULL:
+ m_fpsManager.SetState(ModuleState.FULL);
+ m_ramManager.SetState(ModuleState.FULL);
+ m_audioManager.SetState(ModuleState.OFF);
+ m_advancedData.SetState(ModuleState.OFF);
+ break;
+
+ case ModulePreset.FPS_TEXT_RAM_TEXT_AUDIO_TEXT:
+ m_fpsManager.SetState(ModuleState.TEXT);
+ m_ramManager.SetState(ModuleState.TEXT);
+ m_audioManager.SetState(ModuleState.TEXT);
+ m_advancedData.SetState(ModuleState.OFF);
+ break;
+
+ case ModulePreset.FPS_FULL_RAM_TEXT_AUDIO_TEXT:
+ m_fpsManager.SetState(ModuleState.FULL);
+ m_ramManager.SetState(ModuleState.TEXT);
+ m_audioManager.SetState(ModuleState.TEXT);
+ m_advancedData.SetState(ModuleState.OFF);
+ break;
+
+ case ModulePreset.FPS_FULL_RAM_FULL_AUDIO_TEXT:
+ m_fpsManager.SetState(ModuleState.FULL);
+ m_ramManager.SetState(ModuleState.FULL);
+ m_audioManager.SetState(ModuleState.TEXT);
+ m_advancedData.SetState(ModuleState.OFF);
+ break;
+
+ case ModulePreset.FPS_FULL_RAM_FULL_AUDIO_FULL:
+ m_fpsManager.SetState(ModuleState.FULL);
+ m_ramManager.SetState(ModuleState.FULL);
+ m_audioManager.SetState(ModuleState.FULL);
+ m_advancedData.SetState(ModuleState.OFF);
+ break;
+
+ case ModulePreset.FPS_FULL_RAM_FULL_AUDIO_FULL_ADVANCED_FULL:
+ m_fpsManager.SetState(ModuleState.FULL);
+ m_ramManager.SetState(ModuleState.FULL);
+ m_audioManager.SetState(ModuleState.FULL);
+ m_advancedData.SetState(ModuleState.FULL);
+ break;
+
+ case ModulePreset.FPS_BASIC_ADVANCED_FULL:
+ m_fpsManager.SetState(ModuleState.BASIC);
+ m_ramManager.SetState(ModuleState.OFF);
+ m_audioManager.SetState(ModuleState.OFF);
+ m_advancedData.SetState(ModuleState.FULL);
+ break;
+
+ default:
+ //throw new ArgumentOutOfRangeException();
+ break;
+ }
+ }
+
+ public void ToggleActive()
+ {
+ if (!m_active)
+ {
+ Enable();
+ }
+ else
+ {
+ Disable();
+ }
+ }
+
+ public void Enable()
+ {
+ m_fpsManager .RestorePreviousState();
+ m_ramManager .RestorePreviousState();
+ m_audioManager .RestorePreviousState();
+ m_advancedData .RestorePreviousState();
+
+ m_active = true;
+ }
+
+ public void Disable()
+ {
+ m_fpsManager .SetState(ModuleState.OFF);
+ m_ramManager .SetState(ModuleState.OFF);
+ m_audioManager .SetState(ModuleState.OFF);
+ m_advancedData .SetState(ModuleState.OFF);
+
+ m_active = false;
+ }
+
+ #endregion
+
+ #region Methods -> Private
+
+ private void Init()
+ {
+ if (m_keepAlive)
+ {
+ DontDestroyOnLoad(transform.root.gameObject);
+ }
+
+ m_fpsMonitor = GetComponentInChildren(typeof(G_FpsMonitor), true) as G_FpsMonitor;
+ m_ramMonitor = GetComponentInChildren(typeof(G_RamMonitor), true) as G_RamMonitor;
+ m_audioMonitor = GetComponentInChildren(typeof(G_AudioMonitor), true) as G_AudioMonitor;
+
+ m_fpsManager = GetComponentInChildren(typeof(G_FpsManager), true) as G_FpsManager;
+ m_ramManager = GetComponentInChildren(typeof(G_RamManager), true) as G_RamManager;
+ m_audioManager = GetComponentInChildren(typeof(G_AudioManager), true) as G_AudioManager;
+ m_advancedData = GetComponentInChildren(typeof(G_AdvancedData), true) as G_AdvancedData;
+
+ m_fpsManager .SetPosition(m_graphModulePosition);
+ m_ramManager .SetPosition(m_graphModulePosition);
+ m_audioManager .SetPosition(m_graphModulePosition);
+ m_advancedData .SetPosition(m_advancedModulePosition);
+
+ m_fpsManager .SetState (m_fpsModuleState);
+ m_ramManager .SetState (m_ramModuleState);
+ m_audioManager .SetState (m_audioModuleState);
+ m_advancedData .SetState (m_advancedModuleState);
+
+ if (!m_enableOnStartup)
+ {
+ ToggleActive();
+
+ // We need to enable this on startup because we disable it in GraphyManagerEditor
+ GetComponent<Canvas>().enabled = true;
+ }
+
+ m_initialized = true;
+ }
+
+ private void CheckForHotkeyPresses()
+ {
+ // Toggle Mode ---------------------------------------
+
+ if (m_toggleModeCtrl && m_toggleModeAlt)
+ {
+ if (CheckFor3KeyPress(m_toggleModeKeyCode, KeyCode.LeftControl, KeyCode.LeftAlt)
+ || CheckFor3KeyPress(m_toggleModeKeyCode, KeyCode.RightControl, KeyCode.LeftAlt)
+ || CheckFor3KeyPress(m_toggleModeKeyCode, KeyCode.RightControl, KeyCode.RightAlt)
+ || CheckFor3KeyPress(m_toggleModeKeyCode, KeyCode.LeftControl, KeyCode.RightAlt))
+ {
+ ToggleModes();
+ }
+ }
+ else if (m_toggleModeCtrl)
+ {
+ if ( CheckFor2KeyPress(m_toggleModeKeyCode, KeyCode.LeftControl)
+ || CheckFor2KeyPress(m_toggleModeKeyCode, KeyCode.RightControl))
+ {
+ ToggleModes();
+ }
+ }
+ else if (m_toggleModeAlt)
+ {
+ if ( CheckFor2KeyPress(m_toggleModeKeyCode, KeyCode.LeftAlt)
+ || CheckFor2KeyPress(m_toggleModeKeyCode, KeyCode.RightAlt))
+ {
+ ToggleModes();
+ }
+ }
+ else
+ {
+ if (CheckFor1KeyPress(m_toggleModeKeyCode))
+ {
+ ToggleModes();
+ }
+ }
+
+ // Toggle Active ---------------------------------------
+
+ if (m_toggleActiveCtrl && m_toggleActiveAlt)
+ {
+ if ( CheckFor3KeyPress(m_toggleActiveKeyCode, KeyCode.LeftControl, KeyCode.LeftAlt)
+ || CheckFor3KeyPress(m_toggleActiveKeyCode, KeyCode.RightControl, KeyCode.LeftAlt)
+ || CheckFor3KeyPress(m_toggleActiveKeyCode, KeyCode.RightControl, KeyCode.RightAlt)
+ || CheckFor3KeyPress(m_toggleActiveKeyCode, KeyCode.LeftControl, KeyCode.RightAlt))
+ {
+ ToggleActive();
+ }
+ }
+
+ else if (m_toggleActiveCtrl)
+ {
+ if ( CheckFor2KeyPress(m_toggleActiveKeyCode, KeyCode.LeftControl)
+ || CheckFor2KeyPress(m_toggleActiveKeyCode, KeyCode.RightControl))
+ {
+ ToggleActive();
+ }
+ }
+ else if (m_toggleActiveAlt)
+ {
+ if ( CheckFor2KeyPress(m_toggleActiveKeyCode, KeyCode.LeftAlt)
+ || CheckFor2KeyPress(m_toggleActiveKeyCode, KeyCode.RightAlt))
+ {
+ ToggleActive();
+ }
+ }
+ else
+ {
+ if (CheckFor1KeyPress(m_toggleActiveKeyCode))
+ {
+ ToggleActive();
+ }
+ }
+ }
+
+ private bool CheckFor1KeyPress(KeyCode key)
+ {
+ return Input.GetKeyDown(key);
+ }
+
+ private bool CheckFor2KeyPress(KeyCode key1, KeyCode key2)
+ {
+ return Input.GetKeyDown(key1) && Input.GetKey(key2)
+ || Input.GetKeyDown(key2) && Input.GetKey(key1);
+ }
+
+ private bool CheckFor3KeyPress(KeyCode key1, KeyCode key2, KeyCode key3)
+ {
+ return Input.GetKeyDown(key1) && Input.GetKey(key2) && Input.GetKey(key3)
+ || Input.GetKeyDown(key2) && Input.GetKey(key1) && Input.GetKey(key3)
+ || Input.GetKeyDown(key3) && Input.GetKey(key1) && Input.GetKey(key2);
+ }
+
+ private void UpdateAllParameters()
+ {
+ m_fpsManager .UpdateParameters();
+ m_ramManager .UpdateParameters();
+ m_audioManager .UpdateParameters();
+ m_advancedData .UpdateParameters();
+ }
+
+ private void RefreshAllParameters()
+ {
+ m_fpsManager .RefreshParameters();
+ m_ramManager .RefreshParameters();
+ m_audioManager .RefreshParameters();
+ m_advancedData .RefreshParameters();
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/GraphyManager.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/GraphyManager.cs.meta
new file mode 100644
index 0000000..60f3d7f
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/GraphyManager.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: c80e6d63202cef44ca3ffdaccec693be
+timeCreated: 1512508924
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram.meta
new file mode 100644
index 0000000..84e1441
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 839df5cf44c5c6f43b1a846e73f3e498
+folderAsset: yes
+timeCreated: 1513377097
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamGraph.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamGraph.cs
new file mode 100644
index 0000000..94083f5
--- /dev/null
+++ b/Assets/Thirdparty/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/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamGraph.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamGraph.cs.meta
new file mode 100644
index 0000000..fa2cde1
--- /dev/null
+++ b/Assets/Thirdparty/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/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamManager.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamManager.cs
new file mode 100644
index 0000000..6e3bbbc
--- /dev/null
+++ b/Assets/Thirdparty/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/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamManager.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamManager.cs.meta
new file mode 100644
index 0000000..6d52479
--- /dev/null
+++ b/Assets/Thirdparty/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/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamMonitor.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamMonitor.cs
new file mode 100644
index 0000000..6bd83aa
--- /dev/null
+++ b/Assets/Thirdparty/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/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamMonitor.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamMonitor.cs.meta
new file mode 100644
index 0000000..757e2b9
--- /dev/null
+++ b/Assets/Thirdparty/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/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamText.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamText.cs
new file mode 100644
index 0000000..baf43d2
--- /dev/null
+++ b/Assets/Thirdparty/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/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamText.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Ram/G_RamText.cs.meta
new file mode 100644
index 0000000..42227bd
--- /dev/null
+++ b/Assets/Thirdparty/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:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Shader.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Shader.meta
new file mode 100644
index 0000000..404c57e
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Shader.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 6d11ec87c6db49d40af874a49810f377
+folderAsset: yes
+timeCreated: 1513377085
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Shader/G_GraphShader.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Shader/G_GraphShader.cs
new file mode 100644
index 0000000..8d90457
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Shader/G_GraphShader.cs
@@ -0,0 +1,154 @@
+/* ---------------------------------------
+ * Author: Martin Pane (martintayx@gmail.com) (@tayx94)
+ * Collaborators: Lars Aalbertsen (@Rockylars)
+ * Project: Graphy - Ultimate Stats Monitor
+ * Date: 22-Nov-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;
+
+namespace Tayx.Graphy
+{
+ /// <summary>
+ /// This class communicates directly with the shader to draw the graphs. Performance here is of upmost importance
+ /// to reduce as much overhead as possible, as we are updating hundreds of values every frame.
+ /// </summary>
+ public class G_GraphShader
+ {
+ /* ----- TODO: ----------------------------
+ * Add summaries to the variables.
+ * --------------------------------------*/
+
+ #region Variables -> Array
+
+ public const int ArrayMaxSizeFull = 512;
+ public const int ArrayMaxSizeLight = 128;
+
+ public int ArrayMaxSize = 128;
+
+ public float[] Array; // The values
+
+ #endregion
+
+ #region Variables -> Image
+
+ public Image Image = null;
+
+ #endregion
+
+ #region Variables -> Name
+
+ private string Name = "GraphValues"; // The name of the array
+ private string Name_Length = "GraphValues_Length";
+
+ #endregion
+
+ #region Variables -> Average
+
+ public float Average = 0;
+ private int averagePropertyId = 0;
+
+ #endregion
+
+ #region Variables -> Thresholds
+
+ public float GoodThreshold = 0;
+ public float CautionThreshold = 0;
+
+ private int goodThresholdPropertyId = 0;
+ private int cautionThresholdPropertyId = 0;
+
+ #endregion
+
+ #region Variables -> Color
+
+ public Color GoodColor = Color.white;
+ public Color CautionColor = Color.white;
+ public Color CriticalColor = Color.white;
+
+ private int goodColorPropertyId = 0;
+ private int cautionColorPropertyId = 0;
+ private int criticalColorPropertyId = 0;
+
+ #endregion
+
+ #region Methods -> Public
+
+ /// <summary>
+ /// This is done to avoid a design problem that arrays in shaders have,
+ /// and should be called before initializing any shader graph.
+ /// The first time that you use initialize an array, the size of the array in the shader is fixed.
+ /// This is why sometimes you will get a warning saying that the array size will be capped.
+ /// It shouldn't generate any issues, but in the worst case scenario just reset the Unity Editor
+ /// (if for some reason the shaders reload).
+ /// I also cache the Property IDs, that make access faster to modify shader parameters.
+ /// </summary>
+ public void InitializeShader()
+ {
+ Image.material.SetFloatArray(Name, new float[ArrayMaxSize]);
+
+ averagePropertyId = Shader.PropertyToID("Average");
+
+ goodThresholdPropertyId = Shader.PropertyToID("_GoodThreshold");
+ cautionThresholdPropertyId = Shader.PropertyToID("_CautionThreshold");
+
+ goodColorPropertyId = Shader.PropertyToID("_GoodColor");
+ cautionColorPropertyId = Shader.PropertyToID("_CautionColor");
+ criticalColorPropertyId = Shader.PropertyToID("_CriticalColor");
+ }
+
+ /// <summary>
+ /// Updates the material linked with this shader graph with the values in the float[] array.
+ /// </summary>
+ public void UpdateArray()
+ {
+ Image.material.SetInt(Name_Length, Array.Length);
+ }
+
+ /// <summary>
+ /// Updates the average parameter in the material.
+ /// </summary>
+ public void UpdateAverage()
+ {
+ Image.material.SetFloat(averagePropertyId, Average);
+ }
+
+ /// <summary>
+ /// Updates the thresholds in the material.
+ /// </summary>
+ public void UpdateThresholds()
+ {
+ Image.material.SetFloat(goodThresholdPropertyId, GoodThreshold);
+ Image.material.SetFloat(cautionThresholdPropertyId, CautionThreshold);
+ }
+
+ /// <summary>
+ /// Updates the colors in the material.
+ /// </summary>
+ public void UpdateColors()
+ {
+ Image.material.SetColor(goodColorPropertyId, GoodColor);
+ Image.material.SetColor(cautionColorPropertyId, CautionColor);
+ Image.material.SetColor(criticalColorPropertyId, CriticalColor);
+ }
+
+ /// <summary>
+ /// Updates the points in the graph with the set array of values.
+ /// </summary>
+ public void UpdatePoints()
+ {
+ // Requires an array called "name"
+ // and another one called "name_Length"
+
+ Image.material.SetFloatArray(Name, Array);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Shader/G_GraphShader.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Shader/G_GraphShader.cs.meta
new file mode 100644
index 0000000..b598f4c
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Shader/G_GraphShader.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 0ddb605ced1369e409812b4f405221cd
+timeCreated: 1511903341
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/UI.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/UI.meta
new file mode 100644
index 0000000..d38fd4c
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/UI.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: a6a45022ef0b3654a9d036efed540b32
+folderAsset: yes
+timeCreated: 1514998503
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/UI/IModifiableState.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/UI/IModifiableState.cs
new file mode 100644
index 0000000..44bc7f5
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/UI/IModifiableState.cs
@@ -0,0 +1,28 @@
+/* ---------------------------------------
+ * 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!
+ * -------------------------------------*/
+
+namespace Tayx.Graphy.UI
+{
+ public interface IModifiableState
+ {
+ /* ----- TODO: ----------------------------
+ * --------------------------------------*/
+
+ /// <summary>
+ /// Set the module state.
+ /// </summary>
+ /// <param name="newState">
+ /// The new state.
+ /// </param>
+ void SetState(GraphyManager.ModuleState newState, bool silentUpdate);
+ }
+
+}
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/UI/IModifiableState.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/UI/IModifiableState.cs.meta
new file mode 100644
index 0000000..2de655d
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/UI/IModifiableState.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: cbc1852edf51f8046aed2f13ea532ea9
+timeCreated: 1514998527
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/UI/IMovable.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/UI/IMovable.cs
new file mode 100644
index 0000000..569d28c
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/UI/IMovable.cs
@@ -0,0 +1,30 @@
+/* ---------------------------------------
+ * 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!
+ * -------------------------------------*/
+
+namespace Tayx.Graphy.UI
+{
+ public interface IMovable
+ {
+ /* ----- TODO: ----------------------------
+ *
+ * --------------------------------------*/
+
+ /// <summary>
+ /// Sets the position of the module.
+ /// </summary>
+ /// <param name="newModulePosition">
+ /// The new position of the module.
+ /// </param>
+ void SetPosition(GraphyManager.ModulePosition newModulePosition);
+ }
+
+}
+
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/UI/IMovable.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/UI/IMovable.cs.meta
new file mode 100644
index 0000000..a850fd7
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/UI/IMovable.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 8a935302390075f45843775173889f94
+timeCreated: 1514998535
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util.meta
new file mode 100644
index 0000000..8919c97
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 931159fac06489e4aac42c90c50e8598
+folderAsset: yes
+timeCreated: 1512413960
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_ExtensionMethods.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_ExtensionMethods.cs
new file mode 100644
index 0000000..4580cc1
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_ExtensionMethods.cs
@@ -0,0 +1,67 @@
+/* ---------------------------------------
+ * Author: Martin Pane (martintayx@gmail.com) (@tayx94)
+ * Collaborators: Lars Aalbertsen (@Rockylars)
+ * Project: Graphy - Ultimate Stats Monitor
+ * Date: 04-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 UnityEngine.UI;
+
+namespace Tayx.Graphy.Utils
+{
+ public static class G_ExtensionMethods
+ {
+ /* ----- TODO: ----------------------------
+ * Add summaries to the functions.
+ * --------------------------------------*/
+
+ #region Methods -> Extension Methods
+
+ /// <summary>
+ /// Functions as the SetActive function in the GameObject class, but for a list of them.
+ /// </summary>
+ /// <param name="gameObjects">
+ /// List of GameObjects.
+ /// </param>
+ /// <param name="active">
+ /// Wether to turn them on or off.
+ /// </param>
+ public static List<GameObject> SetAllActive(this List<GameObject> gameObjects, bool active)
+ {
+ foreach (var gameObj in gameObjects)
+ {
+ gameObj.SetActive(active);
+ }
+
+ return gameObjects;
+ }
+
+ public static List<Image> SetOneActive(this List<Image> images, int active)
+ {
+ for (int i = 0; i < images.Count; i++)
+ {
+ images[i].gameObject.SetActive(i == active);
+ }
+
+ return images;
+ }
+
+ public static List<Image> SetAllActive(this List<Image> images, bool active)
+ {
+ foreach (var image in images)
+ {
+ image.gameObject.SetActive(active);
+ }
+
+ return images;
+ }
+
+ #endregion
+ }
+}
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_ExtensionMethods.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_ExtensionMethods.cs.meta
new file mode 100644
index 0000000..2b0b2e8
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_ExtensionMethods.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 5aef4337f2241ec4d9a2ea5883fd1828
+timeCreated: 1515099756
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_FloatString.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_FloatString.cs
new file mode 100644
index 0000000..9a112d6
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_FloatString.cs
@@ -0,0 +1,232 @@
+/* ---------------------------------------
+ * Author: Started by David Mkrtchyan, modified by Martin Pane (martintayx@gmail.com) (@tayx94)
+ * Collaborators: Lars Aalbertsen (@Rockylars)
+ * Project: Graphy - Ultimate Stats Monitor
+ * Date: 18-May-18
+ * Studio: Tayx
+ *
+ * This project is released under the MIT license.
+ * Attribution is not required, but it is always welcomed!
+ * -------------------------------------*/
+
+using UnityEngine;
+
+namespace Tayx.Graphy.Utils.NumString
+{
+ public static class G_FloatString
+ {
+ /* ----- TODO: ----------------------------
+ * Try and move the Init to a core method.
+ * Try and replace the Pow function with a better algorithm.
+ * --------------------------------------*/
+
+ #region Variables -> Private
+
+ /// <summary>
+ /// Float represented as a string, formatted.
+ /// </summary>
+ private const string floatFormat = "0.0";
+
+ /// <summary>
+ /// The currently defined, globally used decimal multiplier.
+ /// </summary>
+ private static float decimalMultiplier = 1f;
+
+ /// <summary>
+ /// List of negative floats casted to strings.
+ /// </summary>
+ private static string[] negativeBuffer = new string[0];
+
+ /// <summary>
+ /// List of positive floats casted to strings.
+ /// </summary>
+ private static string[] positiveBuffer = new string[0];
+
+ #endregion
+
+ #region Properties -> Public
+
+ /// <summary>
+ /// Have the int buffers been initialized?
+ /// </summary>
+ public static bool Inited
+ {
+ get
+ {
+ return negativeBuffer.Length > 0 || positiveBuffer.Length > 0;
+ }
+ }
+
+ /// <summary>
+ /// The lowest float value of the existing number buffer.
+ /// </summary>
+ public static float MinValue
+ {
+ get
+ {
+ return -(negativeBuffer.Length - 1).FromIndex();
+ }
+ }
+
+ /// <summary>
+ /// The highest float value of the existing number buffer.
+ /// </summary>
+ public static float MaxValue
+ {
+ get
+ {
+ return (positiveBuffer.Length - 1).FromIndex();
+ }
+ }
+
+ #endregion
+
+ #region Methods -> Public
+
+ //TODO: Figure out what the negative buffer doe, why we dont have default values and why the range is so high.
+ /// <summary>
+ /// Initialize the buffers.
+ /// </summary>
+ /// <param name="minNegativeValue">
+ /// Lowest negative value allowed.
+ /// </param>
+ /// <param name="maxPositiveValue">
+ /// Highest positive value allowed.
+ /// </param>
+ /// <param name="decimals">
+ /// How many decimals will the values use?
+ /// </param>
+ public static void Init(float minNegativeValue, float maxPositiveValue, int decimals = 1)
+ {
+ decimalMultiplier = Pow(10, Mathf.Clamp(decimals, 1, 5));
+
+ int negativeLength = minNegativeValue.ToIndex();
+ int positiveLength = maxPositiveValue.ToIndex();
+
+ if (negativeLength >= 0)
+ {
+ negativeBuffer = new string[negativeLength];
+ for (int i = 0; i < negativeLength; i++)
+ {
+ negativeBuffer[i] = (-i).FromIndex().ToString(floatFormat);
+ }
+ }
+
+ if (positiveLength >= 0)
+ {
+ positiveBuffer = new string[positiveLength];
+ for (int i = 0; i < positiveLength; i++)
+ {
+ positiveBuffer[i] = i.FromIndex().ToString(floatFormat);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Returns this float as a cached string.
+ /// </summary>
+ /// <param name="value">
+ /// The required float.
+ /// </param>
+ /// <returns>
+ /// A cached number string.
+ /// </returns>
+ public static string ToStringNonAlloc(this float value)
+ {
+ int valIndex = value.ToIndex();
+
+ if (value < 0 && valIndex < negativeBuffer.Length)
+ {
+ return negativeBuffer[valIndex];
+ }
+
+ if (value >= 0 && valIndex < positiveBuffer.Length)
+ {
+ return positiveBuffer[valIndex];
+ }
+
+ return value.ToString();
+ }
+
+ //TODO: Convert this to use floatFormat instead, but investigate which functions require and dont require one first.
+ /// <summary>
+ /// Returns this float as a cached string.
+ /// </summary>
+ /// <param name="value">
+ /// The required float.
+ /// </param>
+ /// <returns>
+ /// A cached number string.
+ /// </returns>
+ public static string ToStringNonAlloc(this float value, string format)
+ {
+ int valIndex = value.ToIndex();
+
+ if (value < 0 && valIndex < negativeBuffer.Length)
+ {
+ return negativeBuffer[valIndex];
+ }
+
+ if (value >= 0 && valIndex < positiveBuffer.Length)
+ {
+ return positiveBuffer[valIndex];
+ }
+
+ return value.ToString(format);
+ }
+
+ /// <summary>
+ /// Returns a float as a casted int.
+ /// </summary>
+ /// <param name="f">
+ /// The given float.
+ /// </param>
+ /// <returns>
+ /// The given float as an int.
+ /// </returns>
+ public static int ToInt(this float f)
+ {
+ return (int)f;
+ }
+
+ /// <summary>
+ /// Returns an int as a casted float.
+ /// </summary>
+ /// <param name="f">
+ /// The given int.
+ /// </param>
+ /// <returns>
+ /// The given int as a float.
+ /// </returns>
+ public static float ToFloat(this int i)
+ {
+ return (float)i;
+ }
+
+ #endregion
+
+ #region Methods -> Private
+
+ //TODO: Replace this with a better algorithm.
+ private static int Pow(int f, int p)
+ {
+ for (int i = 1; i < p; i++)
+ {
+ f *= f;
+ }
+ return f;
+ }
+
+ private static int ToIndex(this float f)
+ {
+ return Mathf.Abs((f * decimalMultiplier).ToInt());
+ }
+
+ private static float FromIndex(this int i)
+ {
+ return (i.ToFloat() / decimalMultiplier);
+ }
+
+ #endregion
+ }
+}
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_FloatString.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_FloatString.cs.meta
new file mode 100644
index 0000000..fc8daa2
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_FloatString.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: c7eaf0f83a3530240a97ac1c51d6f2e6
+timeCreated: 1538651101
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_Intstring.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_Intstring.cs
new file mode 100644
index 0000000..e1c7041
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_Intstring.cs
@@ -0,0 +1,131 @@
+/* ---------------------------------------
+ * Author: Started by David Mkrtchyan, modified by Martin Pane (martintayx@gmail.com) (@tayx94)
+ * Collaborators: Lars Aalbertsen (@Rockylars)
+ * Project: Graphy - Ultimate Stats Monitor
+ * Date: 18-May-18
+ * Studio: Tayx
+ *
+ * This project is released under the MIT license.
+ * Attribution is not required, but it is always welcomed!
+ * -------------------------------------*/
+
+using UnityEngine;
+
+namespace Tayx.Graphy.Utils.NumString
+{
+ public static class G_IntString
+ {
+ /* ----- TODO: ----------------------------
+ * Try and move the Init to a core method.
+ * --------------------------------------*/
+
+ #region Variables -> Private
+
+ /// <summary>
+ /// List of negative ints casted to strings.
+ /// </summary>
+ private static string[] negativeBuffer = new string[0];
+
+ /// <summary>
+ /// List of positive ints casted to strings.
+ /// </summary>
+ private static string[] positiveBuffer = new string[0];
+
+ #endregion
+
+ #region Properties -> Public
+
+ /// <summary>
+ /// Have the int buffers been initialized?
+ /// </summary>
+ public static bool Inited
+ {
+ get
+ {
+ return negativeBuffer.Length > 0 || positiveBuffer.Length > 0;
+ }
+ }
+
+ /// <summary>
+ /// The lowest int value of the existing number buffer.
+ /// </summary>
+ public static int MinValue
+ {
+ get
+ {
+ return -(negativeBuffer.Length - 1);
+ }
+ }
+
+ /// <summary>
+ /// The highest int value of the existing number buffer.
+ /// </summary>
+ public static int MaxValue
+ {
+ get
+ {
+ return positiveBuffer.Length - 1;
+ }
+ }
+
+ #endregion
+
+ #region Methods -> Public
+
+ /// <summary>
+ /// Initialize the buffers.
+ /// </summary>
+ /// <param name="minNegativeValue">
+ /// Lowest negative value allowed.
+ /// </param>
+ /// <param name="maxPositiveValue">
+ /// Highest positive value allowed.
+ /// </param>
+ public static void Init(int minNegativeValue, int maxPositiveValue)
+ {
+ if (minNegativeValue <= 0)
+ {
+ int length = Mathf.Abs(minNegativeValue);
+ negativeBuffer = new string[length];
+ for (int i = 0; i < length; i++)
+ {
+ negativeBuffer[i] = (-i).ToString();
+ }
+ }
+ if (maxPositiveValue >= 0)
+ {
+ positiveBuffer = new string[maxPositiveValue];
+ for (int i = 0; i < maxPositiveValue; i++)
+ {
+ positiveBuffer[i] = i.ToString();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Returns this int as a cached string.
+ /// </summary>
+ /// <param name="value">
+ /// The required int.
+ /// </param>
+ /// <returns>
+ /// A cached number string.
+ /// </returns>
+ public static string ToStringNonAlloc(this int value)
+ {
+ if (value < 0 && -value < negativeBuffer.Length)
+ {
+ return negativeBuffer[-value];
+ }
+
+ if (value >= 0 && value < positiveBuffer.Length)
+ {
+ return positiveBuffer[value];
+ }
+
+ return value.ToString();
+ }
+
+ #endregion
+ }
+}
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_Intstring.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_Intstring.cs.meta
new file mode 100644
index 0000000..9852448
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_Intstring.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 2584aec3ab9f9af49bbdb1477908274e
+timeCreated: 1526634575
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_Singleton.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_Singleton.cs
new file mode 100644
index 0000000..89bc3a6
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_Singleton.cs
@@ -0,0 +1,135 @@
+/* ---------------------------------------
+ * Sourced from: https://wiki.unity3d.com/index.php/Singleton
+ * Modified by: Martín Pane (martintayx@gmail.com) (@tayx94)
+ * Collaborators: Lars Aalbertsen (@Rockylars)
+ * Project: Graphy - Ultimate Stats Monitor
+ * Date: 07-Jul-17
+ * Studio: Tayx
+ *
+ * This project is released under the MIT license.
+ * Attribution is not required, but it is always welcomed!
+ * -------------------------------------*/
+
+using UnityEngine;
+
+namespace Tayx.Graphy.Utils
+{
+ /// <summary>
+ /// Be aware this will not prevent a non singleton constructor
+ /// such as `T myT = new T();`
+ /// To prevent that, add `protected T () {}` to your singleton class.
+ ///
+ /// As a note, this is made as MonoBehaviour because we need Coroutines.
+ /// </summary>
+ public class G_Singleton<T> : MonoBehaviour where T : MonoBehaviour
+ {
+ /* ----- TODO: ----------------------------
+ * Check if we can seal this class.
+ * Add summaries to the variables.
+ * Add summaries to the functions.
+ * Check if we should add "private" to the Unity Callbacks.
+ * Fill in the missing date and author.
+ * --------------------------------------*/
+
+ #region Variables -> Private
+
+ private static T _instance;
+
+ private static object _lock = new object();
+
+ #endregion
+
+ #region Properties -> Public
+
+ public static T Instance
+ {
+ get
+ {
+
+ if (_applicationIsQuitting)
+ {
+ //Debug.LogWarning("[Singleton] Instance '" + typeof(T) +
+ // "' already destroyed on application quit." +
+ // " Won't create again - returning null.");
+ return null;
+ }
+
+ lock (_lock)
+ {
+ if (_instance == null)
+ {
+ _instance = (T)FindObjectOfType(typeof(T));
+
+ if (FindObjectsOfType(typeof(T)).Length > 1)
+ {
+ //Debug.LogError("[Singleton] Something went really wrong " +
+ // " - there should never be more than 1 singleton!" +
+ // " Reopening the scene might fix it.");
+ return _instance;
+ }
+
+ if (_instance == null)
+ {
+ //GameObject singleton = new GameObject();
+ //_instance = singleton.AddComponent<T>();
+ //singleton.name = "(singleton) " + typeof(T).ToString();
+
+ //DontDestroyOnLoad(singleton);
+
+ //Debug.Log("[Singleton] An instance of " + typeof(T) +
+ // " is needed in the scene, so '" + singleton +
+ // "' was created with DontDestroyOnLoad.");
+
+ Debug.Log
+ (
+ "[Singleton] An instance of " + typeof(T) +
+ " is trying to be accessed, but it wasn't initialized first. " +
+ "Make sure to add an instance of " + typeof(T) + " in the scene before " +
+ " trying to access it."
+ );
+ }
+ else
+ {
+ //Debug.Log("[Singleton] Using instance already created: " +
+ // _instance.gameObject.name);
+ }
+ }
+
+ return _instance;
+ }
+ }
+ }
+
+ #endregion
+
+ #region Methods -> Unity Callbacks
+
+ void Awake()
+ {
+ if (_instance != null)
+ {
+ Destroy(gameObject);
+ }
+ else
+ {
+ _instance = GetComponent<T>();
+ }
+ }
+
+ private static bool _applicationIsQuitting = false;
+ /// <summary>
+ /// When Unity quits, it destroys objects in a random order.
+ /// In principle, a Singleton is only destroyed when application quits.
+ /// If any script calls Instance after it has been destroyed,
+ /// it will create a buggy ghost object that will stay on the Editor scene
+ /// even after stopping playing the Application. Really bad!
+ /// So, this was made to be sure we're not creating that buggy ghost object.
+ /// </summary>
+ void OnDestroy()
+ {
+ _applicationIsQuitting = true;
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_Singleton.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_Singleton.cs.meta
new file mode 100644
index 0000000..1043fb6
--- /dev/null
+++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_Singleton.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: dbf324bd9d0eaf7408f3b72ed03e2588
+timeCreated: 1512413989
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: