예제 #1
0
 public PanelSkills(PawnFilter pawnFilter)
 {
     this.pawnFilter = pawnFilter;
     Resize(new Rect(0, 40,
                     320, //262,
                     362));
 }
 public PanelTraits(PawnFilter pawnFilter)
 {
     this.pawnFilter = pawnFilter;
     Resize(new Rect(320 + 20, 40,
                     320,
                     156));
 }
예제 #3
0
        public static void Save(PawnFilter pawnFilter)
        {
            if (!RandomSettings.pawnFilterList.Contains(pawnFilter))
            {
                RandomSettings.pawnFilterList.Add(pawnFilter);
            }

            SaveAll();
        }
예제 #4
0
        public static void SaveOverwrite(int index, PawnFilter pawnFilter)
        {
            if (index >= 0)
            {
                RandomSettings.pawnFilterList[index] = pawnFilter;
            }

            SaveAll();
        }
예제 #5
0
        public static void Init()
        {
            pawnFilter = new PawnFilter();

            curPawnFieldInfo = typeof(Page_ConfigureStartingPawns)
                               .GetField("curPawn", BindingFlags.NonPublic | BindingFlags.Instance);

            randomAgeMethodInfo = typeof(PawnGenerator)
                                  .GetMethod("GenerateRandomAge", BindingFlags.NonPublic | BindingFlags.Static);

            randomTraitMethodInfo = typeof(PawnGenerator)
                                    .GetMethod("GenerateTraits", BindingFlags.NonPublic | BindingFlags.Static);

            randomSkillMethodInfo = typeof(PawnGenerator)
                                    .GetMethod("GenerateSkills", BindingFlags.NonPublic | BindingFlags.Static);

            randomHealthMethodInfo = typeof(PawnGenerator)
                                     .GetMethod("GenerateInitialHediffs", BindingFlags.NonPublic | BindingFlags.Static);

            randomBodyTypeMethodInfo = typeof(PawnGenerator)
                                       .GetMethod("GenerateBodyType", BindingFlags.NonPublic | BindingFlags.Static);
        }
예제 #6
0
 public static void Init()
 {
     pawnFilter = new PawnFilter();
 }
예제 #7
0
        public override void DoWindowContents(Rect inRect)
        {
            int     padding        = 16;
            int     scrollBarWidth = 20;
            Vector2 buttonSize     = new Vector2(150, 30);
            Vector2 rowSize        = new Vector2(inRect.width - buttonSize.x - padding - scrollBarWidth, 36);

            List <PawnFilter> list       = RandomSettings.pawnFilterList.ToList();
            float             listHeight = list.Count * rowSize.y;
            Rect listViewRect            = new Rect(0, 0, rowSize.x, listHeight);

            inRect.height -= 40;

            Rect outRect = new Rect(0, 0, inRect.width - buttonSize.x - padding, inRect.height - buttonSize.y - padding - 20);

            Widgets.BeginScrollView(outRect, ref this.scrollPosition, listViewRect);
            try
            {
                float num2 = 0;
                int   num3 = 0;
                for (int i = 0; i < list.Count; i++)
                {
                    PawnFilter current = list[i];
                    Rect       rect    = new Rect(0, num2, rowSize.x, rowSize.y);
                    if (selectedIndex == i)
                    {
                        GUI.DrawTexture(rect, Textures.TextureHighlightRow);
                    }
                    else if (num3 % 2 == 0)
                    {
                        GUI.DrawTexture(rect, Textures.TextureAlternateRow);
                    }

                    Color color = selectedIndex == i ? new Color(0.7f, 0.7f, 0.7f, 1) : Color.white;
                    if (Widgets.ButtonText(rect, "", false, true, color))
                    {
                        selectedIndex = i;
                        Filename      = current.name;
                    }

                    Rect innerRect = new Rect(rect.x + 3, rect.y + 3, rect.width - 6, rect.height - 6);

                    GUI.BeginGroup(innerRect);
                    try
                    {
                        GUI.color = ManualSaveTextColor;
                        Rect rect2 = new Rect(15, 0, rowSize.x, rowSize.y);
                        Text.Anchor = TextAnchor.MiddleLeft;
                        Text.Font   = GameFont.Small;
                        Widgets.Label(rect2, current.name);
                        GUI.color = Color.white;
                    }
                    finally
                    {
                        GUI.EndGroup();
                    }
                    num2 += rowSize.y;
                    num3++;
                }
            }
            finally
            {
                Widgets.EndScrollView();
                Text.Anchor = TextAnchor.UpperLeft;
                Text.Font   = GameFont.Small;
            }

            Rect buttonAreaRect = new Rect(listViewRect.x + listViewRect.width + padding + scrollBarWidth, 0, buttonSize.x, outRect.height);

            GUI.BeginGroup(buttonAreaRect);
            try
            {
                if (selectedIndex == -1)
                {
                    GUI.enabled = false;
                }

                Rect loadButtonRect = new Rect(0, 0, buttonSize.x, buttonSize.y);
                if (Widgets.ButtonText(loadButtonRect, "RandomPlus.SaveLoadDialog.LoadButton".Translate(), true, false, true))
                {
                    SaveLoader.Load(RandomSettings.pawnFilterList[selectedIndex]);
                    Close();
                }

                Rect deleteButtonRect = loadButtonRect.OffsetBy(new Vector2(0, buttonSize.y + padding));
                if (Widgets.ButtonText(deleteButtonRect, "RandomPlus.SaveLoadDialog.DeleteButton".Translate(), true, false, true))
                {
                    SaveLoader.Delete(RandomSettings.pawnFilterList[selectedIndex]);
                    selectedIndex = -1;
                }

                if (selectedIndex == -1)
                {
                    GUI.enabled = true;
                }
            }
            finally
            {
                GUI.EndGroup();
            }


            this.DrawFooter(inRect.AtZero());
        }
예제 #8
0
 public static void Delete(PawnFilter pawnFilter)
 {
     RandomSettings.pawnFilterList.Remove(pawnFilter);
     SaveAll();
 }
예제 #9
0
 public static void Load(PawnFilter pawnFilter)
 {
     RandomSettings.PawnFilter = pawnFilter;
 }