优化ui,谱面替换,以及科研模糊
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Qjjxk.Blur
|
||||
{
|
||||
public static class ExtensionMethod
|
||||
{
|
||||
private static void Resize(this RenderTexture rt, int width, int height)
|
||||
{
|
||||
if (rt == null) return;
|
||||
rt.Release();
|
||||
rt.width = width;
|
||||
rt.height = height;
|
||||
rt.Create();
|
||||
}
|
||||
|
||||
public static void Resize(this RenderTexture rt, float width, float height)
|
||||
{
|
||||
rt.Resize((int)width, (int)height);
|
||||
}
|
||||
|
||||
public static Vector3 Round(this Vector3 tarVector)
|
||||
{
|
||||
return new Vector3(Mathf.Round(tarVector.x), Mathf.Round(tarVector.y), Mathf.Round(tarVector.z));
|
||||
}
|
||||
|
||||
public static Vector2 Round(this Vector2 tarVector)
|
||||
{
|
||||
return new Vector2(Mathf.Round(tarVector.x), Mathf.Round(tarVector.y));
|
||||
}
|
||||
|
||||
public static void TryAdd<T>(this List<T> list, T t)
|
||||
{
|
||||
if (list.Contains(t)) return;
|
||||
list.Add(t);
|
||||
}
|
||||
|
||||
public static void Destroy(this Component tarComp)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (Application.isPlaying) Object.Destroy(tarComp);
|
||||
else EditorApplication.delayCall += () => Object.DestroyImmediate(tarComp);
|
||||
#else
|
||||
Object.Destroy(tarComp);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user