private static void BuildDatabaseIfNecessary()
 {
     if (heads.Count <= 0 || skull == null || stump == null)
     {
         heads.Clear();
         string[] headsFolderPaths = HeadsFolderPaths;
         foreach (string text in headsFolderPaths)
         {
             foreach (string item in GraphicDatabaseUtility.GraphicNamesInFolder(text))
             {
                 var head = new HeadGraphicRecord(text + "/" + item);
                 if (head.gender == Gender.Female)
                 {
                     femaleHeads.Add(head);
                 }
                 else if (head.gender == Gender.Male)
                 {
                     maleHeads.Add(head);
                 }
                 heads.Add(head);
             }
         }
         skull = new HeadGraphicRecord(SkullPath);
         stump = new HeadGraphicRecord(StumpPath);
     }
 }
Ejemplo n.º 2
0
        public static Graphic_Multi GetHeadRandom(Gender gender, Color skinColor, CrownType crownType)
        {
            BuildDatabaseIfNecessary();
            Predicate <HeadGraphicRecord> predicate = delegate(HeadGraphicRecord head)
            {
                if (head.crownType != crownType)
                {
                    return(false);
                }
                return((head.gender == gender) ? true : false);
            };
            int num = 0;

            do
            {
                HeadGraphicRecord headGraphicRecord = heads.RandomElement();
                if (predicate(headGraphicRecord))
                {
                    return(headGraphicRecord.GetGraphic(skinColor));
                }
                num++;
            }while (num <= 40);
            foreach (HeadGraphicRecord item in heads.InRandomOrder())
            {
                if (predicate(item))
                {
                    return(item.GetGraphic(skinColor));
                }
            }
            Log.Error(string.Concat("Failed to find head for gender=", gender, ". Defaulting..."));
            return(heads.First().GetGraphic(skinColor));
        }
Ejemplo n.º 3
0
        public static void BuildDatabaseIfNecessary()
        {
            if (HeadsVanillaCustom.Count > 0 && _skull != null && _stump != null)
            {
                return;
            }

            HeadsVanillaCustom.Clear();

            string thingsPawnHumanlike = StringsFS.PathHumanlike;

            HeadsVanillaCustom.Add(new HeadGraphicRecord(thingsPawnHumanlike + "Heads_blank/Female/Female_Average_Normal"));
            HeadsVanillaCustom.Add(new HeadGraphicRecord(thingsPawnHumanlike + "Heads_blank/Female/Female_Average_Pointy"));
            HeadsVanillaCustom.Add(new HeadGraphicRecord(thingsPawnHumanlike + "Heads_blank/Female/Female_Average_Wide"));
            HeadsVanillaCustom.Add(new HeadGraphicRecord(thingsPawnHumanlike + "Heads_blank/Female/Female_Narrow_Normal"));
            HeadsVanillaCustom.Add(new HeadGraphicRecord(thingsPawnHumanlike + "Heads_blank/Female/Female_Narrow_Pointy"));
            HeadsVanillaCustom.Add(new HeadGraphicRecord(thingsPawnHumanlike + "Heads_blank/Female/Female_Narrow_Wide"));

            HeadsVanillaCustom.Add(new HeadGraphicRecord(thingsPawnHumanlike + "Heads_blank/Male/Male_Average_Normal"));
            HeadsVanillaCustom.Add(new HeadGraphicRecord(thingsPawnHumanlike + "Heads_blank/Male/Male_Average_Pointy"));
            HeadsVanillaCustom.Add(new HeadGraphicRecord(thingsPawnHumanlike + "Heads_blank/Male/Male_Average_Wide"));
            HeadsVanillaCustom.Add(new HeadGraphicRecord(thingsPawnHumanlike + "Heads_blank/Male/Male_Narrow_Normal"));
            HeadsVanillaCustom.Add(new HeadGraphicRecord(thingsPawnHumanlike + "Heads_blank/Male/Male_Narrow_Pointy"));
            HeadsVanillaCustom.Add(new HeadGraphicRecord(thingsPawnHumanlike + "Heads_blank/Male/Male_Narrow_Wide"));

            _skull = new HeadGraphicRecord(SkullPath);
            _stump = new HeadGraphicRecord(StumpPath);
        }
 public static Graphic_Multi GetHeadNamed(string graphicPath, Color skinColor)
 {
     BuildDatabaseIfNecessary();
     for (int i = 0; i < heads.Count; i++)
     {
         HeadGraphicRecord headGraphicRecord = heads[i];
         if (headGraphicRecord.graphicPath == graphicPath)
         {
             return(headGraphicRecord.GetGraphic(skinColor));
         }
     }
     return(heads.First().GetGraphic(skinColor));
 }
Ejemplo n.º 5
0
 public static Graphic_Multi GetHeadNamed(string graphicPath, Color skinColor)
 {
     BuildDatabaseIfNecessary();
     for (int i = 0; i < heads.Count; i++)
     {
         HeadGraphicRecord headGraphicRecord = heads[i];
         if (headGraphicRecord.graphicPath == graphicPath)
         {
             return(headGraphicRecord.GetGraphic(skinColor));
         }
     }
     Log.Message("Tried to get pawn head at path " + graphicPath + " that was not found. Defaulting...");
     return(heads.First().GetGraphic(skinColor));
 }
Ejemplo n.º 6
0
 private static void BuildDatabaseIfNecessary()
 {
     if (heads.Count > 0 && skull != null && stump != null)
     {
         return;
     }
     heads.Clear();
     string[] headsFolderPaths = HeadsFolderPaths;
     foreach (string text in headsFolderPaths)
     {
         foreach (string item in GraphicDatabaseUtility.GraphicNamesInFolder(text))
         {
             heads.Add(new HeadGraphicRecord(text + "/" + item));
         }
     }
     skull = new HeadGraphicRecord(SkullPath);
     stump = new HeadGraphicRecord(StumpPath);
 }
        public static Graphic_Multi GetHeadRandom(Gender gender, Color skinColor, CrownType crownType)
        {
            GraphicDatabaseHeadRecords.BuildDatabaseIfNecessary();
            Predicate <HeadGraphicRecord> predicate = delegate(HeadGraphicRecord head)
            {
                if (head.crownType != crownType)
                {
                    return(false);
                }
                if (head.gender != gender)
                {
                    return(false);
                }
                return(true);
            };
            int num = 0;

            while (true)
            {
                HeadGraphicRecord headGraphicRecord = GraphicDatabaseHeadRecords.heads.RandomElement();
                if (predicate(headGraphicRecord))
                {
                    return(headGraphicRecord.GetGraphic(skinColor));
                }
                num++;
                if (num > 40)
                {
                    break;
                }
            }
            foreach (HeadGraphicRecord item in GraphicDatabaseHeadRecords.heads.InRandomOrder(null))
            {
                if (predicate(item))
                {
                    return(item.GetGraphic(skinColor));
                }
            }
            Log.Error("Failed to find head for gender=" + gender + ". Defaulting...");
            return(GraphicDatabaseHeadRecords.heads.First().GetGraphic(skinColor));
        }
Ejemplo n.º 8
0
 public static void Reset()
 {
     heads.Clear();
     skull = null;
     stump = null;
 }
 public static void Reset()
 {
     GraphicDatabaseHeadRecords.heads.Clear();
     GraphicDatabaseHeadRecords.skull = null;
     GraphicDatabaseHeadRecords.stump = null;
 }
Ejemplo n.º 10
0
 public static void Reset()
 {
     HeadsVanillaCustom.Clear();
     _skull = null;
     _stump = null;
 }