Exemple #1
0
        // Simple statement for game deletion on starting a new game
        public static bool DeleteSave()
        {
            if (String.IsNullOrEmpty(File.ReadAllText(LocalSavePath)))
            {
                return(true);
            }
            LineHelpers.PrintLine("Are you sure you want to delete your save?");
            LineHelpers.PrintLine("1. Yes");
            LineHelpers.PrintLine("2. No");

            var input = LineHelpers.ReadInputNumber(new int[] { 1, 2 });

            if (input == 1)
            {
                try
                {
                    File.WriteAllText(LocalSavePath, "");
                    LineHelpers.PrintLineWithContinue("Save game deleted...");
                    return(true);
                }
                catch
                {
                    LineHelpers.PrintLineWithContinue("Error, save was not deleted...");
                    return(false);
                }
            }
            else
            {
                LineHelpers.PrintLineWithContinue("Save was not deleted...");
                return(false);
            }
        }
Exemple #2
0
        public static object PrintListGetItem <T>(List <T> list, PrintFunc Print)
        {
            int count;

            while (true)
            {
                count = 0;
                foreach (var thing in list)
                {
                    Print(thing, count);
                    count++;
                }

                LineHelpers.PrintLine(count + ". Exit");
                LineHelpers.PrintLine("Type the number...");
                int choice = Convert.ToInt32(Console.ReadLine());


                // if some error here count -1
                if (choice < list.Count && choice > 0 || choice == 0 && list.Count > 0)
                {
                    return(list[choice]);
                }
                // this checks if the choice is the right number or if the count is zero if the choice is zero
                if (choice == list.Count || list.Count == 0 && choice == 0)
                {
                    return(null);
                }
            }
        }
Exemple #3
0
        public static void Spell(object item, int count)
        {
            Spell spell = item as Spell;

            LineHelpers.PrintLine(count + ". " + spell.Name);
            LineHelpers.PrintLine("  Damage: " + spell.Damage);
            LineHelpers.PrintLine("  Cost: " + spell.Cost);
        }
Exemple #4
0
        public static void Consumable(object item, int count)
        {
            Consumable consumable = item as Consumable;

            LineHelpers.PrintLine(count + ". " + consumable.Name);
            LineHelpers.PrintLine("  " + consumable.Description);
            LineHelpers.PrintLine("  Cost: " + consumable.Cost);
            LineHelpers.PrintLine("  Heal: " + consumable.HealAmount);
        }
Exemple #5
0
        public static void Armor(object item, int count)
        {
            Armor armor = item as Armor;

            LineHelpers.PrintLine(count + ". " + armor.Name);
            LineHelpers.PrintLine("  " + armor.Description);
            LineHelpers.PrintLine("  Armor: " + armor.ArmorRating);
            LineHelpers.PrintLine("  Cost: " + armor.Cost);
        }
Exemple #6
0
        // See ListHelpers for info on implementation
        public static void Weapon(object item, int count)
        {
            Weapon weapon = item as Weapon;

            LineHelpers.PrintLine(count + ". " + weapon.Name);
            LineHelpers.PrintLine("  " + weapon.Description);
            LineHelpers.PrintLine("  Cost: " + weapon.Cost);
            LineHelpers.PrintLine("  Damage: " + weapon.MinDamage + " to " + weapon.MaxDamage);
        }
Exemple #7
0
        public static void SpellsInformation(object item, int count)
        {
            Spell spell = item as Spell;

            LineHelpers.PrintLine(count + ". " + spell.Name);
            LineHelpers.PrintLine("  " + spell.Description);
            LineHelpers.PrintLine("  Damage: " + spell.Damage);
            LineHelpers.PrintLine("  Cost: " + spell.Cost);
            LineHelpers.PrintLine("  Modifier: " + spell.Modifier);
        }