using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StardustCore.UIUtilities;
namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
{
///
/// Deals with loading/storing tetxures for Seaside Scramble minigame.
///
public class SSCTextureUtilities
{
///
/// A list of all the texture managers.
///
public Dictionary textureManagers;
///
/// Constructor.
///
public SSCTextureUtilities()
{
this.textureManagers = new Dictionary();
}
///
/// Adds a texture manager to the list of texture managers.
///
///
public void addTextureManager(TextureManager manager)
{
this.textureManagers.Add(manager.name, manager);
}
///
/// Gets the texture manager from the dictionary of them.
///
///
///
public TextureManager getTextureManager(string Name)
{
if (this.textureManagers.ContainsKey(Name))
{
return this.textureManagers[Name];
}
else
{
throw new Exception("Sea Side Scramble: Texture Manager:"+Name+"does not exist!");
}
}
///
/// Gets a texture2dExtended from the given texture manager.
///
///
///
///
public Texture2DExtended getExtendedTexture (string ManagerName, string TextureName)
{
TextureManager manager = this.getTextureManager(ManagerName);
if (manager == null)
{
return null;
}
else
{
if (manager.textures.ContainsKey(TextureName))
{
return manager.getTexture(TextureName);
}
else
{
throw new Exception("Sea Side Scramble: Texture " + TextureName + " does not exist in texture manager: " + ManagerName);
}
}
}
///
/// Gets a texture2d from the given texture manager.
///
///
///
///
public Microsoft.Xna.Framework.Graphics.Texture2D getTexture(string ManagerName, string TextureName)
{
TextureManager manager = this.getTextureManager(ManagerName);
if (manager == null)
{
return null;
}
else
{
if (manager.textures.ContainsKey(TextureName))
{
return manager.getTexture(TextureName).texture;
}
else
{
throw new Exception("Sea Side Scramble: Texture " + TextureName + " does not exist in texture manager: " + ManagerName);
}
}
}
///
/// Adds a texture to the given texture manager.
///
///
///
///
public void addTexture(string ManagerName,string TextureName ,Texture2DExtended Texture)
{
TextureManager manager = this.getTextureManager(ManagerName);
if (manager == null)
{
return;
}
else
{
manager.addTexture(TextureName, Texture);
}
}
}
}