Esempio n. 1
0
        protected AGame(IMessageChannel textChan, IUser _, IPreload preload, IPostMode postMode, IMultiplayerMode multiplayerMode, GameSettings settings)
        {
            _state    = GameState.PREPARE;
            _textChan = textChan;
            if (_textChan is ITextChannel)
            {
                _guildId = ((ITextChannel)_textChan).GuildId;
            }
            else
            {
                throw new CommandFailed("Games are not yet available in private message."); // TODO!
            }
            _postMode        = postMode;
            _multiplayerMode = multiplayerMode;
            _lobby           = settings.Lobby;

            _gameName = preload.GetGameNames()[0];
            _argument = preload.GetNameArg();

            textChan.SendMessageAsync(preload.GetRules() + $"\n\nYou will loose if you don't answer after {GetGameTime()} seconds\n\n" +
                                      "If the game break, you can use the 'Cancel' command to cancel it.\n" +
                                      "You can cooperate with other players to find the answers." +
                                      (_postMode is AudioMode ? "\nYou can listen again to the audio using the 'Replay' command." : "") +
                                      (_lobby != null ? "\n\n**You can join the lobby for the game by doing the 'Join' command**\nThe game will automatically start in " + _lobbyTimer + " seconds, you can start it right away using the 'Start' command" : "")).GetAwaiter().GetResult();

            _messages = new List <SocketUserMessage>();

            _contributors = new List <ulong>();
            _score        = 0;

            StaticObjects.Website?.AddGameAsync(_gameName, _argument);
        }
Esempio n. 2
0
        protected AGame(IMessageChannel textChan, IUser _, IPreload preload, IPostMode postMode, IMultiplayerMode versusMode, GameSettings settings)
        {
            _state    = GameState.Prepare;
            _textChan = textChan;
            if (_textChan is ITextChannel)
            {
                _guildId = ((ITextChannel)_textChan).GuildId;
            }
            else
            {
                throw new CommandFailed("Games are not yet available in private message."); // TODO!
            }
            _postMode     = postMode;
            _versusMode   = versusMode;
            _lobby        = settings.Lobby;
            _isCustomGame = settings.IsCustomGame;

            _gameName = preload.Name;
            _argument = null;// preload.GetNameArg();
            _messages = new List <ICommandContext>();
            _preload  = preload;

            _contributors = new List <ulong>();
            _score        = 0;

            _lobby.InitVersusRules(_versusMode.GetRules());
        }
Esempio n. 3
0
 /// <summary>
 /// Called by QuizzAudio
 /// </summary>
 public Quizz(IMessageChannel textChan, IUser user, IPreload preload, GameSettings settings, IPostMode mode, bool doesCongratulate) : base(textChan, user, preload, mode, new SpeedMode(), settings)
 {
     _words            = new List <QuizzPreloadResult>(preload.Load().Cast <QuizzPreloadResult>());
     _allValidNames    = _words.SelectMany(x => x.Answers).ToArray();
     _doesCongratulate = doesCongratulate;
 }