特效新内容。修复gameplay致命bug和分数保存bug

This commit is contained in:
2026-02-16 01:55:18 +08:00
parent 3a7a0b4669
commit 9f7c1c57b7
206 changed files with 112684 additions and 857 deletions
@@ -0,0 +1,65 @@
/* ---------------------------------------
* Author: Martin Pane (martintayx@gmail.com) (@martinTayx)
* 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 UnityEngine;
using System.Collections.Generic;
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( 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
}
}
@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 5aef4337f2241ec4d9a2ea5883fd1828
timeCreated: 1515099756
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 105778
packageName: '[Graphy] - Ultimate FPS Counter - Stats Monitor & Debugger'
packageVersion: 3.0.5
assetPath: Assets/Graphy - Ultimate Stats Monitor/Runtime/Util/G_ExtensionMethods.cs
uploadId: 626547
@@ -0,0 +1,179 @@
/* ---------------------------------------
* Author: Started by David Mkrtchyan, modified by Martin Pane (martintayx@gmail.com) (@martinTayx)
* 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 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 )
{
int negativeLength = minNegativeValue.ToIndex();
int positiveLength = maxPositiveValue.ToIndex();
if( MinValue > minNegativeValue && negativeLength >= 0 )
{
m_negativeBuffer = new string[negativeLength];
for( int 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( int 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 )
{
int 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();
}
/// <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 < 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 (float) 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
}
}
@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: c7eaf0f83a3530240a97ac1c51d6f2e6
timeCreated: 1538651101
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 105778
packageName: '[Graphy] - Ultimate FPS Counter - Stats Monitor & Debugger'
packageVersion: 3.0.5
assetPath: Assets/Graphy - Ultimate Stats Monitor/Runtime/Util/G_FloatString.cs
uploadId: 626547
@@ -0,0 +1,117 @@
/* ---------------------------------------
* Author: Started by David Mkrtchyan, modified by Martin Pane (martintayx@gmail.com) (@martinTayx)
* 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 )
{
int length = Mathf.Abs( minNegativeValue );
m_negativeBuffer = new string[length];
for( int i = 0; i < length; i++ )
{
m_negativeBuffer[ i ] = (-i - 1).ToString();
}
}
if( MaxValue < maxPositiveValue && maxPositiveValue >= 0 )
{
m_positiveBuffer = new string[maxPositiveValue + 1];
for( int 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
}
}
@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 2584aec3ab9f9af49bbdb1477908274e
timeCreated: 1526634575
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 105778
packageName: '[Graphy] - Ultimate FPS Counter - Stats Monitor & Debugger'
packageVersion: 3.0.5
assetPath: Assets/Graphy - Ultimate Stats Monitor/Runtime/Util/G_Intstring.cs
uploadId: 626547
@@ -0,0 +1,84 @@
/* ---------------------------------------
* Sourced from: https://wiki.unity3d.com/index.php/Singleton
* Modified by: Martín Pane (martintayx@gmail.com) (@martinTayx)
* 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 Variables -> Private
private static T _instance;
private static object _lock = new object();
#endregion
#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 Methods -> Unity Callbacks
void Awake()
{
if( _instance != null )
{
Destroy( gameObject );
}
else
{
_instance = GetComponent<T>();
}
}
void OnDestroy()
{
if( _instance == this )
{
_instance = null;
}
}
#endregion
}
}
@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: dbf324bd9d0eaf7408f3b72ed03e2588
timeCreated: 1512413989
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 105778
packageName: '[Graphy] - Ultimate FPS Counter - Stats Monitor & Debugger'
packageVersion: 3.0.5
assetPath: Assets/Graphy - Ultimate Stats Monitor/Runtime/Util/G_Singleton.cs
uploadId: 626547