public static void HandleMessage(ConfirmJoiningGame request, CommunicationServer server, Socket handler)
        {
            HandleMessage(request as PlayerMessage, server, handler);

            Game.IGame g = server.RegisteredGames.GetGameById((int)request.gameId);
            g.Players.Add(new Game.Player {
                Id = request.playerId
            });
        }
        public static void HandleMessage(JoinGame request, CommunicationServer server, Socket handler)
        {
            if (request == null)
            {
                return;
            }

            //if (server.startedGames.Contains(request.gameName))
            //{
            //    ConsoleDebug.Error("Game already started");
            //    return;
            //}


            Game.IGame g = server.RegisteredGames.GetGameByName(request.gameName);
            if (g == null)
            {
                ConsoleDebug.Error("Game with specified name not found");
                return;
            }
            if (g.HasStarted)
            {
                ConsoleDebug.Error("Game already started");
                return;
            }

            lock (joinLock)
            {
                request.playerId          = server.IdForNewClient();
                request.playerIdSpecified = true;
                server.Clients.Add(request.playerId, handler);
                g.Players.Add(new Game.Player {
                    Id = request.playerId
                });
            }

            var response = XmlMessageConverter.ToXml(request);

            server.ConnectionEndpoint.SendFromServer(g.GameMaster, response);
            return;
        }
Ejemplo n.º 3
0
 private void gentagRækkefølgenToolStripMenuItem_Click(object sender, EventArgs e)
 {
     _game = new GameFactory().Construct(GameFactory.GameTypes.RepeatTheCombination);
     PrepareGame();
 }
Ejemplo n.º 4
0
 private void reactionsTestToolStripMenuItem_Click(object sender, EventArgs e)
 {
     _game = new GameFactory().Construct(GameFactory.GameTypes.PressTheLitButton);
     PrepareGame();
 }
Ejemplo n.º 5
0
 public WidgetComponent(Game.IGame mainGame) : base(mainGame.MonoGame)
 {
     MainGame = mainGame;
 }
Ejemplo n.º 6
0
 public HandleAnimation(Game.IGame mainGame, ISettings settings = null) : base(mainGame)
 {
     this.settings = settings ?? new DefaultSettings();
 }