using System; using System.Collections.Generic; using System.Text; namespace FlatRedBall { public static class FlatRedBallServices { private static Dictionary mPool; static FlatRedBallServices() { mPool = new Dictionary(); } public static void RegisterService(object service) { Type t = service.GetType(); RegisterService(t, service); } public static void RegisterService(object service) { RegisterService(typeof(T), service); } public static void RegisterService(Type t, object service) { if (!mPool.ContainsKey(t)) { mPool.Add(t, service); } else { mPool[t] = service; } } public static T GetService() { if(mPool.ContainsKey(typeof(T))) { return (T)mPool[typeof(T)]; } else { return default(T); } } } }