Exemplo n.º 1
0
        public void btnApplyTag_Click(object sender, EventArgs e)
        {
            PromptHelper prompt;

            if (string.IsNullOrEmpty(hdnShowId.Value))
            {
                return;
            }

            if (ddlTags.SelectedValue == "-1")
            {
                prompt = new PromptHelper("Please choose a valid tag.");
                Page.RegisterStartupScript(prompt.ScriptName, prompt.GetErrorScript());
            }

            var showId = new Guid(hdnShowId.Value);

            var success = false;

            try {
                var tagId = new Guid(ddlTags.SelectedValue);

                var showTag = _DomainObjectFactory.CreateShowTag(showId, tagId, GetUserId());

                _ShowTagService.SaveCommit(showTag, out success);
            }
            catch (Exception ex) {
                _Log.WriteFatal("THERE WAS AN ERROR APPLYING A TAG ON NOTES.ASPX with message: " + ex.Message);
                success = false;
            }

            ValidateTags(success, "There was an error applying the tag.", showId);
        }
Exemplo n.º 2
0
 internal void LoadConfigFromJSON(string filename)
 {
     this.filename = filename;
     PromptHelper.ShowPromptInfo("");
     PromptHelper.ShowPromptHighlight($"Not implemented yet.");
     PromptHelper.ShowPromptInfo("");
 }
Exemplo n.º 3
0
        public async Task ChoiceReceivedAsync(IDialogContext context, IAwaitable <string> argument)
        {
            try
            {
                var answer = await argument;

                switch (answer)
                {
                case OptionHelp:
                    context.Call(new RoadAssistanceDialog(), CompleteDialogResumeAfter);
                    break;

                case OptionGlass:
                    context.Call(new AutoGlassDialog(), CompleteDialogResumeAfter);
                    break;

                case OptionClaim:
                    context.Call(new ReportClaimDialog(), CompleteDialogResumeAfter);
                    break;
                }
            }
            catch (TooManyAttemptsException)
            {
                await PromptHelper.HandleTooManyAttempts(context);
            }
        }
Exemplo n.º 4
0
        protected void ShowError(string errorMessage)
        {
            var prompt      = new PromptHelper(errorMessage);
            var errorScript = prompt.GetErrorScript();

            Page.RegisterStartupScript("validateSuccess", errorScript);
        }
        public static CredentialsPromptResult PromptForCredentials(ref string username, ref string password, ICredentialsDomain domain)
        {
            CredentialsPromptResult result;

            if (BlogClientUIContext.SilentModeForCurrentThread)
                return CredentialsPromptResult.Abort;

            IBlogClientUIContext uiContext = BlogClientUIContext.ContextForCurrentThread;
            if (uiContext != null)
            {
                PromptHelper promptHelper = new PromptHelper(uiContext, username, password, domain);
                if (uiContext.InvokeRequired)
                    uiContext.Invoke(new InvokeInUIThreadDelegate(promptHelper.ShowPrompt), new object[0]);
                else
                {
                    promptHelper.ShowPrompt();

                    //force a UI loop so that the dialog closes without hanging while post-dialog logic executes
                    Application.DoEvents();
                }

                result = promptHelper.Result;
                if (result != CredentialsPromptResult.Cancel)
                {
                    username = promptHelper.Username;
                    password = promptHelper.Password;
                }
            }
            else
            {
                result = CredentialsPromptResult.Abort;
            }
            return result;
        }
Exemplo n.º 6
0
        private static string GetCreepUIMessageCampInfoContent(Units inAttacker)
        {
            if (Singleton <PvpManager> .Instance.IsObserver)
            {
                return(PromptHelper.GetFriendlyText(inAttacker.TeamType));
            }
            int num;

            if (inAttacker.isPlayer)
            {
                num = 162;
            }
            else if (inAttacker.isMyTeam)
            {
                num = 163;
            }
            else
            {
                num = 164;
            }
            SysPromptVo dataById = BaseDataMgr.instance.GetDataById <SysPromptVo>(num.ToString());

            if (dataById != null)
            {
                return(LanguageManager.Instance.GetStringById(dataById.prompt_text));
            }
            return(string.Empty);
        }
