Example #1
0
        public void Startup(IServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }

            _logger = serviceProvider.GetRequiredService <ILogger>();

            _engine = serviceProvider.GetRequiredService <IClientEngine>();

            _networking = serviceProvider.GetRequiredService <ClientNetworking>();

            _entities = serviceProvider.GetRequiredService <ClientEntities>();

            _clientUI = new ImGuiInterface(_logger, _engine, this);

            _renderer = new Renderer.Renderer(
                _engine.GameWindow,
                _logger,
                _engine.FileSystem,
                _engine.CommandContext,
                _engine.UserInterface.WindowManager.InputSystem,
                _engine.Time,
                this,
                Framework.Path.EnvironmentMaps,
                Framework.Path.Shaders);

            _engine.GameWindow.Resized += _renderer.WindowResized;

            _entities.Startup(_renderer);
        }
Example #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="theClientUI">The UI to use</param>
        public InternalPipeClient(IClientUI theClientUI)
        {
            SendPipeMessage += Send;
            TheUI            = theClientUI;
            TheUI.OnExiting += Stop;
            // Initialize the BinaryFormatter used to serialize the messages
            itsFormatter = new BinaryFormatter();

            var(anAddress, aPipeName) = TheUI.GetConnectionInfo();
            if (!string.IsNullOrEmpty(anAddress) && !string.IsNullOrEmpty(aPipeName))
            {
                ServerName = anAddress;
                PipeName   = aPipeName;

                TheUI.Start(this as IPipeMessageSender);

                // Initialize the NamedPipeClientStream
                itsPipeClient = new NamedPipeClientStream(ServerName, PipeName, PipeDirection.InOut, PipeOptions.Asynchronous);

                // Start a new async Task in which to connect to the server
                Task aClientTask = new Task(ClientThread);
                aClientTask.Start();
            }
        }