2014-11-30 17:50:21 +00:00
|
|
|
|
using Microsoft.Xna.Framework;
|
|
|
|
|
|
|
|
|
|
namespace Axios.Engine
|
|
|
|
|
{
|
|
|
|
|
public static class GameServices
|
|
|
|
|
{
|
|
|
|
|
private static GameServiceContainer container;
|
2014-12-31 04:07:05 +00:00
|
|
|
|
private static object lockobj = new object();
|
2014-11-30 17:50:21 +00:00
|
|
|
|
public static GameServiceContainer Instance
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
lock (GameServices.lockobj)
|
|
|
|
|
{
|
|
|
|
|
if (container == null)
|
|
|
|
|
{
|
|
|
|
|
container = new GameServiceContainer();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return container;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static T GetService<T>()
|
|
|
|
|
{
|
|
|
|
|
return (T)Instance.GetService(typeof(T));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void AddService<T>(T service)
|
|
|
|
|
{
|
|
|
|
|
Instance.AddService(typeof(T), service);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void RemoveService<T>()
|
|
|
|
|
{
|
|
|
|
|
Instance.RemoveService(typeof(T));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|