Exemple #1
0
        public int GetPartyChoice()
        {
            int temp = 0;

            MyDraw.DrawChoiced(temp, heros[temp].name, textPos[temp]);
            bool enter = false;

            while (!enter)
            {
                ConsoleKeyInfo key = Console.ReadKey(true);
                if (key.Key == ConsoleKey.LeftArrow)
                {
                    if (temp > 0)
                    {
                        MyDraw.ClearLine(21);
                        MyDraw.DrawChoiceText(temp, heros[temp].name, textPos[temp]);
                        temp = temp - 1;
                        MyDraw.DrawChoiced(temp, heros[temp].name, textPos[temp]);
                    }
                }
                else if (key.Key == ConsoleKey.RightArrow)
                {
                    if (temp < textPos.Count - 1)
                    {
                        MyDraw.ClearLine(21);
                        MyDraw.DrawChoiceText(temp, heros[temp].name, textPos[temp]);
                        temp = temp + 1;
                        MyDraw.DrawChoiced(temp, heros[temp].name, textPos[temp]);
                    }
                }
                else if (key.Key == ConsoleKey.Enter)
                {
                    if (heros[temp].CanBeTarget(tempSkill))
                    {
                        MyDraw.ClearChoiceText();
                        break;
                    }
                    else
                    {
                        MyDraw.DrawBattleMessage("无法选择已经死亡的目标,请重新选择");
                    }
                }
                else if (key.Key == ConsoleKey.Escape)
                {
                    MyDraw.ClearLine(1);
                    return(-1);
                }
            }
            return(temp);
        }
Exemple #2
0
        public int GetSkillChoice(BaseCharacter b)
        {
            int temp = 0;

            MyDraw.DrawChoiced(temp, b.skill[temp].name, textPos[temp]);
            MyDraw.DrawChoiceInfo(b.skill[temp]);
            bool enter = false;

            while (!enter)
            {
                ConsoleKeyInfo key = Console.ReadKey(true);
                if (key.Key == ConsoleKey.LeftArrow)
                {
                    if (temp > 0)
                    {
                        MyDraw.ClearLine(21);
                        MyDraw.DrawChoiceText(temp, b.skill[temp].name, textPos[temp]);
                        temp = temp - 1;
                        MyDraw.DrawChoiced(temp, b.skill[temp].name, textPos[temp]);
                        MyDraw.DrawChoiceInfo(b.skill[temp]);
                    }
                }
                else if (key.Key == ConsoleKey.RightArrow)
                {
                    if (temp < textPos.Count - 1)
                    {
                        MyDraw.ClearLine(21);
                        MyDraw.DrawChoiceText(temp, b.skill[temp].name, textPos[temp]);
                        temp = temp + 1;
                        MyDraw.DrawChoiced(temp, b.skill[temp].name, textPos[temp]);
                        MyDraw.DrawChoiceInfo(b.skill[temp]);
                    }
                }
                else if (key.Key == ConsoleKey.Enter)
                {
                    if (b.skill[temp].CanUseSkill(b))
                    {
                        MyDraw.ClearChoiceText();
                        break;
                    }
                }
            }
            return(temp);
        }