This commit is contained in:
JA
2026-06-20 19:34:23 +08:00
parent e5031c0068
commit d442805c3f
4136 changed files with 514641 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f25f02f574c4a34499a0402ff9393dc5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SoundDefine
{
#region music
public const string LoadingMusic= "select";
public const string Map_1Music = "map_01";
public const string Map_2Music = "map_02";
public const string Map_3Music = "map_03";
#endregion
#region fix
public const string BoxOpen = "BoxOpen";
#endregion
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9836183019983914fb04067f5ceb6760
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,64 @@
using Manager;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SystemConfig : MonoBehaviour
{
//¿ª¹Ø
public static bool MusicOn
{
get
{
return PlayerPrefs.GetInt("Music", 1) == 1;
}
set
{
PlayerPrefs.SetInt("Music", value ? 1 : 0);
SoundManager.Instance.MusicOn = value;
}
}
public static bool SoundOn
{
get
{
return PlayerPrefs.GetInt("Sound", 1) == 1;
}
set
{
PlayerPrefs.SetInt("Sound", value ? 1 : 0);
SoundManager.Instance.SoundOn = value;
}
}
//´óС
public static int MusicVolume
{
get
{
return PlayerPrefs.GetInt("MusicVolume", 100);
}
set
{
PlayerPrefs.SetInt("MusicVolume", value);
SoundManager.Instance.MusicVolume = value;
}
}
public static int SoundVolume
{
get
{
return PlayerPrefs.GetInt("SoundVolume", 100);
}
set
{
PlayerPrefs.SetInt("SoundVolume", value);
SoundManager.Instance.SoundVolume = value;
}
}
~SystemConfig()
{
PlayerPrefs.Save();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ee97715ada4062f4d85b5b96d8cb30fc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,81 @@
//using UnityEngine;
//using System.Collections;
//using UnityEditor;
//using System.IO;
//using System.Collections.Generic;
/// < summary >
/// 切割
/// </ summary >
//public static class ImageSlicer
//{
// [MenuItem("Assets/ImageSlicer/Process to Sprites")]
// static void ProcessToSprite()
// {
// Texture2D image = Selection.activeObject as Texture2D;//获取旋转的对象
// string rootPath = Path.GetDirectoryName(AssetDatabase.GetAssetPath(image));//获取路径名称
// string path = rootPath + "/" + image.name + ".PNG";//图片路径名称
// TextureImporter texImp = AssetImporter.GetAtPath(path) as TextureImporter;//获取图片入口
// AssetDatabase.CreateFolder(rootPath, image.name);//创建文件夹
// foreach (SpriteMetaData metaData in texImp.spritesheet)//遍历小图集
// {
// Texture2D myimage = new Texture2D((int)metaData.rect.width, (int)metaData.rect.height);
// abc_0: (x: 2.00, y: 400.00, width: 103.00, height: 112.00)
// for (int y = (int)metaData.rect.y; y < metaData.rect.y + metaData.rect.height; y++)//Y轴像素
// {
// for (int x = (int)metaData.rect.x; x < metaData.rect.x + metaData.rect.width; x++)
// myimage.SetPixel(x - (int)metaData.rect.x, y - (int)metaData.rect.y, image.GetPixel(x, y));
// }
// 转换纹理到EncodeToPNG兼容格式
// if (myimage.format != TextureFormat.ARGB32 && myimage.format != TextureFormat.RGB24)
// {
// Texture2D newTexture = new Texture2D(myimage.width, myimage.height);
// newTexture.SetPixels(myimage.GetPixels(0), 0);
// myimage = newTexture;
// }
// DeCompress(myimage);
// var pngData = myimage.EncodeToPNG();
// AssetDatabase.CreateAsset(myimage, rootPath + "/" + image.name + "/" + metaData.name + ".PNG");
// File.WriteAllBytes(rootPath + "/" + image.name + "/" + metaData.name + ".PNG", pngData);
// 刷新资源窗口界面
// AssetDatabase.Refresh();
// }
// }
// / <summary>
// /
// / </summary>
// / <param name = "source" ></ param >
// / < returns ></ returns >
// public static Texture2D DeCompress(Texture2D source)
// {
// RenderTexture renderTex = RenderTexture.GetTemporary(
// source.width,
// source.height,
// 0,
// RenderTextureFormat.Default,
// RenderTextureReadWrite.Linear);
// Graphics.Blit(source, renderTex);
// RenderTexture previous = RenderTexture.active;
// RenderTexture.active = renderTex;
// Texture2D readableText = new Texture2D(source.width, source.height);
// readableText.ReadPixels(new Rect(0, 0, renderTex.width, renderTex.height), 0, 0);
// readableText.Apply();
// RenderTexture.active = previous;
// RenderTexture.ReleaseTemporary(renderTex);
// return readableText;
// }
//}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a585f91919ecc5049b0440e503ce7482
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cc6de09ab7131f9468c2acea40471f24
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,43 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameObjectPoll : PollBase
{
public override Object Spwan(string name)
{
Object obj = base.Spwan(name);//´Ó¸¸ÀàÖÐÈ¡³ö
if (obj == null)
return null;
GameObject go = obj as GameObject;
go.SetActive(true);
return obj;
}
public override void UnSpwan(string name, Object obj)
{
GameObject go = obj as GameObject;
go.SetActive(false);
go.transform.SetParent(this.transform, false);
base.UnSpwan(name, obj);
}
public override void Release()
{
base.Release();
foreach (PollObject items in m_Objects)
{
if (System.DateTime.Now.Ticks - items.lastUserTime.Ticks >= m_ReleaseTime * 10000000)
{
Debug.Log("GameObjectPoll Release item:" + System.DateTime.Now);
Destroy(items.Object);
m_Objects.Remove(items);
Release();
return;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d0db3f2dc79616b4b90ce958ff538335
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,72 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PollBase : MonoBehaviour
{
//自动释放时间/秒
protected float m_ReleaseTime;
//上次释放的时间/毫微秒 10……7
protected long m_LastReleaseTime = 0;
//对象池
protected List<PollObject> m_Objects;
public void Start()
{
m_LastReleaseTime = System.DateTime.Now.Ticks;
}
/// <summary>
/// 初始化对象池
/// </summary>
/// <param name="time"></param>
public void Init(float time)
{
m_ReleaseTime = time;
m_Objects = new List<PollObject>();
}
/// <summary>
/// 取出对象
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public virtual Object Spwan(string name)
{
foreach (PollObject po in m_Objects)
{
if (po.Name == name)
{
m_Objects.Remove(po);
return po.Object;
}
}
return null;
}
/// <summary>
/// 回收
/// </summary>
/// <param name="name"></param>
/// <param name="obj"></param>
public virtual void UnSpwan(string name, Object obj)
{
PollObject po = new PollObject(name, obj);
m_Objects.Add(po);
}
/// <summary>
/// 释放
/// </summary>
public virtual void Release()
{
}
private void Update()
{
if (System.DateTime.Now.Ticks - m_LastReleaseTime >= m_ReleaseTime * 10000000)
{
m_LastReleaseTime = System.DateTime.Now.Ticks;
Release();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9ba11d249cb380348b661dda9386a33a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
using UnityEngine;
public class PollObject
{
//对象
public Object Object;
//对象名
public string Name;
//最后一次的使用时间,记录销毁
public System.DateTime lastUserTime;
public PollObject(string name, Object obj)
{
Name = name;
Object = obj;
lastUserTime = System.DateTime.Now;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3d7860cc304322b41a0233c9cf94ab61
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,40 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RsertTriger : StateMachineBehaviour
{
public string[] trigger;
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
foreach (var info in trigger)
{
animator.ResetTrigger(info);
}
}
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
//override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
//{
//
//}
// OnStateExit is called when a transition ends and the state machine finishes evaluating this state
//override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
//{
//
//}
// OnStateMove is called right after Animator.OnAnimatorMove()
//override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
//{
// // Implement code that processes and affects root motion
//}
// OnStateIK is called right after Animator.OnAnimatorIK()
//override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
//{
// // Implement code that sets up animation IK (inverse kinematics)
//}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ee7bc4befba7eea4eab0ccc3c78f51aa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,39 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Timer : MonoBehaviour
{
private float timer;
private Action action;
private bool timeIsDone;
private void Update()
{
if (timer > 0 && !timeIsDone)
{
timer -= Time.deltaTime;
if (timer <= 0)
{
action?.Invoke();
timeIsDone = true;
ManagersMode.Poll.UnSpwan("Timer","timer",this.gameObject);
}
}
}
/// <summary>
/// 创建计时器
/// </summary>
/// <param name="timer">计时时间</param>
/// <param name="cllBackAction">回调函数</param>
public void CreateTime(float timer,Action cllBackAction, bool timeIsDone = false)
{
this.timer = timer;
this.action = cllBackAction;
this.timeIsDone = timeIsDone;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3abff343cfabdc8459d876dfa2bb8022
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,49 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public static class UnityExpandFunction
{
/// <summary>
/// 检测动画标签
/// </summary>
/// <param name="animator"></param>
/// <param name="tagName"></param>
/// <param name="animationIndex"></param>
/// <returns></returns>
public static bool CheckAnimationTag(this Animator animator, string tagName, int animationIndex = 0)
{
return animator.GetCurrentAnimatorStateInfo(animationIndex).IsTag(tagName);
}
/// <summary>
/// 检测动画片段名称
/// </summary>
/// <param name="animator"></param>
/// <param name="animationName"></param>
/// <param name="animationIndex"></param>
/// <returns></returns>
public static bool CheckAnimationName(this Animator animator, string animationName, int animationIndex = 0)
{
return animator.GetCurrentAnimatorStateInfo(animationIndex).IsName(animationName);
}
/// <summary>
/// 贝塞尔曲线
/// </summary>
/// <param name="t"></param>
/// <param name="a"></param>
/// <param name="b"></param>
/// <param name="c"></param>
/// <returns></returns>
public static Vector2 Bezier(float t, Vector2 a, Vector2 b, Vector2 c)
{
var ab = Vector2.Lerp(a, b, t);
var bc = Vector2.Lerp(b, c, t);
return Vector2.Lerp(ab, bc, t);
}
public static CameraVR GetCamera()
{
return GameObject.FindWithTag("Camera").GetComponentInChildren<CameraVR>();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5611e72230580f648b44272302c34333
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c6dda55ef4262d844bd6e3590c551472
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,38 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public abstract class MonoSingleton<T> : MonoBehaviour where T : MonoBehaviour
{
public bool global=true;
private static T instance;
public static T Instance
{
get
{
if (instance == null)
instance = FindObjectOfType<T>();
return instance;
}
}
void Awake()
{
if (global)
{
if (instance != null && instance != this.gameObject.GetComponent<T>())
{
Destroy(this.gameObject);
return;
}
DontDestroyOnLoad(this.gameObject);
instance = this.gameObject.GetComponent<T>();
}
this.OnStart();
}
protected virtual void OnStart()
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 29d9d55349331304fb3da0aa1c10e559
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
class Resloader
{
public static T Load<T>(string path) where T : UnityEngine.Object
{
return Resources.Load<T>(path);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6e7452ecf3eb2b94c8af2b8b2f16c9ac
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Singleton<T> where T : new()
{
static T instance;
public static T Instance
{
get
{
if (instance == null)
return instance = new T();
return instance;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 07784bad47cfbe64faab332768e5f00a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: