Пример #1
0
        internal void startNewtMonsterGame()
        {
            Console.Clear();
            try_parse:
            Console.WriteLine("What is your username?");
            try
            {
                String username = Console.ReadLine();
                Console.Clear();
                player = new Player(username);
                ItemCreater ic = new ItemCreater();
                player.Inventory.Add(ic.CreateHPItem("HP potion", Item.equipment.potion, 20, 1));
                player.Inventory.Add(ic.CreateHPItem("HP potion", Item.equipment.potion, 20, 1));
                player.Inventory.Add(ic.CreateHPItem("HP potion", Item.equipment.potion, 20, 1));
                player.Inventory.Add(ic.CreateHPItem("HP potion", Item.equipment.potion, 20, 1));
                player.Inventory.Add(ic.CreateHPItem("HP potion", Item.equipment.potion, 20, 1));
                player.Inventory.Add(ic.CreateHPItem("HP potion", Item.equipment.potion, 20, 1));
                tama = new Monster();
                player.Monsters.Add(tama);
            }
            catch (Exception)
            {
                Console.WriteLine("There is no such option available");
                goto try_parse;
            }

            Console.WriteLine("You start adventure out in the world");
            Console.WriteLine();
            Console.WriteLine("Press Enter to continue");
            Console.Read();
            Console.Clear();

            Worker worker = new Worker();
            Thread thread1 = new Thread(new ThreadStart(worker.doWork));
            Thread thread2 = new Thread(new ThreadStart(MonsterMenu));

            thread1.Start();
            thread2.Start();

            while (!thread1.IsAlive) ;
            Thread.Sleep(1);
            thread1.Join();
            try
            {
                thread1.Start();
            }
            catch (Exception)
            {
                Console.WriteLine("Couldn't restart thread");
            }
            while (!thread2.IsAlive) ;
            Thread.Sleep(1);
            thread2.Join();
        }
Пример #2
0
        internal void startLoadMenu()
        {
            Console.Clear();
            player = GetPlayer();
            tama = player.Monsters[0];
            Worker worker = new Worker();
            Thread thread1 = new Thread(new ThreadStart(worker.doWork));
            Thread thread2 = new Thread(new ThreadStart(MonsterMenu));

            thread1.Start();
            thread2.Start();

            while (!thread1.IsAlive) ;
            Thread.Sleep(1);
            thread1.Join();
            try
            {
                thread1.Start();
            }
            catch (Exception)
            {
                Console.WriteLine("Couldn't restart thread");
            }
            while (!thread2.IsAlive) ;
            Thread.Sleep(1);
            thread2.Join();
        }