Exemplo n.º 7
0
        public bool WithDraw(string accountNumber)
        {
            Console.WriteLine("Nhập số tiền bạn muốn rút: ");

            var amount = PromptHelper.GetAmount();
            //confirm
            string confirmMessage = $"Bạn có muốn rút {amount} không ? ";
            var    isConfirm      = PromptHelper.ConfirmUser(confirmMessage);

            if (isConfirm == false)
            {
                return(false);
            }

            Console.WriteLine();
            if (_accountModel.Withdraw(accountNumber, amount))
            {
                Console.WriteLine($"Đã rút {amount} thành công từ tài khoản {accountNumber} phí giao dịch 1100đ");
                Console.WriteLine("Số dư tại thời điểm giao dịch: " +
                                  _accountModel.GetCurrentBalanceByAccountNumber(accountNumber));
                return(true);
            }

            return(false);
        }
Exemplo n.º 8
0
        public void btnCreateTag_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtNewTagName.Text))
            {
                return;
            }

            HideShowList();
            var userId = GetUserId();

            var tag = _tagService.GetTag(txtNewTagName.Text.Trim(), userId);

            PromptHelper prompt;

            if (tag != null)
            {
                prompt = new PromptHelper("You already have a tag with the same name. Please choose it from your list or give it a new name.");
                Page.RegisterStartupScript(prompt.ScriptName, prompt.GetErrorScript());
                return;
            }

            var success = false;

            try {
                var newTag = _DomainObjectFactory.CreateTag(txtNewTagName.Text, userId);
                _tagService.SaveCommit(newTag, out success);
            }
            catch (Exception ex) {
                _Log.WriteFatal("THERE WAS AN ERROR SAVING A NEW TAG ON TAGS.ASPX with message: " + ex.Message);
                success = false;
            }

            Bind();
            ValidateSuccess(success, "You have saved your tag successfully.", "There was an error saving your tag.");
        }
Exemplo n.º 9
0
        public bool UpdatePassWord(string accountNumber)
        {
            var account = _accountModel.GetAccountByAccountNumber(accountNumber);

            Console.WriteLine("Nhập mật khẩu cũ của bạn: ");
            string oldPassWord = PromptHelper.GetPassword();

            // mã hóa pass người dùng nhập vào kèm theo muối trong database và so sánh kết quả với password đã được mã hóa trong database.
            if (account != null && _passwordHelper.ComparePassword(oldPassWord, account.Salt, account.PasswordHash))
            {
                string newPassword;
                while (true)
                {
                    Console.WriteLine("nhập mật khẩu mới");
                    newPassword = PromptHelper.GetPassword();
                    if (!ValidateHelper.IsPasswordValid(newPassword))
                    {
                        Console.WriteLine("Mật khẩu không hợp lệ mời nhập lại");
                    }
                    else if (oldPassWord.Equals(newPassword))
                    {
                        Console.WriteLine("Bạn đã nhập mật khẩu cũ mời nhập lại");
                    }
                    else
                    {
                        break;
                    }
                }

                //confirm new password
                Console.WriteLine("Hãy nhập lại mật khẩu để xác nhận");
                string confirmNewPassword = "";
                while (true)
                {
                    confirmNewPassword = PromptHelper.GetPassword();
                    if (confirmNewPassword.Equals(newPassword))
                    {
                        break;
                    }

                    Console.WriteLine("Mật khẩu không khớp, hãy nhập lại");
                }

                //update md5hash
                string newHashPassWord = _passwordHelper.MD5Hash(newPassword + account.Salt);
                var    updateSuccess   = _accountModel.UpdateAccountByAccountNumber(accountNumber, "hashPassword", newHashPassWord);
                if (updateSuccess)
                {
                    Console.WriteLine("Đã cập nhật mật khẩu thành công");
                    return(true);
                }
                return(false);
            }

            Console.WriteLine("Bạn đã nhập sai mật khẩu");
            return(false);
        }
Exemplo n.º 10
0
 internal void LoadConfigFromJSON(string filename)
 {
     this.filename = filename;
     PromptHelper.ShowPromptInfo("");
     PromptHelper.ShowPromptHighlight($"Please use ConsolePrintNet.exe included in your PrintServer with command line.");
     PromptHelper.ShowPromptHighlight($"Example: ");
     PromptHelper.ShowPromptHighlight($"ConsolePrintNet.exe -configurationfile:\"{filename}\"");
     PromptHelper.ShowPromptInfo("");
 }
