diff options
author | chai <chaifix@163.com> | 2022-03-10 14:07:40 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2022-03-10 14:07:40 +0800 |
commit | 22891bf59032ba88262824255a706d652031384b (patch) | |
tree | 7595439ba9966c9402d37e37cee5e8cf098757d5 /Assets/Scripts/Utils | |
parent | 8b04ea73e540067f83870b61d89db4868fea5e8a (diff) |
* move folder
Diffstat (limited to 'Assets/Scripts/Utils')
26 files changed, 0 insertions, 532 deletions
diff --git a/Assets/Scripts/Utils/ActiveGroup.cs b/Assets/Scripts/Utils/ActiveGroup.cs deleted file mode 100644 index bae3a39d..00000000 --- a/Assets/Scripts/Utils/ActiveGroup.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class ActiveGroup : MonoBehaviour
-{
- public Object[] members;
-
- public bool active
- {
- get
- {
- return true;
- }
- set
- {
- }
- }
-
-}
diff --git a/Assets/Scripts/Utils/ActiveGroup.cs.meta b/Assets/Scripts/Utils/ActiveGroup.cs.meta deleted file mode 100644 index 3ccf34ba..00000000 --- a/Assets/Scripts/Utils/ActiveGroup.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6391395616b3b234a8dc72ea67aaa400 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/DisallowModifiyInGUI.cs b/Assets/Scripts/Utils/DisallowModifiyInGUI.cs deleted file mode 100644 index 660d2f0e..00000000 --- a/Assets/Scripts/Utils/DisallowModifiyInGUI.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-// 有这个标记时表示这个属性是GUI.enabled = false
-public class DisallowModifiyInGUI : Attribute
-{
-}
diff --git a/Assets/Scripts/Utils/DisallowModifiyInGUI.cs.meta b/Assets/Scripts/Utils/DisallowModifiyInGUI.cs.meta deleted file mode 100644 index afc8de79..00000000 --- a/Assets/Scripts/Utils/DisallowModifiyInGUI.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 28afd9ec15889e540aed85386e9d33f7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/ListPool.cs b/Assets/Scripts/Utils/ListPool.cs deleted file mode 100644 index 9819aa48..00000000 --- a/Assets/Scripts/Utils/ListPool.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine;
-using UnityEngine.Events;
-
-public static class ListPool<T>
-{
- public static List<T> Get()
- {
- return ListPool<T>.m_ListPool.Get();
- }
-
- public static void Release(List<T> toRelease)
- {
- ListPool<T>.m_ListPool.Release(toRelease);
- }
-
- private static readonly ObjectPool<List<T>> m_ListPool = new ObjectPool<List<T>>(null, delegate (List<T> l)
- {
- l.Clear();
- });
-}
-
-public class ObjectPool<T> where T : new()
-{
- private readonly Stack<T> m_Stack = new Stack<T>();
- private readonly UnityAction<T> m_ActionOnGet;
- private readonly UnityAction<T> m_ActionOnRelease;
-
- public int countAll { get; private set; }
- public int countActive { get { return countAll - countInactive; } }
- public int countInactive { get { return m_Stack.Count; } }
-
- public ObjectPool(UnityAction<T> actionOnGet, UnityAction<T> actionOnRelease)
- {
- m_ActionOnGet = actionOnGet;
- m_ActionOnRelease = actionOnRelease;
- }
-
- public T Get()
- {
- T element;
- if (m_Stack.Count == 0)
- {
- element = new T();
- countAll++;
- }
- else
- {
- element = m_Stack.Pop();
- }
- if (m_ActionOnGet != null)
- m_ActionOnGet(element);
- return element;
- }
-
- public void Release(T element)
- {
- if (m_Stack.Count > 0 && ReferenceEquals(m_Stack.Peek(), element))
- Debug.LogError("Internal error. Trying to destroy object that is already released to pool.");
- if (m_ActionOnRelease != null)
- m_ActionOnRelease(element);
- m_Stack.Push(element);
- }
-}
\ No newline at end of file diff --git a/Assets/Scripts/Utils/ListPool.cs.meta b/Assets/Scripts/Utils/ListPool.cs.meta deleted file mode 100644 index 61b7dcc3..00000000 --- a/Assets/Scripts/Utils/ListPool.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 385194156796a3241a248d31172defe5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/LogHelper.cs b/Assets/Scripts/Utils/LogHelper.cs deleted file mode 100644 index 9c835bbe..00000000 --- a/Assets/Scripts/Utils/LogHelper.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public static class LogHelper -{ - public static void LogError(string msg) - { - Debug.LogError("[Erika] " + msg); - } - - public static void Log(string msg) - { - Debug.Log("[Erika] " + msg); - } - -} diff --git a/Assets/Scripts/Utils/LogHelper.cs.meta b/Assets/Scripts/Utils/LogHelper.cs.meta deleted file mode 100644 index c8d1f167..00000000 --- a/Assets/Scripts/Utils/LogHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: dd089c734de45ce41b5d8cf87dfbd0bf -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/MatrixUtility.cs b/Assets/Scripts/Utils/MatrixUtility.cs deleted file mode 100644 index f3d865f2..00000000 --- a/Assets/Scripts/Utils/MatrixUtility.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public static class MatrixUtility -{ - - public static void SetTR(ref this Matrix4x4 matrix, Vector3 pos, Quaternion q) - { - matrix = q.ToMatrix(); - matrix[12] = pos[0]; - matrix[13] = pos[1]; - matrix[14] = pos[2]; - } - - public static void SetTRS2(ref this Matrix4x4 matrix, Vector3 pos, Quaternion q, Vector3 s) - { - matrix = q.ToMatrix(); - - matrix[0] *= s[0]; - matrix[1] *= s[0]; - matrix[2] *= s[0]; - matrix[4] *= s[1]; - matrix[5] *= s[1]; - matrix[6] *= s[1]; - matrix[8] *= s[2]; - matrix[9] *= s[2]; - matrix[10] *= s[2]; - matrix[12] = pos[0]; - matrix[13] = pos[1]; - matrix[14] = pos[2]; - - } - - public static Matrix4x4 RotateAndTranslate(Vector3 pos, Quaternion q) - { - Matrix4x4 m = new Matrix4x4(); - m.SetTR(pos, q); - return m; - } - -} diff --git a/Assets/Scripts/Utils/MatrixUtility.cs.meta b/Assets/Scripts/Utils/MatrixUtility.cs.meta deleted file mode 100644 index 746a5d82..00000000 --- a/Assets/Scripts/Utils/MatrixUtility.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4f4a4958b670de143b1189fc304ace4a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/MinMaxAttribute.cs b/Assets/Scripts/Utils/MinMaxAttribute.cs deleted file mode 100644 index bba4087a..00000000 --- a/Assets/Scripts/Utils/MinMaxAttribute.cs +++ /dev/null @@ -1,14 +0,0 @@ -using UnityEngine; - -public class MinMaxSliderAttribute : PropertyAttribute -{ - - public float min; - public float max; - - public MinMaxSliderAttribute(float min, float max) - { - this.min = min; - this.max = max; - } -} diff --git a/Assets/Scripts/Utils/MinMaxAttribute.cs.meta b/Assets/Scripts/Utils/MinMaxAttribute.cs.meta deleted file mode 100644 index 7a97ffb4..00000000 --- a/Assets/Scripts/Utils/MinMaxAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7afbee84722215549ae77c81ee280f53 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/QuaternionUtility.cs b/Assets/Scripts/Utils/QuaternionUtility.cs deleted file mode 100644 index d491b1fe..00000000 --- a/Assets/Scripts/Utils/QuaternionUtility.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public static class QuaternionUtility -{ - - public static Matrix4x4 ToMatrix(ref this Quaternion q) - { - Matrix4x4 m = new Matrix4x4(); - - // Precalculate coordinate products - float x = q.x * 2.0F; - float y = q.y * 2.0F; - float z = q.z * 2.0F; - float xx = q.x * x; - float yy = q.y * y; - float zz = q.z * z; - float xy = q.x * y; - float xz = q.x * z; - float yz = q.y * z; - float wx = q.w * x; - float wy = q.w * y; - float wz = q.w * z; - - // Calculate 3x3 matrix from orthonormal basis - m[0] = 1.0f - (yy + zz); - m[1] = xy + wz; - m[2] = xz - wy; - m[3] = 0.0F; - - m[4] = xy - wz; - m[5] = 1.0f - (xx + zz); - m[6] = yz + wx; - m[7] = 0.0F; - - m[8] = xz + wy; - m[9] = yz - wx; - m[10] = 1.0f - (xx + yy); - m[11] = 0.0F; - - m[12] = 0.0F; - m[13] = 0.0F; - m[14] = 0.0F; - m[15] = 1.0F; - - return m; - } - - -} diff --git a/Assets/Scripts/Utils/QuaternionUtility.cs.meta b/Assets/Scripts/Utils/QuaternionUtility.cs.meta deleted file mode 100644 index 49d589fc..00000000 --- a/Assets/Scripts/Utils/QuaternionUtility.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 789820cb2898f6f488d8b3bfdf94ab00 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/Singleton.cs b/Assets/Scripts/Utils/Singleton.cs deleted file mode 100644 index a882238a..00000000 --- a/Assets/Scripts/Utils/Singleton.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-using System;
-
-public class SingletonMB<T> : MonoBehaviour where T : class
-{
- protected static T s_Instance;
- public static T Instance
- {
- get { return s_Instance; }
- }
-
- protected virtual void Awake()
- {
- s_Instance = gameObject.GetComponent(typeof(T)) as T;
- }
-
-}
-
-public class Singleton<T> where T : class, new()
-{
- private static T _instance;
-
- public static T Instance
- {
- get
- {
- if (_instance == null)
- _instance = Activator.CreateInstance<T>();
- return _instance;
- }
- }
-}
\ No newline at end of file diff --git a/Assets/Scripts/Utils/Singleton.cs.meta b/Assets/Scripts/Utils/Singleton.cs.meta deleted file mode 100644 index 81c20c5a..00000000 --- a/Assets/Scripts/Utils/Singleton.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 47d828939d4273d478d2b48fee027c75 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/TRS.cs b/Assets/Scripts/Utils/TRS.cs deleted file mode 100644 index f5d6f559..00000000 --- a/Assets/Scripts/Utils/TRS.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public struct TRS
-{
- public Vector3 position;
- public Quaternion rotation;
- public Vector3 scale;
- public TRS(Vector3 pos, Quaternion rot, Vector3 sc)
- {
- position = pos;
- rotation = rot;
- scale = sc;
- }
-}
diff --git a/Assets/Scripts/Utils/TRS.cs.meta b/Assets/Scripts/Utils/TRS.cs.meta deleted file mode 100644 index f4d46a93..00000000 --- a/Assets/Scripts/Utils/TRS.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c2ec12b0e2046b84eac06e01b02937e9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/TransformUtility.cs b/Assets/Scripts/Utils/TransformUtility.cs deleted file mode 100644 index 62a28ece..00000000 --- a/Assets/Scripts/Utils/TransformUtility.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public static class TransformUtility -{ - - public static Matrix4x4 GetLocalToWorldMatrix(Transform transform) - { - Matrix4x4 mat = Matrix4x4.identity; - while(transform != null) - { - Matrix4x4 m = Matrix4x4.identity; - m.SetTRS2(transform.localPosition, transform.localRotation, transform.localScale); - mat = m * mat; - transform = transform.parent; - } - - return mat; - } - - public static Matrix4x4 GetLocalToWorldMatrixNoScale(Transform transform) - { - Matrix4x4 mat = Matrix4x4.identity; - while (transform != null) - { - Matrix4x4 m = Matrix4x4.identity; - m.SetTR(transform.localPosition, transform.localRotation); - mat = m * mat; - transform = transform.parent; - } - - return mat; - } - - public static Matrix4x4 GetLocalToWorldMatrixRootBone(Transform transform) - { - //Matrix4x4 mat = Matrix4x4.identity; - //while (transform != null) - //{ - // Matrix4x4 m = Matrix4x4.identity; - // m = Matrix4x4.Rotate(transform.localRotation); - // mat = m * mat; - // transform = transform.parent; - //} - //mat.SetColumn(3, new Vector4(trans.position.x, trans.position.y, trans.position.z, 1)); - - Matrix4x4 mat = Matrix4x4.Rotate(transform.rotation); - mat.SetColumn(3, new Vector4(transform.position.x, transform.position.y, transform.position.z, 1)); - - return mat; - } - -}
\ No newline at end of file diff --git a/Assets/Scripts/Utils/TransformUtility.cs.meta b/Assets/Scripts/Utils/TransformUtility.cs.meta deleted file mode 100644 index bda7ca18..00000000 --- a/Assets/Scripts/Utils/TransformUtility.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 00b07ec5a54ffcc44a9af249df119257 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/UIDManager.cs b/Assets/Scripts/Utils/UIDManager.cs deleted file mode 100644 index 3283de4e..00000000 --- a/Assets/Scripts/Utils/UIDManager.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class UIDManager
-{
- static int id = 0;
-
- /// <summary>
- /// 拿一个id
- /// </summary>
- /// <returns></returns>
- public static int Acquire()
- {
- return ++id;
- }
-
-}
diff --git a/Assets/Scripts/Utils/UIDManager.cs.meta b/Assets/Scripts/Utils/UIDManager.cs.meta deleted file mode 100644 index 4a2a8ee0..00000000 --- a/Assets/Scripts/Utils/UIDManager.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 67355920ae292904288feb5dc3f089bc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/UnityExtends.cs b/Assets/Scripts/Utils/UnityExtends.cs deleted file mode 100644 index d1a66f48..00000000 --- a/Assets/Scripts/Utils/UnityExtends.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public static class UnityExtends -{ - public static T GetOrAddComponent<T>(this GameObject go) where T : MonoBehaviour - { - T component = go.GetComponent<T>(); - if (component == null) - component = go.AddComponent<T>(); - return component; - } - - -} diff --git a/Assets/Scripts/Utils/UnityExtends.cs.meta b/Assets/Scripts/Utils/UnityExtends.cs.meta deleted file mode 100644 index 44139deb..00000000 --- a/Assets/Scripts/Utils/UnityExtends.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3d655d75a9052fa499fa925877bb9340 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/VectorUtility.cs b/Assets/Scripts/Utils/VectorUtility.cs deleted file mode 100644 index b0e857e7..00000000 --- a/Assets/Scripts/Utils/VectorUtility.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public static class VectorExtend
-{
-
- public static Vector4 ToVector4(ref this Vector3 v3, float w = 1)
- {
- Vector4 v4 = new Vector4(v3.x, v3.y, v3.z, 1);
- return v4;
- }
-
- public static Vector3 ToVector3(ref this Vector4 v4)
- {
- Vector3 v3 = new Vector3(v4.x, v4.y, v4.z);
- return v3;
- }
-
- public static Vector2 ToVector2(ref this Vector3 v3)
- {
- Vector2 v2 = new Vector2(v3.x, v3.y);
- return v2;
- }
-
-}
-
-public class VectorUtility
-{
-
-
-}
\ No newline at end of file diff --git a/Assets/Scripts/Utils/VectorUtility.cs.meta b/Assets/Scripts/Utils/VectorUtility.cs.meta deleted file mode 100644 index 32a9937b..00000000 --- a/Assets/Scripts/Utils/VectorUtility.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2ee12b1cbc903254a8f8328d26b267c7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: |