示例#1
0
        public Runmode(ILoggerFactory loggerFactory, BaseConfig baseConfig, Func <RunmodeConfig> configLoader)
        {
            RunmodeConfig runmodeConfig = configLoader();

            _logger    = loggerFactory.CreateLogger <Runmode>();
            _stopToken = new StopToken();
            Setups.Databases repos = Setups.SetUpRepositories(_logger, baseConfig);
            (_broadcastServer, _overlayConnection) = Setups.SetUpOverlayServer(loggerFactory);
            _modeBase = new ModeBase(loggerFactory, repos, baseConfig, _stopToken, _overlayConnection, ProcessMessage);
            _modeBase.InstallAdditionalCommand(new Command("reloadinputconfig", _ =>
            {
                ReloadConfig(configLoader().InputConfig);
                return(Task.FromResult(new CommandResult {
                    Response = "input config reloaded"
                }));
            }));

            // TODO felk: this feels a bit messy the way it is done right now,
            //            but I am unsure yet how I'd integrate the individual parts in a cleaner way.
            InputConfig inputConfig = runmodeConfig.InputConfig;

            _inputParser      = inputConfig.ButtonsProfile.ToInputParser();
            _inputBufferQueue = new InputBufferQueue <QueuedInput>(CreateBufferConfig(inputConfig));
            _anarchyInputFeed = CreateInputFeedFromConfig(inputConfig);
            _inputServer      = new InputServer(loggerFactory.CreateLogger <InputServer>(),
                                                runmodeConfig.InputServerHost, runmodeConfig.InputServerPort,
                                                _anarchyInputFeed);
        }
示例#2
0
 protected void OpenInputServer()
 {
     if (!IsSupportNetInput)
     {
         return;
     }
     if (inputServer == null)
     {
         inputServer = new InputServer(netInputPort, supportPlayers,
                                       netInputGameName, netInputDevice, netInputDeviceFunction);
     }
     inputServer.Start();
 }
示例#3
0
        /**
         * Class constructor
         */
        public Client(TransportClient transport, IClientListener clientListener)
        {
            this.clientListener = clientListener;

            dispatcher = new ChannelDispatcher();

            transport.SetChannelDispatcher(dispatcher);

            surfaceServer = new SurfaceServer(transport, this);
            dispatcher.RegisterChannel(surfaceServer);

            sessionServer = new SessionServer(transport, this);
            dispatcher.RegisterChannel(sessionServer);

            inputServer = new InputServer(transport, this);
            dispatcher.RegisterChannel(inputServer);

            transport.StartThread();

            dispatcher.OnConnect();
        }
示例#4
0
 void Awake()
 {
     _instance = this;
     Input.simulateMouseWithTouches = true;
 }