Exemplo n.º 11
0
        public void GenerateMainMenu()
        {
            while (true)
            {
                Console.WriteLine("-------------------------- Ngân Hàng Spring Hero Bank --------------------------");
                Console.WriteLine("1. Đăng ký tài khoản.");
                Console.WriteLine("2. Đăng Nhập hệ thống.");
                Console.WriteLine("3. Thoát");
                Console.WriteLine("---------------------------------------------------------------------------------");
                Console.WriteLine("Nhập lựa chọn của bạn (1, 2, 3)");
                var choice = PromptHelper.GetUserChoice(1, 3);
                switch (choice)
                {
                case 1:
                    Console.WriteLine("Đăng ký tài khoản");
                    Console.WriteLine(
                        "---------------------------------------------------------------------------------");
                    //goi controller -> de navigate user
                    break;

                case 2:
                    Console.WriteLine("Đằng nhập hệ thống");
                    Console.WriteLine(
                        "---------------------------------------------------------------------------------");
                    if (!LoginSuccess)
                    {
                        Console.WriteLine("login failed");
                    }
                    else if (LoginSuccess && IsAdmin)
                    {
                        GenerateAdminMenu();
                    }
                    else
                    {
                        GenerateCustomMenu();
                    }


                    break;

                case 3:
                    Console.WriteLine("Thoát");
                    break;

                default:
                    Console.WriteLine("không hợp lệ");
                    break;
                }

                if (choice == 3)
                {
                    break;
                }
            }
        }
Exemplo n.º 12
0
        private void SearchUser(bool fromSubscribe)
        {
            var list = new List <LatestProfile>();

            //If there is no text then do not continue
            if (string.IsNullOrEmpty(txtUserName.Text))
            {
                //If it came from Subscribe then just reset to the default
                if (fromSubscribe)
                {
                    Bind();
                }
                //If it did NOT come from Subscribe then tell them to enter text to search on.
                else
                {
                    var prompt = new PromptHelper("Please enter the user name or part of the user name in order to search.");
                    Page.RegisterStartupScript(prompt.ScriptName, prompt.GetErrorScript());
                }

                return;
            }

            lblResultsType.Text = "User Name Search";
            phReset.Visible     = true;

            //Set search mode to true so that you know the user was searching on their last view
            hdnSearchMode.Value = "true";

            var profiles = ProfileService.GetProfilesLikeUserName(txtUserName.Text);

            var listenedShowService = Ioc.GetInstance <IListenedShowService>();
            var subscriptionService = Ioc.GetInstance <ISubscriptionService>();

            var subscriptions = subscriptionService.GetSubscriptionsByUser(GetUserId());

            foreach (var profile in profiles)
            {
                var userId = GetUserId(profile.UserName);
                var latest = listenedShowService.GetLatestByUserId(userId);

                if (latest != null)
                {
                    var showService = Ioc.GetInstance <IShowService>();
                    var show        = showService.GetShow(latest.ShowId);
                    var sub         = subscriptions.SingleOrDefault(x => x.SubscribedUserId == latest.UserId);

                    list.Add(new LatestProfile(latest, show, profile, sub));
                }
            }

            rptResults.DataSource = list;
            rptResults.DataBind();
        }
        public void ReadLineImplementation_UsesThePromptIfGivenOne(string promptMessage, int numberOfTimesPrompted, string message)
        {
            // Arrange
            _mockConsole.Setup(s => s.ReadLine()).Returns("n");

            var cut = new PromptHelper(_mockConsole.Object);

            // Act
            cut.GetYorN(promptMessage, true);

            // Assert
            _mockConsole.Verify(v => v.WriteLine(promptMessage), Times.Exactly(numberOfTimesPrompted), message);
        }
Exemplo n.º 14
0
        public void Overload2_UsesThePromptIfGivenOne(string promptMessage, int usageCount, string message)
        {
            // Arrange
            _mockConsole.Setup(s => s.ReadLine()).Returns("1");

            var cut = new PromptHelper(_mockConsole.Object);

            // Act
            cut.GetNumber(promptMessage, 1, 2, "exit", 0);

            // Assert
            _mockConsole.Verify(v => v.WriteLine(promptMessage), Times.Exactly(usageCount), message);
        }
