Esempio n. 1
0
        public Creator(ICharService service, IMudConfiguration config)
        {
            this.service = service ?? throw new ArgumentNullException(nameof(service));
            this.config  = config ?? throw new ArgumentNullException(nameof(config));

            this.Action[UserStatus.Create]          = this.Create;
            this.Action[UserStatus.GetNameNom]      = this.GetNameNom;
            this.Action[UserStatus.GetNameGen]      = this.GetNameGen;
            this.Action[UserStatus.GetNameDat]      = this.GetNameDat;
            this.Action[UserStatus.GetNameAcc]      = this.GetNameAcc;
            this.Action[UserStatus.GetNameIns]      = this.GetNameIns;
            this.Action[UserStatus.GetNamePre]      = this.GetNamePre;
            this.Action[UserStatus.GetGender]       = this.GetGender;
            this.Action[UserStatus.CreatePassword]  = this.CreatePassword;
            this.Action[UserStatus.ConfirmPassword] = this.ConfirmPassword;
            this.Action[UserStatus.GetEmail]        = this.GetEmail;
            this.Action[UserStatus.ConfirmCheck]    = this.ConfirmCheck;

            this.Prompt[UserStatus.GetNameNom]      = "Введите имя персонажа в именительном падеже – здесь стоит кто?";
            this.Prompt[UserStatus.GetNameGen]      = "Родительный – это вещи кого?";
            this.Prompt[UserStatus.GetNameDat]      = "Дательный – дать денег кому?";
            this.Prompt[UserStatus.GetNameAcc]      = "Винительный – позвать кого?";
            this.Prompt[UserStatus.GetNameIns]      = "Творительный – сражаться с кем?";
            this.Prompt[UserStatus.GetNamePre]      = "Предложный – думать о ком?";
            this.Prompt[UserStatus.GetGender]       = "Укажите пол персонажа (м/ж/с)";
            this.Prompt[UserStatus.CreatePassword]  = "Придумайте пароль";
            this.Prompt[UserStatus.ConfirmPassword] = "Повторите пароль для проверки";
            this.Prompt[UserStatus.GetEmail]        = "Укажите электронный адрес на всякий случай";
            this.Prompt[UserStatus.ConfirmCheck]    = "Проверьте, все ли правильно:";
        }
Esempio n. 2
0
        public Launcher(ICharService charService,
                        ICommandHandler commandHandler,
                        IWorldKeeper worldKeeper)
        {
            this.worldKeeper    = worldKeeper ?? throw new ArgumentNullException(nameof(worldKeeper));
            this.charService    = charService ?? throw new ArgumentNullException(nameof(charService));
            this.commandHandler = commandHandler ?? throw new ArgumentNullException(nameof(commandHandler));

            this.Action[UserStatus.Launch] = this.Launch;
        }
Esempio n. 3
0
        public Authenticator(ICharService service)
        {
            this.service = service ?? throw new ArgumentNullException(nameof(service));

            this.Action[UserStatus.Connected]   = this.InitialPrompt;
            this.Action[UserStatus.GetLogin]    = this.GetLogin;
            this.Action[UserStatus.GetPassword] = this.GetPassword;

            this.Prompt[UserStatus.GetLogin]    = "Введите имя вашего персонажа, или 'создать'";
            this.Prompt[UserStatus.GetPassword] = "Введите пароль";
        }
Esempio n. 4
0
 public InputHandlerChain(ICommandHandler commandHandler,
                          ICharService charService,
                          IMudConfiguration config,
                          IWorldKeeper worldKeeper)
 {
     (this.chain = new Disconnecter())
     .Then(new Cleanser())
     .Then(new Echo())
     .Then(new Commander(commandHandler))
     .Then(new Authenticator(charService))
     .Then(new Creator(charService, config))
     .Then(new Launcher(charService, commandHandler, worldKeeper));
 }