Ejemplo n.º 1
0
        public ServerReadyCheckManager(ModdableChessGame game, float timeOutPeriod)
        {
            game.AddTicking(this);
            this.timeOutPeriod = timeOutPeriod;

            connections = new List <ConnectionData>();
            serverInfo  = game.Components.Get <ServerInformation>((int)ComponentKeys.ServerInformation);

            game.Components.Get <ServerInformation>((int)ComponentKeys.ServerInformation).Connection.EnterStateMessenger.Subscribe(
                new SimpleListener <int>((s) => CheckServerConnection()));
        }
Ejemplo n.º 2
0
        public ServerController(ModdableChessGame game)
        {
            game.AddTicking(this);

            info = game.Components.GetOrRegister <ServerInformation>((int)ComponentKeys.ServerInformation, ServerInformation.Create);
            ClearServerInfo();
            game.Components.Register((int)ComponentKeys.Server_Callbacks, this);
            game.Components.GetOrRegister <Query <bool, StartHostCommand> >((int)ComponentKeys.StartHostCommand, Query <bool, StartHostCommand> .Create)
            .Handler = StartHost;
            game.Components.GetOrRegister <Command>((int)ComponentKeys.StopHostCommand, Command.Create)
            .Handler = StopHost;

            info.Connection.EnterStateMessenger.Subscribe(new SimpleListener <int>((s) =>
                                                                                   UnityEngine.Debug.LogError(string.Format("{0}: Server connection change {1}", game.TickCount, (ServerConnectionState)s))));
            disconnectNextFrame = new Queue <int>();

            //new ReconnectionServerManager(game);
            //new ServerReadyCheckManager(game);
            //new ServerLoadingErrorManager(game);
        }