public DefaultAssetManager( IKernel kernel, IAssetLoader[] assetLoaders, IAssetSaver[] assetSavers, IProfiler[] profilers, IRawAssetLoader rawAssetLoader, IRawAssetSaver rawAssetSaver, ITransparentAssetCompiler transparentAssetCompiler, ICoroutine coroutine, IConsoleHandle consoleHandle) { _kernel = kernel; _assetLoaders = assetLoaders; _assetSavers = assetSavers; _profiler = profilers.Length > 0 ? profilers[0] : null; _rawAssetLoader = rawAssetLoader; _rawAssetSaver = rawAssetSaver; _transparentAssetCompiler = transparentAssetCompiler; _consoleHandle = consoleHandle; _assets = new Dictionary <string, ISingleAssetReference <IAsset> >(); _assetsToLoad = new ConcurrentQueue <ISingleAssetReference <IAsset> >(); _assetsToFinalize = new ConcurrentQueue <ISingleAssetReference <IAsset> >(); coroutine.Run(FinalizeAssets); }
public PhysicsShadowWorld( IEventEngine <IPhysicsEventContext> physicsEventEngine, IHierarchy hierarchy, IDebugRenderer debugRenderer, IConsoleHandle consoleHandle) { _physicsEventEngine = physicsEventEngine; _hierarchy = hierarchy; _debugRenderer = debugRenderer; _consoleHandle = consoleHandle; var collisionSystem = new CollisionSystemPersistentSAP { EnableSpeculativeContacts = true }; _physicsWorld = new JitterWorld(collisionSystem); _physicsWorld.ContactSettings.MaterialCoefficientMixing = ContactSettings.MaterialCoefficientMixingType.TakeMinimum; _physicsWorld.Gravity = new JVector(0, -10f, 0); _rigidBodyMappings = new List <RigidBodyMapping>(); _lastFramePosition = new Dictionary <int, Vector3>(); _lastFrameRotation = new Dictionary <int, Quaternion>(); _transformCache = new Dictionary <int, WeakReference <IHasTransform> >(); _physicsWorld.Events.BodiesBeginCollide += EventsOnBodiesBeginCollide; _physicsWorld.Events.BodiesEndCollide += EventsOnBodiesEndCollide; }
public CodeManagerService( IProjectManager projectManager, IConsoleHandle consoleHandle) { _projectManager = projectManager; _consoleHandle = consoleHandle; }
public RecentProjects( IEditorUserDataPathProvider editorUserDataPathProvider, IConsoleHandle consoleHandle) { _editorUserDataPathProvider = editorUserDataPathProvider; _consoleHandle = consoleHandle; _loadedTextures = new List <Texture2D>(); }
public CodeManagerService( IProjectManager projectManager, IConsoleHandle consoleHandle, IApiReferenceService apiReferenceService) { _projectManager = projectManager; _consoleHandle = consoleHandle; _apiReferenceService = apiReferenceService; }
public void Assign(IKernel kernel) { _kernel = kernel; _hierarchy = kernel.Hierarchy; _networkMessageSerialization = kernel.Get <INetworkMessageSerialization>(); _networkEngine = kernel.Get <INetworkEngine>(); _consoleHandle = kernel.Get <IConsoleHandle>(kernel.Hierarchy.Lookup(this)); _pendingEntityPropertyMessages = new Dictionary <int, List <Tuple <int, Event> > >(); }
public ExtensionBasedToolbarProvider( IConsoleHandle consoleHandle, IExtensionManager extensionManager) { _consoleHandle = consoleHandle; _extensionManager = extensionManager; _menuItems = new GenericToolbarEntry[0]; _ignoredExtensions = new List <WeakReference <Extension.Extension> >(); }
public ThumbnailSampler( IProjectManager projectManager, ILoadedGame loadedGame, IConsoleHandle consoleHandle, IGraphicsBlit graphicsBlit) { _projectManager = projectManager; _loadedGame = loadedGame; _consoleHandle = consoleHandle; _graphicsBlit = graphicsBlit; }
public ExtensionManager( IKernel kernel, IConsoleHandle consoleHandle, IGrpcServer grpcServer) { _kernel = kernel; _consoleHandle = consoleHandle; _extensions = new Dictionary <string, ManagedExtension>(); _grpcServer = grpcServer; _publicExtensions = new Extension[0]; _recomputeExtensions = false; }
public InspectorGameHostExtension( [Optional] IPhysicsEngine physicsEngine, IDebugRenderer debugRenderer, InspectorRenderPass inspectorRenderPass, IConsoleHandle consoleHandle) { _physicsEngine = physicsEngine; _debugRenderer = debugRenderer; _inspectorRenderPass = inspectorRenderPass; _consoleHandle = consoleHandle; _rigidBodyRef = new WeakReference <RigidBody>(null); }
public GrpcServer( IConsoleHandle consoleHandle, ConsoleImpl consoleImpl, ProjectManagerImpl projectManagerImpl, PresenceImpl presenceImpl, GameHosterImpl gameHosterImpl) { _consoleHandle = consoleHandle; _consoleImpl = consoleImpl; _projectManagerImpl = projectManagerImpl; _presenceImpl = presenceImpl; _gameHosterImpl = gameHosterImpl; }
public DefaultLoadedGame( IConsoleHandle consoleHandle, IProjectManager projectManager, IGrpcServer grpcServer, IRenderTargetBackBufferUtilities renderTargetBackBufferUtilities, ISharedRendererHostFactory sharedRendererHostFactory) { _consoleHandle = consoleHandle; _projectManager = projectManager; _grpcServer = grpcServer; _sharedRendererHost = sharedRendererHostFactory.CreateSharedRendererHost(); _sharedRendererHost.TexturesRecreated += OnTexturesRecreated; _formatter = new BinaryFormatter(); }
public ProjectManager( IRawLaunchArguments launchArguments, IConsoleHandle consoleHandle, ICoroutine coroutine, IRecentProjects recentProjects) { _coroutine = coroutine; _consoleHandle = consoleHandle; _recentProjects = recentProjects; var arguments = launchArguments.Arguments; var directoryIndex = Array.IndexOf(arguments, "--project"); if (!(directoryIndex == -1 || directoryIndex == arguments.Length - 1)) { LoadProject(arguments[directoryIndex + 1]); } }
public NetworkSynchronisationComponent( IConsoleHandle consoleHandle, INetworkEngine networkEngine, IUniqueIdentifierAllocator uniqueIdentifierAllocator, INetworkMessageSerialization networkMessageSerialization, IDebugRenderer debugRenderer) { _consoleHandle = consoleHandle; _networkEngine = networkEngine; _uniqueIdentifierAllocator = uniqueIdentifierAllocator; _networkMessageSerialization = networkMessageSerialization; _debugRenderer = debugRenderer; _clientsEntityIsKnownOn = new HashSet <MxClientGroup>(); _synchronisedData = new Dictionary <string, SynchronisedData>(); _synchronisedDataToTransmit = new List <SynchronisedData>(); _enabled = true; }
public DefaultLoadedGame( IProjectManager projectManager, ICoroutine coroutine, IConsoleHandle consoleHandle, IRenderTargetBackBufferUtilities renderTargetBackBufferUtilities) { _projectManager = projectManager; _coroutine = coroutine; _consoleHandle = consoleHandle; _renderTargetBackBufferUtilities = renderTargetBackBufferUtilities; _renderTargetSize = new Point(640, 480); _hasRunGameUpdate = false; _isReadyForMainThread = false; _mainThreadTasks = new List <Action>(); _renderTargets = new RenderTarget2D[RenderTargetBufferConfiguration.RTBufferSize]; _renderTargetSharedHandles = new IntPtr[RenderTargetBufferConfiguration.RTBufferSize]; _currentWriteTargetIndex = RenderTargetBufferConfiguration.RTBufferSize >= 2 ? 1 : 0; _currentReadTargetIndex = 0; }
public DefaultAssetManager( IKernel kernel, ICompiledAssetFs compiledAssetFs, IProfiler[] profilers, ICoroutine coroutine, IConsoleHandle consoleHandle) { _kernel = kernel; _compiledAssetFs = compiledAssetFs; _profiler = profilers.Length > 0 ? profilers[0] : null; _consoleHandle = consoleHandle; _assets = new Dictionary <string, ISingleAssetReference <IAsset> >(); _assetsToLoad = new ConcurrentQueue <ISingleAssetReference <IAsset> >(); _assetsToFinalize = new ConcurrentQueue <Tuple <IAsset, ISingleAssetReference <IAsset> > >(); _compiledAssetFs.RegisterUpdateNotifier(OnAssetUpdated); coroutine.Run(FinalizeAssets); }
public GraphicsDebugEngineHook(IConsoleHandle consoleHandle) { _consoleHandle = consoleHandle; }
public ConsoleImpl( IConsoleHandle consoleHandle) { _consoleHandle = consoleHandle; }
public void LoadFromPath( IConsoleHandle consoleHandle, IBaseDirectory baseDirectory, IBackBufferDimensions backBufferDimensions, string gameAssembly) { // Wrap the backbuffer dimensions service in a proxy, since GraphicsDevice can not // cross the AppDomain boundary. backBufferDimensions = new BackBufferDimensionsProxy(backBufferDimensions); // Load the target assembly. consoleHandle.LogDebug("Loading game assembly from " + gameAssembly + "..."); var assembly = Assembly.LoadFrom(gameAssembly); consoleHandle.LogDebug("Constructing standard kernel..."); var kernel = new StandardKernel(); kernel.Bind <IRawLaunchArguments>() .ToMethod(x => new DefaultRawLaunchArguments(new string[0])) .InSingletonScope(); // Bind our extension hook first so that it runs before everything else. kernel.Bind <IEngineHook>().To <ExtensionEngineHook>().InSingletonScope(); Func <System.Reflection.Assembly, Type[]> TryGetTypes = a => { try { return(a.GetTypes()); } catch { return(new Type[0]); } }; consoleHandle.LogDebug("Finding configuration classes in " + gameAssembly + "..."); var typeSource = new List <Type>(); foreach (var attribute in assembly.GetCustomAttributes(false)) { if (attribute.GetType().FullName == "Protogame.ConfigurationAttribute") { typeSource.Add(((ConfigurationAttribute)attribute).GameConfigurationOrServerClass); } } if (typeSource.Count == 0) { // Scan all types to find implementors of IGameConfiguration typeSource.AddRange(from type in TryGetTypes(assembly) select type); } consoleHandle.LogDebug("Found {0} configuration classes in " + gameAssembly, typeSource.Count); consoleHandle.LogDebug("Constructing game configurations..."); var gameConfigurations = new List <IGameConfiguration>(); foreach (var type in typeSource) { if (typeof(IGameConfiguration).IsAssignableFrom(type) && !type.IsInterface && !type.IsAbstract) { gameConfigurations.Add(Activator.CreateInstance(type) as IGameConfiguration); } } ICoreGame game = null; var hasBoundNewEventEngine = false; consoleHandle.LogDebug("Configuring kernel and constructing game instance ({0} configurations)...", gameConfigurations.Count); foreach (var configuration in gameConfigurations) { consoleHandle.LogDebug("Configuring with {0}...", configuration.GetType().FullName); configuration.ConfigureKernel(kernel); // Rebind services so the game renders correctly inside the editor. kernel.Rebind <IBaseDirectory>().ToMethod(x => baseDirectory).InSingletonScope(); kernel.Rebind <IBackBufferDimensions>().ToMethod(x => backBufferDimensions).InSingletonScope(); kernel.Rebind <IDebugRenderer>().To <DefaultDebugRenderer>().InSingletonScope(); var bindings = kernel.GetCopyOfBindings(); var mustBindNewEventEngine = false; if (bindings.ContainsKey(typeof(IEngineHook))) { if (bindings[typeof(IEngineHook)].Any(x => x.Target == typeof(EventEngineHook))) { mustBindNewEventEngine = !hasBoundNewEventEngine; kernel.UnbindSpecific <IEngineHook>(x => x.Target == typeof(EventEngineHook)); } if (mustBindNewEventEngine) { kernel.Bind <IEngineHook>().ToMethod(ctx => { _editorEventEngineHook = ctx.Kernel.Get <EditorEventEngineHook>(ctx.Parent); return(_editorEventEngineHook); }).InSingletonScope(); } } if (game == null) { game = configuration.ConstructGame(kernel); } } if (game != null) { consoleHandle.LogDebug("Game instance is {0}", game.GetType().FullName); } _game = game; _logShipping = kernel.Get <ILogShipping>(); _consoleHandle = consoleHandle; consoleHandle.LogDebug("LoadFromPath complete"); }
public Logger(IConsoleHandle consoleHandle) { _consoleHandle = consoleHandle; }
public ExtensionConsoleHandle(IConsoleHandle consoleHandle) { _consoleHandle = consoleHandle; }
public MarshallableConsoleHandle(IConsoleHandle realImpl) { _realImpl = realImpl; }
public DefaultStaticBatching(IHierarchy hierarchy, IBatchedControlFactory batchedControlFactory, IConsoleHandle consoleHandle) { _hierarchy = hierarchy; _batchedControlFactory = batchedControlFactory; _consoleHandle = consoleHandle; }