public GameStartGenerator(ModLoadingScene scene) { lobby = scene.Game.Components.Get <LobbyChoices>((int)ComponentKeys.LobbyChoices); db = scene.Game.Components.Get <GameDatabase>((int)ComponentKeys.GameDatabase); scripts = scene.Game.Components.Get <ScriptController>((int)ComponentKeys.LuaScripts); scene.Components.GetOrRegister((int)ComponentKeys.CalculateStartConditions, Query <NetworkGameState> .Create) .Handler = CalculateStartingConditions; }
public ModLoadingScene(ModdableChessGame game) : base(game) { connHelper = game.Components.Get <ConnectionHelper>((int)ComponentKeys.ConnectionHelper); ActivatableList.Add(new ListenerJanitor <IListener <int> >( connHelper.Connection.EnterStateMessenger, new SimpleListener <int>((s) => CheckDisconnect()))); phase = new StateMachine(0); phase.EnterStateMessenger.Subscribe(new SimpleListener <int>((s) => OnStateChange())); timer = 1; lobbyChoices = game.Components.Get <LobbyChoices>((int)ComponentKeys.LobbyChoices); startGenerator = Components.GetOrRegister <Query <NetworkGameState> >((int)ComponentKeys.CalculateStartConditions, Query <NetworkGameState> .Create); reqModLoad = Components.GetOrRegister((int)ComponentKeys.DeepLoadMod, Command <string> .Create); sendGameState = Game.Components.Get <Command <NetworkGameState> >((int)ComponentKeys.LoadingGameStateSend); stopRefreshGameState = Game.Components.Get <Command>((int)ComponentKeys.LoadingGameStateStopRefreshing); sendReady = Game.Components.Get <Command <bool> >((int)ComponentKeys.LoadingReadySend); sendError = Game.Components.Get <Command>((int)ComponentKeys.LoadingErrorSend); loadingError = Components.GetOrRegister((int)ComponentKeys.ModLoadError, Message <string> .Create); loadingError.Subscribe(new SimpleListener <string>(OnModLoadError)); Components.GetOrRegister((int)ComponentKeys.ModTranslationComplete, Message.Create).Subscribe(new SimpleListener(OnModTranslated)); ActivatableList.Add(new ListenerJanitor <IListener <NetworkGameState> >( Game.Components.Get <IMessage <NetworkGameState> >((int)ComponentKeys.LoadingGameStateReceived), new SimpleListener <NetworkGameState>(OnReceiveConditions))); ActivatableList.Add(new ListenerJanitor <IListener>( Game.Components.Get <IMessage>((int)ComponentKeys.LoadingExitReceived), new SimpleListener(ReadyToPlay))); ActivatableList.Add(new ListenerJanitor <IListener>( Game.Components.Get <IMessage>((int)ComponentKeys.LoadingErrorReceived), new SimpleListener(ExitToLobby))); new GameStartGenerator(this); new BoardCreator(this); new ModErrorLog(this); CheckDisconnect(); }