Files
TaiWan/Assets/Roaming/Scripts/Widget/TexturePool.cs

47 lines
841 B
C#
Raw Normal View History

2025-10-31 15:20:38 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TexturePool
{
public static Dictionary<string, Texture2D> dicTextures;
static List<string> removeKeys;
static TexturePool()
{
}
void ClearTexture()
{
}
static int MaxTextureCount;
public static Texture2D GetTexture(string key)
{
Texture2D tex = null;
if (dicTextures.ContainsKey(key))
{
tex = dicTextures[key];
removeKeys.Remove(key);
}
return tex;
}
public static void SaveTexture(string key, Texture2D txt)
{
if (!dicTextures.ContainsKey(key))
{
dicTextures.Add(key, txt);
}
}
public static void RemoveTexture(string key)
{
removeKeys.Add(key);
}
}