Exemplo n.º 15
0
        public void Overload2_ReturnsTheCorrectText(string input, bool acceptBlank, bool trimResult, string expectedText)
        {
            // Arrange
            _mockConsole.Setup(s => s.ReadLine()).Returns(input);

            var cut = new PromptHelper(_mockConsole.Object);

            // Act
            var actualText = cut.GetText(null, acceptBlank, trimResult);

            // Assert
            Assert.AreEqual(expectedText, actualText);
        }
Exemplo n.º 16
0
        public bool UpdatePhoneNumber(string accountNumber)
        {
            var currentAccount = _accountModel.GetAccountByAccountNumber(accountNumber);
            var oldPhone       = currentAccount.PhoneNumber;

            Console.WriteLine("Số điện thoại hiện tại là: " + oldPhone);
            Console.WriteLine("Nhập số điện thoại mới của bạn: ");
            string newPhoneNumber;

            while (true)
            {
                newPhoneNumber = Console.ReadLine();
                if (ValidateHelper.IsPhoneNumberValid(newPhoneNumber) && !newPhoneNumber.Equals(oldPhone))
                {
                    break;
                }

                if (!ValidateHelper.IsEmailValid(newPhoneNumber))
                {
                    Console.WriteLine("Số điện thoại không hợp lệ hãy nhập lại");
                    continue;
                }

                if (newPhoneNumber.Equals(oldPhone))
                {
                    Console.WriteLine("Bạn đã nhập vào số điện thoại cũ mời nhập lại");
                }
            }

            //confirm update
            string confirmMessage = $"Bạn có muốn lưu số điện thoại {newPhoneNumber} không ? ";
            var    isConfirm      = PromptHelper.ConfirmUser(confirmMessage);

            if (isConfirm == false)
            {
                return(false);
            }
            var res = _accountModel.UpdateAccountByAccountNumber(accountNumber, "phoneNumber", newPhoneNumber);

            if (res == true)
            {
                Console.WriteLine($"Đã update số điện thoại của số tài khoản {accountNumber} thành công");
            }
            else
            {
                Console.WriteLine("Update thông tin không thành công");
                return(false);
            }

            return(false);
        }
Exemplo n.º 17
0
        public void btnCreateTag_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtTagName.Text) || string.IsNullOrEmpty(hdnShowId.Value))
            {
                return;
            }

            var  userId = GetUserId();
            Guid showId = new Guid(hdnShowId.Value);

            ITagService tagService = Ioc.GetInstance <ITagService>();
            var         tag        = tagService.GetTag(txtTagName.Text.Trim(), userId);

            PromptHelper prompt;

            if (tag != null)
            {
                prompt = new PromptHelper("You already have a tag with the same name. Please choose it from your list or give it a new name.");
                Page.RegisterStartupScript(prompt.ScriptName, prompt.GetErrorScript());
                return;
            }

            var success = false;

            try {
                var tagName = txtTagName.Text;
                var newTag  = _DomainObjectFactory.CreateTag(tagName.Length > DEFAULT_MAX_TAG_NAME ? tagName.Substring(0, DEFAULT_MAX_TAG_NAME) : tagName, userId);
                var showTag = _DomainObjectFactory.CreateShowTag(showId, newTag.Id, GetUserId());

                using (IUnitOfWork uow = UnitOfWork.Begin()) {
                    tagService.Save(newTag, out success);

                    bool showTagSuccess = false;
                    _ShowTagService.Save(showTag, out showTagSuccess);

                    success = success && showTagSuccess;

                    if (success)
                    {
                        uow.Commit();
                    }
                }
            }
            catch (Exception ex) {
                _Log.WriteFatal("THERE WAS AN EXCEPTION SAVING A NEW TAG ON NOTES.ASPX with message: " + ex.Message);
                success = false;
            }

            ValidateTags(success, "There was an error saving your tag.", showId);
        }
Exemplo n.º 18
0
        private void ValidateTags(bool success, string error, Guid showId)
        {
            PromptHelper prompt;

            if (success)
            {
                BindTags(showId);
            }
            else
            {
                prompt = new PromptHelper(error);
                Page.RegisterStartupScript(prompt.ScriptName, prompt.GetErrorScript());
            }
        }
        private List <CourseAdminFieldWithAnswer> PopulateCourseAdminFieldWithAnswerListFromResult(
            CourseAdminFieldsResult?result,
            CourseDelegate courseDelegate
            )
        {
            var list = new List <CourseAdminFieldWithAnswer>();

            if (result == null)
            {
                return(list);
            }

            var prompt1 = PromptHelper.PopulateCourseAdminFieldWithAnswer(
                1,
                result.CourseAdminField1Prompt,
                result.CourseAdminField1Options,
                courseDelegate.Answer1
                );

            if (prompt1 != null)
            {
                list.Add(prompt1);
            }

            var prompt2 = PromptHelper.PopulateCourseAdminFieldWithAnswer(
                2,
                result.CourseAdminField2Prompt,
                result.CourseAdminField2Options,
                courseDelegate.Answer2
                );

            if (prompt2 != null)
            {
                list.Add(prompt2);
            }

            var prompt3 = PromptHelper.PopulateCourseAdminFieldWithAnswer(
                3,
                result.CourseAdminField3Prompt,
                result.CourseAdminField3Options,
                courseDelegate.Answer3
                );

            if (prompt3 != null)
            {
                list.Add(prompt3);
            }

            return(list);
        }
Exemplo n.º 20
0
        public void Overload1_ReturnsCorrectValue(string input, int?expectedOutput)
        {
            // Arrange
            _mockConsole.Setup(s => s.ReadLine()).Returns(input);

            var cut = new PromptHelper(_mockConsole.Object);

            // Act
            int?actualOutput = cut.GetNumber(null, 1);


            // Assert
            Assert.AreEqual(expectedOutput, actualOutput);
        }
Exemplo n.º 21
0
        public void Overload2_ContinuesToPromptIfTextCannotBeBlank()
        {
            // Arrange
            _mockConsole.SetupSequence(s => s.ReadLine())
            .Returns("").Returns((string)null).Returns("").Returns(" ").Returns(" JaMes ");

            var cut = new PromptHelper(_mockConsole.Object);

            // Act
            var actualText = cut.GetText(null, false, true);

            // Assert
            Assert.AreEqual("JaMes", actualText);
        }
Exemplo n.º 22
0
        public void Overload1_ContinuesToPromptTillItGetsTheCorrectAnswer()
        {
            // Arrange
            _mockConsole.SetupSequence(s => s.ReadLine())
            .Returns("jack").Returns((string)null).Returns("").Returns(" ").Returns("z").Returns("james").Returns("c");

            var cut = new PromptHelper(_mockConsole.Object);

            // Act
            var actualText = cut.GetText(null, true, "a", "b", "c");

            // Assert
            Assert.AreEqual("c", actualText);
        }
        public void ReadLineImplementation_ContinuesToPromptTillItGetsTheCorrectAnswer()
        {
            // Arrange
            _mockConsole.SetupSequence(s => s.ReadLine())
            .Returns(" ").Returns("z").Returns("s").Returns("Y");

            var cut = new PromptHelper(_mockConsole.Object);

            // Act
            var actualResult = cut.GetYorN("Shall I proceed?", true);

            // Assert
            Assert.IsTrue(actualResult);
        }
Exemplo n.º 24
0
        public bool UpdateEmail(string accountNumber)
        {
            var currentAccount = _accountModel.GetAccountByAccountNumber(accountNumber);
            var oldEmail       = currentAccount.Email;

            Console.WriteLine("Email hiện tại " + oldEmail);
            Console.WriteLine("Nhập email mới của bạn");
            string newEmail = "";

            while (true)
            {
                newEmail = Console.ReadLine();
                if (ValidateHelper.IsEmailValid(newEmail) && !newEmail.Equals(oldEmail))
                {
                    break;
                }

                if (!ValidateHelper.IsEmailValid(newEmail))
                {
                    Console.WriteLine("Email không hợp lệ mời nhập lại");
                    continue;
                }

                if (newEmail.Equals(oldEmail))
                {
                    Console.WriteLine("Bạn đã nhập email cũ, mời nhập lại");
                }
            }
            //confirm update
            var isConfirm = PromptHelper.ConfirmUser($"Bạn có muốn thay đổi email thành {newEmail} hay không ?");

            if (isConfirm == false)
            {
                return(false);
            }

            var res = _accountModel.UpdateAccountByAccountNumber(accountNumber, "email", newEmail);

            if (res == true)
            {
                Console.WriteLine($"Đã update email của số tài khoản {accountNumber} thành công");
            }
            else
            {
                Console.WriteLine("Update thông tin không thành công");
                return(false);
            }

            return(false);
        }
