Beispiel #1
0
        private static void writeDeJureKingdomInfo(StreamWriter writer, DeJureKingdom kingdom)
        {
            Color color = Color.FromArgb(100, 100, 100);

            writer.WriteLine("k_attila_" + kingdom.getName() + " = {");
            writer.WriteLine("\tcolor={ " + color.R + " " + color.G + " " + color.B + " }");
            writer.WriteLine("}");
        }
Beispiel #2
0
        private void createTitleHierarchy(List <AttilaRegionInfo> regionList)
        {
            titleHierarchy = new List <DeJureKingdom>();

            string curRegionName  = regionList[0].getIDStr().Substring("att_reg_".Length);
            string nextRegionName = regionList[1].getIDStr().Substring("att_reg_".Length);

            int prevDiffPos  = -1;
            int diffPos      = diffLetterPosition(curRegionName, nextRegionName);
            int prevUnderPos = -1;
            int underPos     = lastUnderscoreBeforeDiff(curRegionName, diffPos);

            string        kingdomPart = curRegionName.Substring(0, underPos);
            string        duchyPart   = curRegionName.Substring(underPos + 1);
            DeJureKingdom kingdom     = new DeJureKingdom(kingdomPart);

            titleHierarchy.Add(kingdom);
            DeJureDuchy duchy = new DeJureDuchy(duchyPart, regionList[0]);

            kingdom.addDuchy(duchy);
            bool makeNewKingdom = false;

            for (int i = 1; i < regionList.Count; i++)
            {
                curRegionName  = regionList[i].getIDStr().Substring("att_reg_".Length);
                nextRegionName = "";
                if (i != regionList.Count - 1)
                {
                    nextRegionName = regionList[i + 1].getIDStr().Substring("att_reg_".Length);
                }

                prevDiffPos  = diffPos;
                diffPos      = diffLetterPosition(curRegionName, nextRegionName);
                prevUnderPos = underPos;
                underPos     = lastUnderscoreBeforeDiff(curRegionName, diffPos);

                if (underPos == prevUnderPos || makeNewKingdom)
                {
                    duchyPart = curRegionName.Substring(underPos + 1);
                    duchy     = new DeJureDuchy(duchyPart, regionList[i]);
                    if (makeNewKingdom)
                    {
                        kingdomPart = curRegionName.Substring(0, underPos);
                        kingdom     = new DeJureKingdom(kingdomPart);
                        titleHierarchy.Add(kingdom);
                        makeNewKingdom = false;
                    }
                    kingdom.addDuchy(duchy);
                }
                else
                {
                    duchyPart = curRegionName.Substring(prevUnderPos + 1);
                    duchy     = new DeJureDuchy(duchyPart, regionList[i]);
                    kingdom.addDuchy(duchy);
                    makeNewKingdom = true;
                }
            }
        }