The fucking 3rd time i had to upload this project to git

This commit is contained in:
Madhav Kapa
2023-10-06 20:18:29 -04:00
commit 5658acfe16
2689 changed files with 1259400 additions and 0 deletions

View File

@ -0,0 +1,56 @@
/* ---------------------------------------
* Author: Martin Pane (martintayx@gmail.com) (@tayx94)
* Contributors: https://github.com/Tayx94/graphy/graphs/contributors
* Project: Graphy - Ultimate Stats Monitor
* Date: 04-Jan-18
* Studio: Tayx
*
* Git repo: https://github.com/Tayx94/graphy
*
* This project is released under the MIT license.
* Attribution is not required, but it is always welcomed!
* -------------------------------------*/
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Tayx.Graphy.Utils
{
public static class G_ExtensionMethods
{
#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 (var 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
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 5aef4337f2241ec4d9a2ea5883fd1828
timeCreated: 1515099756
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,180 @@
/* ---------------------------------------
* Author: Started by David Mkrtchyan, modified by Martin Pane (martintayx@gmail.com) (@tayx94)
* Contributors: https://github.com/Tayx94/graphy/graphs/contributors
* Project: Graphy - Ultimate Stats Monitor
* Date: 18-May-18
* Studio: Tayx
*
* Git repo: https://github.com/Tayx94/graphy
*
* 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
{
#region Variables -> Private
/// <summary>
/// Float represented as a string, formatted.
/// </summary>
private const string m_floatFormat = "0.0";
/// <summary>
/// The currently defined, globally used decimal multiplier.
/// </summary>
private static readonly float m_decimalMultiplier = 10f;
/// <summary>
/// List of negative floats casted to strings.
/// </summary>
private static string[] m_negativeBuffer = new string[0];
/// <summary>
/// List of positive floats casted to strings.
/// </summary>
private static string[] m_positiveBuffer = new string[0];
#endregion
#region Properties -> Public
/// <summary>
/// The lowest float value of the existing number buffer.
/// </summary>
public static float MinValue => -(m_negativeBuffer.Length - 1).FromIndex();
/// <summary>
/// The highest float value of the existing number buffer.
/// </summary>
public static float MaxValue => (m_positiveBuffer.Length - 1).FromIndex();
#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(float minNegativeValue, float maxPositiveValue)
{
var negativeLength = minNegativeValue.ToIndex();
var positiveLength = maxPositiveValue.ToIndex();
if (MinValue > minNegativeValue && negativeLength >= 0)
{
m_negativeBuffer = new string[negativeLength];
for (var i = 0; i < negativeLength; i++)
m_negativeBuffer[i] = (-i - 1).FromIndex().ToString(m_floatFormat);
}
if (MaxValue < maxPositiveValue && positiveLength >= 0)
{
m_positiveBuffer = new string[positiveLength + 1];
for (var i = 0; i < positiveLength + 1; i++)
m_positiveBuffer[i] = i.FromIndex().ToString(m_floatFormat);
}
}
public static void Dispose()
{
m_negativeBuffer = new string[0];
m_positiveBuffer = new string[0];
}
/// <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)
{
var valIndex = value.ToIndex();
if (value < 0 && valIndex < m_negativeBuffer.Length) return m_negativeBuffer[valIndex];
if (value >= 0 && valIndex < m_positiveBuffer.Length) return m_positiveBuffer[valIndex];
return value.ToString();
}
//TODO: Convert this to use m_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)
{
var valIndex = value.ToIndex();
if (value < 0 && valIndex < m_negativeBuffer.Length) return m_negativeBuffer[valIndex];
if (value >= 0 && valIndex < m_positiveBuffer.Length) return m_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 i;
}
#endregion
#region Methods -> Private
private static int ToIndex(this float f)
{
return Mathf.Abs((f * m_decimalMultiplier).ToInt());
}
private static float FromIndex(this int i)
{
return i.ToFloat() / m_decimalMultiplier;
}
#endregion
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c7eaf0f83a3530240a97ac1c51d6f2e6
timeCreated: 1538651101
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,105 @@
/* ---------------------------------------
* Author: Started by David Mkrtchyan, modified by Martin Pane (martintayx@gmail.com) (@tayx94)
* Contributors: https://github.com/Tayx94/graphy/graphs/contributors
* Project: Graphy - Ultimate Stats Monitor
* Date: 18-May-18
* Studio: Tayx
*
* Git repo: https://github.com/Tayx94/graphy
*
* 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
{
#region Variables -> Private
/// <summary>
/// List of negative ints casted to strings.
/// </summary>
private static string[] m_negativeBuffer = new string[0];
/// <summary>
/// List of positive ints casted to strings.
/// </summary>
private static string[] m_positiveBuffer = new string[0];
#endregion
#region Properties -> Public
/// <summary>
/// The lowest int value of the existing number buffer.
/// </summary>
public static int MinValue => -(m_negativeBuffer.Length - 1);
/// <summary>
/// The highest int value of the existing number buffer.
/// </summary>
public static int MaxValue => m_positiveBuffer.Length;
#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 (MinValue > minNegativeValue && minNegativeValue <= 0)
{
var length = Mathf.Abs(minNegativeValue);
m_negativeBuffer = new string[length];
for (var i = 0; i < length; i++) m_negativeBuffer[i] = (-i - 1).ToString();
}
if (MaxValue < maxPositiveValue && maxPositiveValue >= 0)
{
m_positiveBuffer = new string[maxPositiveValue + 1];
for (var i = 0; i < maxPositiveValue + 1; i++) m_positiveBuffer[i] = i.ToString();
}
}
public static void Dispose()
{
m_negativeBuffer = new string[0];
m_positiveBuffer = new string[0];
}
/// <summary>
/// Returns this int as a cached string.
/// </summary>
/// <param name="value">
/// The required int.
/// </param>
/// <returns>
/// A cached number string if within the buffer ranges.
/// </returns>
public static string ToStringNonAlloc(this int value)
{
if (value < 0 && -value <= m_negativeBuffer.Length) return m_negativeBuffer[-value - 1];
if (value >= 0 && value < m_positiveBuffer.Length) return m_positiveBuffer[value];
// If the value is not within the buffer ranges, just do a normal .ToString()
return value.ToString();
}
#endregion
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 2584aec3ab9f9af49bbdb1477908274e
timeCreated: 1526634575
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,75 @@
/* ---------------------------------------
* Sourced from: https://wiki.unity3d.com/index.php/Singleton
* Modified by: Martín Pane (martintayx@gmail.com) (@tayx94)
* Contributors: https://github.com/Tayx94/graphy/graphs/contributors
* Project: Graphy - Ultimate Stats Monitor
* Date: 07-Jul-17
* Studio: Tayx
*
* Git repo: https://github.com/Tayx94/graphy
*
* 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.
/// </summary>
public class G_Singleton<T> : MonoBehaviour where T : MonoBehaviour
{
#region Properties -> Public
public static T Instance
{
get
{
lock (_lock)
{
if (_instance == null)
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."
);
return _instance;
}
}
}
#endregion
#region Variables -> Private
private static T _instance;
private static readonly object _lock = new();
#endregion
#region Methods -> Unity Callbacks
private void Awake()
{
if (_instance != null)
Destroy(gameObject);
else
_instance = GetComponent<T>();
}
private void OnDestroy()
{
if (_instance == this) _instance = null;
}
#endregion
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: dbf324bd9d0eaf7408f3b72ed03e2588
timeCreated: 1512413989
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: