public ModdableChessGame() { this.Components.Register((int)ComponentKeys.GameDatabase, new GameDatabase()); ServerInformation si = new ServerInformation(); this.Components.Register((int)ComponentKeys.ServerInformation, si); AddTicking(si); LocalPlayerInformation lpi = new LocalPlayerInformation(); this.Components.Register((int)ComponentKeys.LocalPlayerInformation, lpi); AddTicking(lpi); this.Components.Register((int)ComponentKeys.LobbyChoices, new LobbyChoices()); new ServerController(this); new Server.LobbyInitReadyCheck(this); new Server.ServerLobbyMessages(this); new Server.LoadingManager(this); new Server.BoardController(this); new ClientController(this); new Client.ClientLobbyInit(this); new Client.LobbyMessages(this); new Client.LoadingManager(this); new Client.BoardController(this); new ConnectionHelper(this); new Mods.ScriptController(this); }
public GameStateCompiler(AutoController scene) { localPlayer = scene.Game.Components.Get <LocalPlayerInformation>((int)ComponentKeys.LocalPlayerInformation); scene.Components.GetOrRegister((int)ComponentKeys.CompileCurrentGameState, Query <NetworkGameState> .Create).Handler = CompileState; scene.Components.GetOrRegister <Message <Board> >((int)ComponentKeys.BoardCreatedMessage, Message <Board> .Create) .Subscribe(new SimpleListener <Board>((b) => board = b)); }
public ConnectionHelper(ModdableChessGame game) { game.Components.Register((int)ComponentKeys.ConnectionHelper, this); localInfo = game.Components.GetOrRegister <LocalPlayerInformation>((int)ComponentKeys.LocalPlayerInformation, LocalPlayerInformation.Create); serverInfo = game.Components.GetOrRegister <ServerInformation>((int)ComponentKeys.ServerInformation, ServerInformation.Create); startHostCommand = game.Components.GetOrRegister <Query <bool, StartHostCommand> > ((int)ComponentKeys.StartHostCommand, Query <bool, StartHostCommand> .Create); stopHostCommand = game.Components.GetOrRegister <Command>((int)ComponentKeys.StopHostCommand, Command.Create); startClientCommand = game.Components.GetOrRegister <Query <bool, StartClientCommand> > ((int)ComponentKeys.StartClientCommand, Query <bool, StartClientCommand> .Create); stopClientCommand = game.Components.GetOrRegister <Command>((int)ComponentKeys.StopClientCommand, Command.Create); state = new StateMachine((int)State.None); localInfo.Connection.EnterStateMessenger.Subscribe(new SimpleListener <int>((s) => OnClientConnectionChange())); serverInfo.Connection.EnterStateMessenger.Subscribe(new SimpleListener <int>((s) => OnServerConnectionChange())); state.EnterStateMessenger.Subscribe(new SimpleListener <int>((s) => UnityEngine.Debug.LogError(string.Format("{0}: Helper connection change {2}-{1}", game.TickCount, (State)s, mode)))); }
public MatchManager(AutoController scene) { scene.Game.AddTicking(this); scene.Components.GetOrRegister <Message <Board> >((int)ComponentKeys.BoardCreatedMessage, Message <Board> .Create) .Subscribe(new SimpleListener <Board>(ReceivedNewBoard)); localInfo = scene.Game.Components.GetOrRegister <LocalPlayerInformation>((int)ComponentKeys.LocalPlayerInformation, LocalPlayerInformation.Create); matchState = scene.Components.GetOrRegister <StateMachine>((int)ComponentKeys.MatchState, StateMachine.Create); startTurnCommand = scene.Components.GetOrRegister <Command <bool> >((int)ComponentKeys.NextTurnCommand, Command <bool> .Create); gameOverMessage = scene.Components.GetOrRegister <Message <GameEndType> >((int)ComponentKeys.GameEnd, Message <GameEndType> .Create); checkGameOver = scene.Components.GetOrRegister <Query <EoTScriptState> >((int)ComponentKeys.GameOverQuery, Query <EoTScriptState> .Create); sendEoTState = scene.Game.Components.GetOrRegister <Command <EndOfTurnState> >((int)ComponentKeys.SendEndOfTurnState, Command <EndOfTurnState> .Create); stopRefreshEoTState = scene.Game.Components.GetOrRegister <Command>((int)ComponentKeys.StopRefreshEndOfTurnState, Command.Create); turnStateChange = scene.Components.GetOrRegister <Message>((int)ComponentKeys.TurnState, Message.Create); turnStateChange.Subscribe(new SimpleListener(OnTurnStateChange)); scene.Components.GetOrRegister <Command <TurnActionExecutionResult> > ((int)ComponentKeys.HandleEndOfTurn, Command <TurnActionExecutionResult> .Create).Handler = DoEndOfTurn; scene.ActivatableList.Add(new ListenerJanitor <IListener <ServerEndOfTurnState> >( scene.Game.Components.GetOrRegister <Message <ServerEndOfTurnState> >((int)ComponentKeys.EndOfTurnStateReceived, Message <ServerEndOfTurnState> .Create), new SimpleListener <ServerEndOfTurnState>(OnReceivedEndOfTurnState))); }
public BoardCreator(AutoController scene) { localPlayer = scene.Game.Components.Get <LocalPlayerInformation>((int)ComponentKeys.LocalPlayerInformation); scene.Components.GetOrRegister <Query <Board, NetworkGameState> > ((int)ComponentKeys.CreateBoardCommand, Query <Board, NetworkGameState> .Create).Handler = CreateBoard; }