Exemplo n.º 25
0
        public static void ShowCreepInfo(CreepInfoType type, string arg, CreepHelper.CreepDeathData source = null)
        {
            string text = string.Empty;

            switch (type)
            {
            case CreepInfoType.creep_awake:
                if (arg != null)
                {
                    SysPromptVo dataById = BaseDataMgr.instance.GetDataById <SysPromptVo>("150");
                    text = string.Format(LanguageManager.Instance.GetStringById(dataById.prompt_text), arg);
                    if (dataById != null)
                    {
                        CreepHelper.CreepAwakeParam item = new CreepHelper.CreepAwakeParam(text, dataById.text_time, 629);
                        CreepHelper._waittingQueue.Enqueue(item);
                        if (CreepHelper.curTask == null)
                        {
                            CreepHelper.curTask = new Task(CreepHelper.DelayBrocast(), true);
                        }
                    }
                }
                break;

            case CreepInfoType.creep_killed:
                if (source != null && source.Attacker != null && source.Creep != null)
                {
                    int         num        = (source.Attacker.teamType != 0) ? 151 : 152;
                    SysPromptVo dataById   = BaseDataMgr.instance.GetDataById <SysPromptVo>(num.ToString());
                    string      stringById = LanguageManager.Instance.GetStringById(dataById.prompt_text);
                    EntityType  attackerType;
                    if (source.Attacker.isBuilding)
                    {
                        attackerType = EntityType.Tower;
                    }
                    else if (source.Attacker.isMonster)
                    {
                        attackerType = EntityType.Monster;
                    }
                    else
                    {
                        attackerType = EntityType.Hero;
                    }
                    string sound    = dataById.sound2;
                    string promptId = PromptHelper.CreepKilledId(source.Attacker);
                    UIMessageBox.ShowKillPrompt(promptId, "[]", source.Attacker.npc_id, attackerType, EntityType.Creep, string.Empty, string.Empty, TeamType.None, TeamType.None);
                }
                break;
            }
        }
Exemplo n.º 26
0
        public string ValidateSuccess(bool success, string successMessage, string error)
        {
            PromptHelper prompt;

            if (success)
            {
                prompt = new PromptHelper(successMessage);
                return(prompt.GetSuccessScript());
            }
            else
            {
                prompt = new PromptHelper(error);
                return(prompt.GetErrorScript());
            }
        }
Exemplo n.º 27
0
        public void Overload1_WhenOrderedToPromptTwiceItDoes()
        {
            // Arrange
            _mockConsole.SetupSequence(s => s.ReadLine())
            .Returns("Not_a_number").Returns("still_not_a_number");

            var cut = new PromptHelper(_mockConsole.Object);

            // Act
            int?actualOutput = cut.GetNumber(null, 2);


            // Assert
            _mockConsole.Verify(v => v.ReadLine(), Times.Exactly(2));
        }
Exemplo n.º 28
0
        public void Overload2_ReturnsCorrectValue(string input, int?expectedOutput, string message)
        {
            // Arrange
            _mockConsole.SetupSequence(s => s.ReadLine())
            .Returns(input).Returns("exit");

            var cut = new PromptHelper(_mockConsole.Object);

            // Act
            int?actualOutput = cut.GetNumber(null, -20, 20, "exit", -100);


            // Assert
            Assert.AreEqual(expectedOutput, actualOutput, message);
        }
