public Dictionary <string, PartItem> GetPlace(int partId) { if (Find.ContainsKey(partId)) { // 取得当前地区信息 return(Find[partId]); } else { Clear(); DictionaryPrace = SetNewPrace(); //循环所有15个大地图 for (int baseWorldId = 0; baseWorldId < 15; baseWorldId++) { //循环所有地图里面的3个地区 foreach (int basePartId in DateFile.instance.baseWorldDate[baseWorldId].Keys) { //获取当前地区的地图宽度 int mapWidth = int.Parse(DateFile.instance.partWorldMapDate[basePartId][98]); //设置当前地区信息 Find.Add(basePartId, SetPlace(basePartId, mapWidth * mapWidth)); } } return(Find[partId]); } }
static void Main(string[] args) { Find find = new Find(); int numberOfCommands = int.Parse(Console.ReadLine()); string line = Console.ReadLine(); int counterOfCommands = 0; while (counterOfCommands < numberOfCommands) { Command command = Command.Parse(line); switch (command.Name) { case "AddOrder": Order order = Order.Parse(command.Parameters); find.Add(order); break; case "FindOrdersByConsumer": find.ViewOrders(command.Parameters[0]); break; case "DeleteOrders": find.DeleteOrders(command.Parameters[0]); break; case "FindOrdersByPriceRange": decimal minPrice = decimal.Parse(command.Parameters[0]); decimal maxPrice = decimal.Parse(command.Parameters[1]); find.FilterFromMinToMaxPrice(minPrice, maxPrice); break; default: break; }; line = Console.ReadLine(); counterOfCommands++; } }