Exemplo n.º 1
0
        public static void Unload(ContentManager manager)
        {
            var @event = new StaticContextEvent();

            StaticGameContext.FireEvent("content_on_unload", @event);
            manager.Unload();
        }
Exemplo n.º 2
0
 public T Proxy <A, T>(TypeDelegate <T> @delegate, T instance) where T : StaticContextWrapper
 {
     instance.Parent     = Root;
     instance.Underlying = StaticGameContext.ProxyAccessor <A, TypeDelegate <T> >(@delegate, @delegate.ConstructorParams.ToArray());
     @delegate.Accessor  = instance;
     return(instance);
 }
Exemplo n.º 3
0
        public static T Load <T>(ContentManager manager, string assetName)
        {
            DetourEvent @event = StaticGameContext.ContentLoadCallback(manager, typeof(T), assetName);

            if (@event.ReturnValue != null)
            {
                return((T)@event.ReturnValue);
            }
            return(manager.Load <T>(assetName));
        }
Exemplo n.º 4
0
        public static T Load <T>(ContentManager manager, string assetName)
        {
            var @event = new StaticContextEvent(manager, assetName);

            StaticGameContext.FireEvent("content_on_load", @event);
            if (@event.ReturnValue != null)
            {
                return((T)@event.ReturnValue);
            }
            return(manager.Load <T>(assetName));
        }
        private void InitializeStaticContext(InjectionFactoryContext ctx)
        {
            var assembly    = ctx.GetConcreteAssembly();
            var entry       = assembly.EntryPoint;
            var entryType   = entry.DeclaringType;
            var constructor = entryType.GetConstructor(new Type[0]);

            var root = (ProgramAccessor)constructor.Invoke(new object[0]);

            StaticGameContext.Init(assembly, root, EventBus, ctx.Injectors);
        }
        private void InitializeStaticContext(InjectionFactoryContext ctx)
        {
            var assembly  = ctx.GetConcreteAssembly();
            var entry     = assembly.EntryPoint;
            var entryType = entry.DeclaringType;

            if (entryType == null)
            {
                throw new InvalidProgramException("Unable to find game enty type!");
            }

            var constructor = entryType.GetConstructor(new Type[0]);

            if (constructor == null)
            {
                throw new InvalidProgramException("Unable to find game entry constructor!");
            }

            var root = new ProgramWrapper(constructor.Invoke(new object[0]));

            StaticGameContext.Init(assembly, root, EventBus, ctx.Injectors);
        }
Exemplo n.º 7
0
 public static void Unload(ContentManager manager)
 {
     StaticGameContext.ManagerUnloadCallback(manager);
     manager.Unload();
 }