Files
RaindropViewer/Assets/Raindrop/Bootstrap/TextureCollection.cs
T
2022-03-28 21:29:45 +08:00

50 lines
1.0 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Raindrop.Services.Bootstrap
{
[CreateAssetMenu]
public class TextureCollection : ScriptableObject
{
public Texture2D[] Textures;
public int Count
{
get
{
if (Textures != null) return Textures.Length;
return 0;
}
}
public Texture2D Find( string searchFor, bool ignoreCase = true)
{
if (ignoreCase)
{
searchFor = searchFor.ToLower();
}
foreach( var m in Textures)
{
var n = m.name;
if (ignoreCase)
{
n = n.ToLower();
}
if (n == searchFor)
{
return m;
}
}
return null;
}
}
}