Пример #1
0
        private static void MakeEmblem(int intFarmLength, int intMapLength, string strCityEmblem)
        {
            if (strCityEmblem.ToLower() != "none")
            {
                int intBlockyBlock = RandomHelper.RandomNumber(BlockType.IRON_BLOCK, BlockType.GOLD_BLOCK,
                                                               BlockType.DIAMOND_BLOCK);
                string[] strEmblem;
                if (strCityEmblem == "Random")
                {
                    string[] strFiles = Directory.GetFiles("Resources", "Emblem*.txt");
                    strCityEmblem = RandomHelper.RandomItemFromArray(strFiles);
                    strEmblem     = File.ReadAllLines(strCityEmblem);
                }
                else
                {
                    strEmblem = File.ReadAllLines(Path.Combine("Resources", "Emblem " + strCityEmblem + ".txt"));
                }

                for (int y = 0; y < strEmblem.GetLength(0); y++)
                {
                    strEmblem[y] = strEmblem[y].Replace("  ", " ");
                    strEmblem[y] = strEmblem[y].Replace((char)9, ' '); //tab
                    string[] strLine = strEmblem[y].Split(' ');
                    for (int x = 0; x < strLine.GetLength(0); x++)
                    {
                        string[] strSplit = strLine[x].Split(':');
                        if (strSplit.GetLength(0) == 1)
                        {
                            Array.Resize(ref strSplit, 2);
                        }
                        if (strSplit[0] == "-1")
                        {
                            strSplit[0] = intBlockyBlock.ToString();
                        }
                        BlockShapes.MakeBlock(((intMapLength / 2) - (strLine.GetLength(0) + 5)) + x, 71 - y,
                                              intFarmLength + 5, Convert.ToInt32(strSplit[0]), 2, 100,
                                              Convert.ToInt32(strSplit[1]));
                    }
                    for (int x = strLine.GetLength(0) + 1; x < strLine.GetLength(0) + 5; x++)
                    {
                        BlockShapes.MakeBlock((intMapLength / 2) - (5 + x), 69, intFarmLength + 5, BlockType.AIR, 2, 100, 0);
                        BlockShapes.MakeBlock((intMapLength / 2) - (5 + x), 70, intFarmLength + 5, BlockType.AIR, 2, 100, 0);
                    }
                }
            }
        }