From 3af4c218c0e70167db23a6303d2af30aff37d2fe Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Thu, 20 Aug 2020 23:40:50 -0400 Subject: Removed a bunch of stuff; Changes --- .../Scene/Customization Scripts/CustomizeGraphy.cs | 468 +++++++++++++++++++++ .../Customization Scripts/CustomizeGraphy.cs.meta | 12 + .../ForceSliderToMultipleOf3.cs | 61 +++ .../ForceSliderToMultipleOf3.cs.meta | 12 + .../Customization Scripts/ForceSliderToPowerOf2.cs | 85 ++++ .../ForceSliderToPowerOf2.cs.meta | 12 + .../UpdateTextWithSliderValue.cs | 62 +++ .../UpdateTextWithSliderValue.cs.meta | 12 + 8 files changed, 724 insertions(+) create mode 100644 Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/CustomizeGraphy.cs create mode 100644 Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/CustomizeGraphy.cs.meta create mode 100644 Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/ForceSliderToMultipleOf3.cs create mode 100644 Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/ForceSliderToMultipleOf3.cs.meta create mode 100644 Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/ForceSliderToPowerOf2.cs create mode 100644 Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/ForceSliderToPowerOf2.cs.meta create mode 100644 Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/UpdateTextWithSliderValue.cs create mode 100644 Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/UpdateTextWithSliderValue.cs.meta (limited to 'Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts') diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/CustomizeGraphy.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/CustomizeGraphy.cs new file mode 100644 index 0000000..f02f67c --- /dev/null +++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/CustomizeGraphy.cs @@ -0,0 +1,468 @@ +/* --------------------------------------- + * Author: Martin Pane (martintayx@gmail.com) (@tayx94) + * Collaborators: Lars Aalbertsen (@Rockylars) + * Project: Graphy - Ultimate Stats Monitor + * Date: 28-Feb-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 UnityEngine.UI; + +using System.Collections; +using System.Collections.Generic; + +using Random = UnityEngine.Random; + +namespace Tayx.Graphy.CustomizationScene +{ + public class CustomizeGraphy : MonoBehaviour + { + /* ----- TODO: ---------------------------- + * Check if we can seal this class. + * Add summaries to the variables. + * Add summaries to the functions. + * Check if we can remove "using System.Collections;". + * Check if we can remove "using Random = UnityEngine.Random;". + * Check if we can remove the UnityEngine prefix on the PlayRandomSFX function + * --------------------------------------*/ + + #region Variables -> Serialized Private + + [Header("Customize Graphy")] + + [SerializeField] private G_CUIColorPicker m_colorPicker = null; + + [SerializeField] private Toggle m_backgroundToggle = null; + + [SerializeField] private Dropdown m_graphyModeDropdown = null; + + [SerializeField] private Button m_backgroundColorButton = null; + + [SerializeField] private Dropdown m_graphModulePositionDropdown = null; + + #region Section -> FPS + + [Header("Fps")] + + [SerializeField] private Dropdown m_fpsModuleStateDropdown = null; + + [SerializeField] private InputField m_goodInputField = null; + [SerializeField] private InputField m_cautionInputField = null; + + [SerializeField] private Button m_goodColorButton = null; + [SerializeField] private Button m_cautionColorButton = null; + [SerializeField] private Button m_criticalColorButton = null; + + [SerializeField] private Slider m_timeToResetMinMaxSlider = null; + [SerializeField] private Slider m_fpsGraphResolutionSlider = null; + [SerializeField] private Slider m_fpsTextUpdateRateSlider = null; + + #endregion + + #region Section -> RAM + + [Header("Memory")] + + [SerializeField] private Dropdown m_ramModuleStateDropdown = null; + + [SerializeField] private Button m_reservedColorButton = null; + [SerializeField] private Button m_allocatedColorButton = null; + [SerializeField] private Button m_monoColorButton = null; + + [SerializeField] private Slider m_ramGraphResolutionSlider = null; + [SerializeField] private Slider m_ramTextUpdateRateSlider = null; + + #endregion + + #region Section -> Audio + + [Header("Audio")] + + [SerializeField] private Dropdown m_audioModuleStateDropdown = null; + + [SerializeField] private Button m_audioGraphColorButton = null; + + [SerializeField] private Dropdown m_findAudioListenerDropdown = null; + [SerializeField] private Dropdown m_fttWindowDropdown = null; + + [SerializeField] private Slider m_spectrumSizeSlider = null; + [SerializeField] private Slider m_audioGraphResolutionSlider = null; + [SerializeField] private Slider m_audioTextUpdateRateSlider = null; + + #endregion + + #region Section -> Advanced + + [Header("Advanced")] + + [SerializeField] private Dropdown m_advancedModulePositionDropdown = null; + + [SerializeField] private Toggle m_advancedModuleToggle = null; + + #endregion + + #region Section -> Other + + [Header("Other")] + + [SerializeField] private Button m_musicButton = null; + [SerializeField] private Button m_sfxButton = null; + + [SerializeField] private Slider m_musicVolumeSlider = null; + [SerializeField] private Slider m_sfxVolumeSlider = null; + + + [SerializeField] private AudioSource m_musicAudioSource = null; + [SerializeField] private AudioSource m_sfxAudioSource = null; + + [SerializeField] private List m_sfxAudioClips = new List(); + + #endregion + + #endregion + + #region Variables -> Private + + private GraphyManager m_graphyManager = null; + + #endregion + + #region Methods -> Unity Callbacks + + private void OnEnable() + { + m_graphyManager = GraphyManager.Instance; + + SetupCallbacks(); + } + + #endregion + + #region Methods -> Private + + private void SetupCallbacks() + { + // Remove all listeners first -------------------------------- + + m_backgroundToggle.onValueChanged.RemoveAllListeners(); + + m_backgroundColorButton.onClick.RemoveAllListeners(); + m_graphyModeDropdown.onValueChanged.RemoveAllListeners(); + m_graphModulePositionDropdown.onValueChanged.RemoveAllListeners(); + + #region Section -> FPS + m_fpsModuleStateDropdown.onValueChanged.RemoveAllListeners(); + + m_goodInputField.onValueChanged.RemoveAllListeners(); + + m_cautionInputField.onValueChanged.RemoveAllListeners(); + + m_goodColorButton.onClick.RemoveAllListeners(); + + m_cautionColorButton.onClick.RemoveAllListeners(); + + m_criticalColorButton.onClick.RemoveAllListeners(); + + m_timeToResetMinMaxSlider.onValueChanged.RemoveAllListeners(); + + m_fpsGraphResolutionSlider.onValueChanged.RemoveAllListeners(); + + m_fpsTextUpdateRateSlider.onValueChanged.RemoveAllListeners(); + + #endregion + + + #region Section -> RAM + + m_ramModuleStateDropdown.onValueChanged.RemoveAllListeners(); + + m_reservedColorButton.onClick.RemoveAllListeners(); + + m_allocatedColorButton.onClick.RemoveAllListeners(); + + m_monoColorButton.onClick.RemoveAllListeners(); + + m_ramGraphResolutionSlider.onValueChanged.RemoveAllListeners(); + + m_ramTextUpdateRateSlider.onValueChanged.RemoveAllListeners(); + + #endregion + + #region Section -> Audio + + m_audioModuleStateDropdown.onValueChanged.RemoveAllListeners(); + + m_audioGraphColorButton.onClick.RemoveAllListeners(); + + m_findAudioListenerDropdown.onValueChanged.RemoveAllListeners(); + + m_fttWindowDropdown.onValueChanged.RemoveAllListeners(); + + m_spectrumSizeSlider.onValueChanged.RemoveAllListeners(); + + m_audioGraphResolutionSlider.onValueChanged.RemoveAllListeners(); + + m_audioTextUpdateRateSlider.onValueChanged.RemoveAllListeners(); + + #endregion + + #region Section -> Advanced + + m_advancedModulePositionDropdown.onValueChanged.RemoveAllListeners(); + + m_advancedModuleToggle.onValueChanged.RemoveAllListeners(); + + #endregion + + #region Section -> Other + + m_musicButton.onClick.RemoveAllListeners(); + + m_sfxButton.onClick.RemoveAllListeners(); + + m_musicVolumeSlider.onValueChanged.RemoveAllListeners(); + + m_sfxVolumeSlider.onValueChanged.RemoveAllListeners(); + + #endregion + + + // Add listeners -------------------------------- + + m_backgroundToggle.onValueChanged.AddListener( + value => m_graphyManager.Background = value); + + m_backgroundColorButton.onClick.AddListener(() => + { + m_colorPicker.SetOnValueChangeCallback(null); + m_colorPicker.Color = m_backgroundColorButton.GetComponent().color; + m_colorPicker.SetOnValueChangeCallback(color => + { + m_backgroundColorButton.GetComponent().color = color; + m_graphyManager.BackgroundColor = color; + }); + }); + + m_graphyModeDropdown.onValueChanged.AddListener(value => + { + switch ((GraphyManager.Mode)value) + { + case GraphyManager.Mode.FULL: + m_fpsGraphResolutionSlider.maxValue = 300f; + m_ramGraphResolutionSlider.maxValue = 300f; + m_audioGraphResolutionSlider.maxValue = 300f; + break; + + case GraphyManager.Mode.LIGHT: + m_fpsGraphResolutionSlider.maxValue = 128f; + m_ramGraphResolutionSlider.maxValue = 128f; + m_audioGraphResolutionSlider.maxValue = 128f; + break; + } + + m_graphyManager.GraphyMode = (GraphyManager.Mode)value; + }); + + m_graphModulePositionDropdown.onValueChanged.AddListener( + value => m_graphyManager.GraphModulePosition = (GraphyManager.ModulePosition)value); + + #region Section -> FPS + + m_fpsModuleStateDropdown.onValueChanged.AddListener( + value => m_graphyManager.FpsModuleState = (GraphyManager.ModuleState)value); + + m_goodInputField.onValueChanged.AddListener(value => + { + int threshold; + if (Int32.TryParse(value, out threshold)) + { + m_graphyManager.GoodFPSThreshold = threshold; + } + }); + + m_cautionInputField.onValueChanged.AddListener(value => + { + int threshold; + if (Int32.TryParse(value, out threshold)) + { + m_graphyManager.CautionFPSThreshold = threshold; + } + }); + + m_goodColorButton.onClick.AddListener(() => + { + m_colorPicker.SetOnValueChangeCallback(null); + m_colorPicker.Color = m_goodColorButton.GetComponent().color; + m_colorPicker.SetOnValueChangeCallback(color => + { + m_goodColorButton.GetComponent().color = color; + m_graphyManager.GoodFPSColor = color; + }); + }); + + m_cautionColorButton.onClick.AddListener(() => + { + m_colorPicker.SetOnValueChangeCallback(null); + m_colorPicker.Color = m_cautionColorButton.GetComponent().color; + m_colorPicker.SetOnValueChangeCallback(color => + { + m_cautionColorButton.GetComponent().color = color; + m_graphyManager.CautionFPSColor = color; + }); + }); + + m_criticalColorButton.onClick.AddListener(() => + { + m_colorPicker.SetOnValueChangeCallback(null); + m_colorPicker.Color = m_criticalColorButton.GetComponent().color; + m_colorPicker.SetOnValueChangeCallback(color => + { + m_criticalColorButton.GetComponent().color = color; + m_graphyManager.CriticalFPSColor = color; + }); + }); + + m_timeToResetMinMaxSlider.onValueChanged.AddListener( + value => m_graphyManager.TimeToResetMinMaxFps = (int)value); + + m_fpsGraphResolutionSlider.onValueChanged.AddListener( + value => m_graphyManager.FpsGraphResolution = (int)value); + + m_fpsTextUpdateRateSlider.onValueChanged.AddListener( + value => m_graphyManager.FpsTextUpdateRate = (int)value); + + #endregion + + #region Section -> RAM + + m_ramModuleStateDropdown.onValueChanged.AddListener( + value => m_graphyManager.RamModuleState = (GraphyManager.ModuleState)value); + + m_reservedColorButton.onClick.AddListener(() => + { + m_colorPicker.SetOnValueChangeCallback(null); + m_colorPicker.Color = m_reservedColorButton.GetComponent().color; + m_colorPicker.SetOnValueChangeCallback(color => + { + m_reservedColorButton.GetComponent().color = color; + m_graphyManager.ReservedRamColor = color; + }); + }); + + m_allocatedColorButton.onClick.AddListener(() => + { + m_colorPicker.SetOnValueChangeCallback(null); + m_colorPicker.Color = m_allocatedColorButton.GetComponent().color; + m_colorPicker.SetOnValueChangeCallback(color => + { + m_allocatedColorButton.GetComponent().color = color; + m_graphyManager.AllocatedRamColor = color; + }); + }); + + m_monoColorButton.onClick.AddListener(() => + { + m_colorPicker.SetOnValueChangeCallback(null); + m_colorPicker.Color = m_monoColorButton.GetComponent().color; + m_colorPicker.SetOnValueChangeCallback(color => + { + m_monoColorButton.GetComponent().color = color; + m_graphyManager.MonoRamColor = color; + }); + }); + + m_ramGraphResolutionSlider.onValueChanged.AddListener( + value => m_graphyManager.RamGraphResolution = (int)value); + + m_ramTextUpdateRateSlider.onValueChanged.AddListener( + value => m_graphyManager.RamTextUpdateRate = (int)value); + + #endregion + + #region Section -> Audio + + m_audioModuleStateDropdown.onValueChanged.AddListener( + value => m_graphyManager.AudioModuleState = (GraphyManager.ModuleState)value); + + m_audioGraphColorButton.onClick.AddListener(() => + { + m_colorPicker.SetOnValueChangeCallback(null); + m_colorPicker.Color = m_audioGraphColorButton.GetComponent().color; + m_colorPicker.SetOnValueChangeCallback(color => + { + m_audioGraphColorButton.GetComponent().color = color; + m_graphyManager.AudioGraphColor = color; + }); + }); + + m_findAudioListenerDropdown.onValueChanged.AddListener( + value => m_graphyManager.FindAudioListenerInCameraIfNull = (GraphyManager.LookForAudioListener)value); + + m_fttWindowDropdown.onValueChanged.AddListener( + value => m_graphyManager.FftWindow = (FFTWindow)value); + + m_spectrumSizeSlider.onValueChanged.AddListener( + value => m_graphyManager.SpectrumSize = (int)value); + + m_audioGraphResolutionSlider.onValueChanged.AddListener( + value => m_graphyManager.AudioGraphResolution = (int)value); + + m_audioTextUpdateRateSlider.onValueChanged.AddListener( + value => m_graphyManager.AudioTextUpdateRate = (int)value); + + #endregion + + #region Section -> Advanced + + m_advancedModulePositionDropdown.onValueChanged.AddListener( + value => m_graphyManager.AdvancedModulePosition = (GraphyManager.ModulePosition)value); + + m_advancedModuleToggle.onValueChanged.AddListener( + value => m_graphyManager.AdvancedModuleState = value ? GraphyManager.ModuleState.FULL : GraphyManager.ModuleState.OFF); + + #endregion + + #region Section -> Other + + m_musicButton.onClick.AddListener(ToggleMusic); + m_sfxButton.onClick.AddListener(PlayRandomSFX); + + m_musicVolumeSlider.onValueChanged.AddListener( + value => m_musicAudioSource.volume = value / 100f); + + m_sfxVolumeSlider.onValueChanged.AddListener( + value => m_sfxAudioSource.volume = value / 100f); + + #endregion + } + + private void ToggleMusic() + { + if (m_musicAudioSource.isPlaying) + { + m_musicAudioSource.Pause(); + } + else + { + m_musicAudioSource.Play(); + } + } + + private void PlayRandomSFX() + { + if (m_sfxAudioClips.Count > 0) + { + m_sfxAudioSource.clip = m_sfxAudioClips[UnityEngine.Random.Range(0, m_sfxAudioClips.Count)]; + + m_sfxAudioSource.Play(); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/CustomizeGraphy.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/CustomizeGraphy.cs.meta new file mode 100644 index 0000000..546def0 --- /dev/null +++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/CustomizeGraphy.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c9bfaec34bb358e4b8ee6d94c2fc16ff +timeCreated: 1519835917 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/ForceSliderToMultipleOf3.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/ForceSliderToMultipleOf3.cs new file mode 100644 index 0000000..8c7d2b3 --- /dev/null +++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/ForceSliderToMultipleOf3.cs @@ -0,0 +1,61 @@ +/* --------------------------------------- + * Author: Martin Pane (martintayx@gmail.com) (@tayx94) + * Collaborators: Lars Aalbertsen (@Rockylars) + * Project: Graphy - Ultimate Stats Monitor + * Date: 05-Mar-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; + +namespace Tayx.Graphy.CustomizationScene +{ + public class ForceSliderToMultipleOf3 : MonoBehaviour + { + /* ----- TODO: ---------------------------- + * Check if we can seal this class. + * Add summaries to the variables. + * Add summaries to the functions. + * Check if we can remove "using System.Collections;". + * Check if we should add "private" to the Unity Callbacks. + * --------------------------------------*/ + + #region Variables -> Serialized Private + + [SerializeField] private Slider m_slider = null; + + #endregion + + #region Methods -> Unity Callbacks + + void Start() + { + m_slider.onValueChanged.AddListener(UpdateValue); + } + + #endregion + + #region Methods -> Private + + private void UpdateValue(float value) + { + int roundedValue = (int)value; + + // Forces the value to be a multiple of 3, this way the audio graph is painted correctly + if (roundedValue % 3 != 0 && roundedValue < 300) + { + roundedValue += 3 - roundedValue % 3; + } + + m_slider.value = roundedValue; + } + + #endregion + } +} \ No newline at end of file diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/ForceSliderToMultipleOf3.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/ForceSliderToMultipleOf3.cs.meta new file mode 100644 index 0000000..0dae533 --- /dev/null +++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/ForceSliderToMultipleOf3.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 51c02f9b2f4cf064790b45d85b58a589 +timeCreated: 1520276451 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/ForceSliderToPowerOf2.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/ForceSliderToPowerOf2.cs new file mode 100644 index 0000000..17526b6 --- /dev/null +++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/ForceSliderToPowerOf2.cs @@ -0,0 +1,85 @@ +/* --------------------------------------- + * Author: Martin Pane (martintayx@gmail.com) (@tayx94) + * Collaborators: Lars Aalbertsen (@Rockylars) + * Project: Graphy - Ultimate Stats Monitor + * Date: 05-Mar-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; + +namespace Tayx.Graphy.CustomizationScene +{ + public class ForceSliderToPowerOf2 : MonoBehaviour + { + /* ----- TODO: ---------------------------- + * Check if we can seal this class. + * Add summaries to the variables. + * Add summaries to the functions. + * Check if we can remove "using System.Collections;". + * Check if we could make the "m_powerOf2Values" constant. + * Check if we should add "private" to the Unity Callbacks. + * --------------------------------------*/ + + #region Variables -> Serialized Private + + [SerializeField] private Slider m_slider = null; + + #endregion + + #region Variables -> Private + + private int[] m_powerOf2Values = + { + 128, + 256, + 512, + 1024, + 2048, + 4096, + 8192 + }; + + private Text m_text; + + #endregion + + #region Methods -> Unity Callbacks + + void Start() + { + m_slider.onValueChanged.AddListener(UpdateValue); + } + + #endregion + + #region Methods -> Private + + private void UpdateValue(float value) + { + int closestSpectrumIndex = 0; + int minDistanceToSpectrumValue = 100000; + + //TODO: Put the int cast outside of the loop. + for (int i = 0; i < m_powerOf2Values.Length; i++) + { + int newDistance = Mathf.Abs((int)value - m_powerOf2Values[i]); + if (newDistance < minDistanceToSpectrumValue) + { + minDistanceToSpectrumValue = newDistance; + closestSpectrumIndex = i; + } + } + + m_slider.value = m_powerOf2Values[closestSpectrumIndex]; + } + + #endregion + } +} \ No newline at end of file diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/ForceSliderToPowerOf2.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/ForceSliderToPowerOf2.cs.meta new file mode 100644 index 0000000..9de2589 --- /dev/null +++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/ForceSliderToPowerOf2.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: bb2813fafdc3a1441bd54bf804688981 +timeCreated: 1520278494 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/UpdateTextWithSliderValue.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/UpdateTextWithSliderValue.cs new file mode 100644 index 0000000..ed491fe --- /dev/null +++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/UpdateTextWithSliderValue.cs @@ -0,0 +1,62 @@ +/* --------------------------------------- + * Author: Martin Pane (martintayx@gmail.com) (@tayx94) + * Collaborators: Lars Aalbertsen (@Rockylars) + * Project: Graphy - Ultimate Stats Monitor + * Date: 05-Mar-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; + +namespace Tayx.Graphy.CustomizationScene +{ + [RequireComponent(typeof(Text))] + public class UpdateTextWithSliderValue : MonoBehaviour + { + /* ----- TODO: ---------------------------- + * Check if we can seal this class. + * Add summaries to the variables. + * Add summaries to the functions. + * Check if we can remove "using System.Collections;". + * Check if we should add "private" to the Unity Callbacks. + * --------------------------------------*/ + + #region Variables -> Serialized Private + + [SerializeField] private Slider m_slider = null; + + #endregion + + #region Variables -> Private + + private Text m_text; + + #endregion + + #region Methods -> Unity Callbacks + + void Start() + { + m_text = GetComponent(); + + m_slider.onValueChanged.AddListener(UpdateText); + } + + #endregion + + #region Methods -> Private + + private void UpdateText(float value) + { + m_text.text = value.ToString(); + } + + #endregion + } +} \ No newline at end of file diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/UpdateTextWithSliderValue.cs.meta b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/UpdateTextWithSliderValue.cs.meta new file mode 100644 index 0000000..8066d43 --- /dev/null +++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scene/Customization Scripts/UpdateTextWithSliderValue.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6d3a66578e5e3a3409861c0890097d19 +timeCreated: 1520272291 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: -- cgit v1.2.3