public override void HandleInput(KeyboardState keyboard, MouseState mouse) { if (keyboard.IsKeyDown(Keys.Enter) && this.input.Length > 0 && !this.connecting) { this.cloudMessenger = new CloudMessenger("spacestro", this.input.ToString()); this.connecting = true; //LoadingScreen.Load(this.ScreenManager, true, new SpacestroScreen(this.input.ToString())); } else if (keyboard.IsKeyDown(Keys.Escape) && !this.connecting) { this.ScreenManager.AddScreen(new MainMenuScreen()); } }
void SingleplayerGameMenuEntrySelected(object sender, EventArgs e) { // start a thread with the server Spacestro.Cloud.Cloud cloud = new Spacestro.Cloud.Cloud("spacestro", 8383); ThreadStart serverStart = new ThreadStart(cloud.Start); Thread serverThread = new Thread(serverStart); serverThread.Name = "Single Player Server"; serverThread.Start(); // create cloudMessenger CloudMessenger messenger = new CloudMessenger("spacestro", "localhost"); // HACK: ghettofabulous. while (!messenger.Connected) { ; } // launch the game with the cloud messenger LoadingScreen.Load(this.ScreenManager, true, new SpacestroScreen(messenger, spServer: cloud)); }
public SpacestroScreen(CloudMessenger messenger, Thread spServerThread = null, Spacestro.Cloud.Cloud spServer = null) { this.cloudMessenger = messenger; this.spServerThread = spServerThread; this.spServer = spServer; }