示例#1
0
文件: Command.cs 项目: Bovan89/Sudoku
        private string Join()
        {
            if (Games != null)
            {
                SudokuGame game = Games.Get(new Guid(GameId));
                if (!game.AddPlayer(new Player(Name, WebSocket)))
                {
                    return("error#Такой игрок уже в игре");
                }

                return(String.Format("{0}#{1}#{2}#{3}", "join", game.Id, game.SudokuGrid.ToString(), Name));
            }

            return("");
        }
示例#2
0
文件: Command.cs 项目: Bovan89/Sudoku
        private string New()
        {
            if (Games != null)
            {
                int size      = Convert.ToInt32(GameId);
                int difficult = Convert.ToInt32(X);

                SudokuGame game = new SudokuGame(new SudokuGrid(size, difficult), Games);
                game.Name = Y;
                game.AddPlayer(new Player(Name, WebSocket));

                return(String.Format("{0}#{1}#{2}#{3}", "new", game.Id, game.SudokuGrid.ToString(), Name));
            }

            return("");
        }