Exemplo n.º 29
0
        public static void TryShowCreepUIMessageInfo(Units inAttacker, Units inCreep, string inBattleMonsterCreepId, int inOldGroupType)
        {
            if (inAttacker == null || inCreep == null)
            {
                return;
            }
            CreepInfoType creepInfoType = CreepHelper.GetCreepInfoType(inCreep, inBattleMonsterCreepId, inOldGroupType);

            if (creepInfoType == CreepInfoType.creep_none)
            {
                return;
            }
            string creepUIMessageCampInfoContent = CreepHelper.GetCreepUIMessageCampInfoContent(inAttacker);

            if (creepInfoType == CreepInfoType.creep_in_control)
            {
                string promptId = PromptHelper.CreepInControlId(inAttacker);
                UIMessageBox.ShowKillPrompt(promptId, inAttacker.npc_id, inCreep.npc_id, EntityType.Hero, EntityType.Creep, string.Empty, string.Empty, TeamType.None, TeamType.None);
            }
            else if (creepInfoType == CreepInfoType.creep_killed)
            {
                string promptId2 = PromptHelper.CreepKilledId(inAttacker);
                UIMessageBox.ShowKillPrompt(promptId2, inAttacker.npc_id, inCreep.npc_id, EntityType.Hero, EntityType.Creep, string.Empty, string.Empty, TeamType.None, TeamType.None);
            }
            else if (creepInfoType == CreepInfoType.creep_gold_killed)
            {
                if (inAttacker.isPlayer || inAttacker.isMyTeam)
                {
                    string promptId3 = PromptHelper.CreepGoldKilledId(inAttacker);
                    UIMessageBox.ShowKillPrompt(promptId3, inAttacker.npc_id, inCreep.npc_id, EntityType.Hero, EntityType.Creep, string.Empty, string.Empty, TeamType.None, TeamType.None);
                }
            }
            else if (creepInfoType == CreepInfoType.creep_gold_plundered)
            {
                string promptId4 = PromptHelper.CreepGoldPlunderedId(inAttacker);
                UIMessageBox.ShowKillPrompt(promptId4, inAttacker.npc_id, inCreep.npc_id, EntityType.Hero, EntityType.Creep, string.Empty, string.Empty, TeamType.None, TeamType.None);
            }
            else if (creepInfoType == CreepInfoType.creep_spawn_assistantcreep)
            {
                string promptId5 = PromptHelper.AssistantCreepKilledId(inAttacker);
                UIMessageBox.ShowKillPrompt(promptId5, inAttacker.npc_id, inCreep.npc_id, EntityType.Hero, EntityType.Creep, string.Empty, string.Empty, TeamType.None, TeamType.None);
            }
            else if (creepInfoType == CreepInfoType.creep_spawn_assistantsoldier)
            {
                string promptId6 = PromptHelper.SoldierCreepKilledId(inAttacker);
                UIMessageBox.ShowKillPrompt(promptId6, inAttacker.npc_id, inCreep.npc_id, EntityType.Hero, EntityType.Creep, string.Empty, string.Empty, TeamType.None, TeamType.None);
            }
        }
Exemplo n.º 30
0
        private void P2C_SurrenderTakeEffect(MobaMessage msg)
        {
            SurrenderStartInfo probufMsg = msg.GetProbufMsg <SurrenderStartInfo>();
            TeamType           teamType  = this.IsLm(probufMsg.info);

            if (teamType == Singleton <PvpManager> .Instance.SelfTeamType)
            {
                this.IsPassed    = true;
                this.HasAllVoted = true;
            }
            PromptHelper.PromptFormat("167", new object[]
            {
                PromptHelper.GetFriendlyText(teamType)
            });
            CtrlManager.CloseWindow(WindowID.SurrenderView);
        }
        public void  ReadKeyImplementation_ContinuesToPromptTillItGetsTheCorrectAnswer()
        {
            // Arrange
            _mockConsole.SetupSequence(s => s.ReadKey())
            .Returns(new ConsoleKeyInfo(' ', ConsoleKey.Spacebar, false, false, false))
            .Returns(new ConsoleKeyInfo('z', ConsoleKey.Z, false, false, false))
            .Returns(new ConsoleKeyInfo('s', ConsoleKey.S, false, false, false))
            .Returns(new ConsoleKeyInfo('Y', ConsoleKey.Y, true, false, false));

            var cut = new PromptHelper(_mockConsole.Object);

            // Act
            var actualResult = cut.GetYorN("Shall I proceed?", false);

            // Assert
            Assert.IsTrue(actualResult);
        }