public override void DoWindowContents(Rect rect)
        {
            base.DoWindowContents(rect);

            string[] tabs;
            if (prisoners.Count() > 0)
            {
                tabs = new string[] { "PrisonLabor_ColonistsOnlyShort".Translate(), "PrisonLabor_PrisonersOnlyShort".Translate() }
            }
            ;
            else
            {
                tabs = new string[] { "PrisonLabor_ColonistsOnlyShort".Translate() }
            };

            Text.Font = GameFont.Small;
            PrisonLaborWidgets.BeginTabbedView(rect, tabs, ref currentTabIndex);
            rect.height -= PrisonLaborWidgets.HorizontalSpacing - TopMargin;
            GUI.BeginGroup(new Rect(0, TopMargin, rect.width, rect.height));
            if (currentTabIndex == ColonistsTabIndex)
            {
                colonistTab.DoWindowContents(rect);
            }
            else if (currentTabIndex == PrisonersTabIndex)
            {
                prisonerTab.DoWindowContents(rect);
            }
            GUI.EndGroup();
            PrisonLaborWidgets.EndTabbedView();
        }
Beispiel #2
0
        public override void DoWindowContents(Rect rect)
        {
            string[] tabs;
            {
                List <string> tabList = new List <string>();
                int           curTab  = ColonistsTabIndex + 1;
                tabList.Add("MRWTS_ColonistsOnlyShort".Translate());

                if (robots.Any())
                {
                    tabList.Add("MRWTS_AIRobotsOnlyShort".Translate());
                    RobotsTabIndex = curTab++;
                }
                else
                {
                    RobotsTabIndex = -1;
                }

                //if (animals.Any())
                //{
                //    tabList.Add("Animals".Translate());
                //    AnimalsTabIndex = curTab++;
                //}
                //else
                //    AnimalsTabIndex = -1;

                //if (mechanoidsVFE.Any())
                //{
                //    tabList.Add("VFE Mechanoids".Translate());
                //    MechanoidsTabIndex = curTab++;
                //}
                //else
                //    MechanoidsTabIndex = -1;

                tabs = tabList.ToArray();

                if (currentTabIndex >= tabs.Length)
                {
                    currentTabIndex = tabs.Length - 1;
                }
            }

            Text.Font = GameFont.Small;
            UIWidgets.BeginTabbedView(rect, tabs, ref currentTabIndex);
            rect.height -= UIWidgets.HorizontalSpacing - TopMargin;
            GUI.BeginGroup(new Rect(0, TopMargin, rect.width, rect.height));
            if (currentTabIndex != lastTabIndex)
            {
                CreatePawnTable();
                lastTabIndex = currentTabIndex;

                var setDirtyMethod = typeof(MainTabWindow_PawnTable).GetMethod("SetDirty", BindingFlags.Instance | BindingFlags.NonPublic);
                setDirtyMethod.Invoke(pawnTab, new object[] { });
            }
            pawnTab.DoWindowContents(rect);

            GUI.EndGroup();
            UIWidgets.EndTabbedView();
        }