public void SetUp() { Global = new GlobalWorld(); var systems = RequiredExecutiveSystems; if (systems == null) { systems = new List <Type>(); // hack: make GameHost core systems being added to the resolver var programType = typeof(GameHost.Program); systems.Add(programType); systems.Remove(programType); AppSystemResolver.ResolveFor <ExecutiveEntryApplication>(systems, t => t.GetCustomAttribute <RestrictToApplicationAttribute>()?.IsValid <ExecutiveEntryApplication>() == true); } foreach (var type in systems) { Global.Collection.GetOrCreate(type); } var listenerCollection = Global.World.CreateEntity(); listenerCollection.Set <ListenerCollectionBase>(new ListenerCollection()); systems.Clear(); systems = RequiredSimulationSystems; if (systems == null) { systems = new List <Type>(); AppSystemResolver.ResolveFor <SimulationApplication>(systems); } var simulationAppEntity = Global.World.CreateEntity(); simulationAppEntity.Set <IListener>(new SimulationApplication(Global, null)); simulationAppEntity.Set(new PushToListenerCollection(listenerCollection)); foreach (var type in systems) { RetrieveApplication().Data.Collection.GetOrCreate(type); } if (RetrieveApplication().Scheduler is Scheduler scheduler) { scheduler.OnExceptionFound = exception => { Console.WriteLine(exception); return(true); }; } }
public AudioApplication(GlobalWorld source, Context overrideContext) : base(source, overrideContext) { targetFrequency = TimeSpan.FromSeconds(1f / 500f); timeApp = new TimeApp(Data.Context); fts = new FixedTimeStep { TargetFrameTimeMs = (int)targetFrequency.TotalMilliseconds }; worker = new ApplicationWorker("Audio"); }
public DrawHelper( MenuManager menumanager, Unit myhero, GlobalMiniMap globalminiMap, GlobalWorld globalworld) { MenuManager = menumanager; MyHero = myhero; GlobalMiniMap = globalminiMap; GlobalWorld = globalworld; }
public SimulationApplication(GlobalWorld source, Context overrideContext) : base(source, overrideContext) { // register game world since it's kinda important for the simu app, ahah Data.Context.BindExisting(gameWorld = new GameWorld()); Data.Context.BindExisting <IBatchRunner>(batchRunner = new ThreadBatchRunner(0.5f)); // we only use 50% of the cores targetFrequency = TimeSpan.FromSeconds(0.02); // 100 fps timeApp = new TimeApp(Data.Context); fts = new FixedTimeStep { TargetFrameTimeMs = (int)targetFrequency.TotalMilliseconds }; worker = new ApplicationWorker("Simulation"); }
public GameBootstrap() { CancellationTokenSource = new CancellationTokenSource(); Global = new GlobalWorld(); // Create Game Entity GameEntity = Global.World.CreateEntity(); // Create Default Listener collection DefaultListenerCollection = Global.World.CreateEntity(); DefaultListenerCollection.Set <ListenerCollectionBase>(new ListenerCollection()); AppDomain.CurrentDomain.UnhandledException += onDomainUnhandledException; TaskScheduler.UnobservedTaskException += onUnobservedTaskException; }
public OnWorld( MenuManager menumanager, GlobalWorld globalworld, ParticleToTexture particletotexture) { MenuManager = menumanager; GlobalWorld = globalworld; ParticleToTexture = particletotexture; if (MenuManager.OnWorldItem.Value) { Drawing.OnDraw += OnDraw; } MenuManager.OnWorldItem.PropertyChanged += OnWorldItemChanged; }
public ParticleTeleport( MenuManager menumanager, Unit myhero, MessageCreator messagecreator, SoundPlayer soundplayer, Colors colors, GlobalMiniMap globalminiMap, GlobalWorld globalworld) { MenuManager = menumanager; MyHero = myhero; MessageCreator = messagecreator; SoundPlayer = soundplayer; Colors = colors; GlobalMiniMap = globalminiMap; GlobalWorld = globalworld; }
public Modifiers( MenuManager menumanager, Unit myhero, Dangerous dangerous, MessageCreator messagecreator, SoundPlayer soundplayer, Colors colors, GlobalMiniMap globalminimap, GlobalWorld globalworld) { MenuManager = menumanager; MyHero = myhero; Dangerous = dangerous; MessageCreator = messagecreator; SoundPlayer = soundplayer; Colors = colors; GlobalMiniMap = globalminimap; GlobalWorld = globalworld; }
public void SetUp() { Global = new GlobalWorld(); var systems = RequiredExecutiveSystems; if (systems == null) { systems = new List <Type>(); // hack: make GameHost core systems being added to the resolver var programType = typeof(GameHost.Program); systems.Add(programType); systems.Remove(programType); AppSystemResolver.ResolveFor <ExecutiveEntryApplication>(systems, t => t.GetCustomAttribute <RestrictToApplicationAttribute>()?.IsValid <ExecutiveEntryApplication>() == true); } foreach (var type in systems) { Global.Collection.GetOrCreate(type); } var listenerCollection = Global.World.CreateEntity(); listenerCollection.Set <ListenerCollectionBase>(new ListenerCollection()); systems.Clear(); systems = RequiredAudioSystems; if (systems == null) { systems = new List <Type>(); AppSystemResolver.ResolveFor <AudioApplication>(systems); } Client = new CommonApplicationThreadListener(Global, null); foreach (var type in systems) { Console.WriteLine(type); Client.Data.Collection.GetOrCreate(type); } Server = new CommonApplicationThreadListener(Global, null); foreach (var type in systems) { Server.Data.Collection.GetOrCreate(type); } var clientAppEntity = Global.World.CreateEntity(); clientAppEntity.Set <IListener>(Client); clientAppEntity.Set(new PushToListenerCollection(listenerCollection)); var serverAppEntity = Global.World.CreateEntity(); serverAppEntity.Set <IListener>(Server); serverAppEntity.Set(new PushToListenerCollection(listenerCollection)); if (Client.Scheduler is Scheduler clientScheduler) { clientScheduler.OnExceptionFound = exception => { Console.WriteLine("Client: " + exception); return(true); }; } if (Server.Scheduler is Scheduler serverScheduler) { serverScheduler.OnExceptionFound = exception => { Console.WriteLine("Server: " + exception); return(true); }; } }
public BeAwarePlusConfig(BeAwarePlus BeAwarePlus) { MenuManager = new MenuManager(); Colors = new Colors(); Dangerous = new Dangerous(); EntityToTexture = new EntityToTexture(); ModifierToTexture = new ModifierToTexture(); ParticleToTexture = new ParticleToTexture(); GlobalMiniMap = new GlobalMiniMap(); GlobalWorld = new GlobalWorld(); MessageCreator = new MessageCreator(MenuManager); Resolution = new Resolution(MessageCreator); SoundPlayer = new SoundPlayer(MenuManager); Others = new Others( MenuManager, BeAwarePlus.Context.Owner, MessageCreator, SoundPlayer); DrawHelper = new DrawHelper( MenuManager, BeAwarePlus.Context.Owner, GlobalMiniMap, GlobalWorld); ParticleSpells = new ParticleSpells( MenuManager, BeAwarePlus.Context.Owner, Dangerous, MessageCreator, SoundPlayer, Colors, DrawHelper); ParticleItems = new ParticleItems( MenuManager, BeAwarePlus.Context.Owner, Dangerous, MessageCreator, SoundPlayer, Colors, DrawHelper); ParticleTeleport = new ParticleTeleport( MenuManager, BeAwarePlus.Context.Owner, MessageCreator, SoundPlayer, Colors, GlobalMiniMap, GlobalWorld); Entities = new Entities( MenuManager, BeAwarePlus.Context.Owner, Dangerous, MessageCreator, SoundPlayer, Colors, GlobalMiniMap, GlobalWorld); Modifiers = new Modifiers( MenuManager, BeAwarePlus.Context.Owner, Dangerous, MessageCreator, SoundPlayer, Colors, GlobalMiniMap, GlobalWorld); OnMiniMap = new OnMiniMap( MenuManager, BeAwarePlus.Render, GlobalMiniMap); OnWorld = new OnWorld( MenuManager, GlobalWorld, ParticleToTexture); }
public ExecutiveEntryApplication(GlobalWorld source) { Global = source; Data = new ApplicationData(source.Context, source.World); }