mirror of
https://github.com/RaindropViewer/RaindropViewer.git
synced 2026-07-30 19:12:15 +00:00
50 lines
1.0 KiB
C#
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
} |