public void GameWork()//работа самой игры { bool isWork = true; Message.ShowStats(Player); Message.ShowAction("ДОБРО ПОЖАЛОВАТЬ"); Message.ShowEnemyStats(Enemy); //Message.DrawImage(CurrentLocation.Image); (НЕ РАБОТАЕТ Т.К. НЕТ БИБЛИОТЕКИ РИСУНКОВ) Message.CloseLine(); Player.Damage = 20; while (isWork) { if (Enemy == null || Enemy.Hp <= 0) { Enemy = GameDataManager.GetCharacter(0); } if (!(CurrentLocation is City)) { if (CurrentLocation is MonsterLocation) { MonsterLocation monsterLocation = CurrentLocation as MonsterLocation; Enemy = monsterLocation.Enemy; } } if (Enemy != null) { if (Enemy.Hp > 0) { War(); } } answer = Message.ReadLine(); if (answer == "go") { int locationId; answer = Message.ReadLine(); if (answer == "up") { locationId = CurrentLocation.UpId; } else if (answer == "down") { locationId = CurrentLocation.DownId; } else if (answer == "left") { locationId = CurrentLocation.LeftId; } else if (answer == "right") { locationId = CurrentLocation.RightId; } else { Message.ShowWarning("НЕ ПРАВИЛЬНАЯ КОМАНДА!!!"); continue; } bool isComplete = false; if (locationId == -1) { Message.ShowWarning("Туда пойти нельзя"); continue; } foreach (var i in Locations) { if (i.Id == locationId) { CurrentLocation = i; isComplete = true; } } if (isComplete == false) { throw new Exception("При перпеходе не найдена нужная локация!"); } } else if (answer == "open stock") { if (CurrentLocation is City) { City city = CurrentLocation as City; List <string> image = new List <string>(); foreach (var i in city.Stock.Items) { image.Add(i.Id + "-" + i.Name + " (" + i.Rarity.ToString() + ")"); } bool stockIsWork = true; while (stockIsWork) { answer = Message.ReadLine(); string[] command = answer.Split(new Char[] { ' ' }); int itemId = -1; int itemIndex = -1; try { int.TryParse(command[0], out itemIndex); itemId = city.Stock.Items[itemIndex].Id; } catch { Message.ShowWarning("Не правильно задана комманда, команда должна быть следующего типа: 'цифра команда'"); continue; } if (command[1] == "exit") { stockIsWork = false; } else if (command[1] == "take") { RenderItem(city.Stock, Player.Inventar, itemId); } else if (command[1] == "drop") { city.Stock.RemoveItem(itemId); } else if (command[1] == "sell") { city.Stock.Items[itemIndex].Sell(Player); } } } } } }