コード例 #1
0
        public string Execute(string username, ClientCommand command)
        {
            try
            {
                engine.Execute(username, command);

                if (command is JoinGameCommand || command is LeaveGameCommand || command is StartGameCommand)
                {
                    UpdateSummary();
                }

                if (engine.Model.IsFinished)
                {
                    UpdateSummary();
                    GameEnded?.Invoke(name);
                }

                return(null);
            }
            catch (CommandException e)
            {
                return($"{username}: error executing command {command.GetType().Name}: {e.Message}");
            }
        }