public static void StorePawnTableAccess(MainTabWindow_PawnTable __instance, ref PawnTable __result)
 {
     if (workTabPawnTable != null)
     {
         Log.Warning("[MoarJobs] workTabPawnTable has been set more than once");
     }
     workTabPawnTable = __result;
 }
예제 #2
0
        private PawnTable CreateTable(MainTabWindow_PawnTable pawnTable, Func <IEnumerable <Pawn> > pawnsFunc)
        {
            var tableDef    = pawnTable.GetType().GetProperty("PawnTableDef", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(pawnTable, null) as PawnTableDef;
            var bottomSpace = (float)pawnTable.GetType().GetProperty("ExtraBottomSpace", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(pawnTable, null);
            var topSpace    = (float)pawnTable.GetType().GetProperty("ExtraTopSpace", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(pawnTable, null);

            return(new PawnTable(tableDef, pawnsFunc, UI.screenWidth - (int)(this.Margin * 2f), (int)((float)(UI.screenHeight - 35) - bottomSpace - topSpace - this.Margin * 2f)));
        }
예제 #3
0
 public MainTabWindow_WorkTabMod_Tweak()
 {
     pawnTab = Activator.CreateInstance(InnerTabType) as MainTabWindow_PawnTable;
     if (pawnTab == null)
     {
         throw new Exception("PrisonLabor exception: wrong MainTabWindow_PawnTable type");
     }
 }
예제 #4
0
 public MainTabWindow_Dual()
 {
     colonistTab = Activator.CreateInstance(InnerTabType) as MainTabWindow_PawnTable;
     prisonerTab = Activator.CreateInstance(InnerTabType) as MainTabWindow_PawnTable;
     if (colonistTab == null || prisonerTab == null)
     {
         throw new Exception("PrisonLabor exception: wrong MainTabWindow_PawnTable type");
     }
 }
예제 #5
0
        private static void Prefix(MainTabWindow_PawnTable __instance)
        {
            var prisonersTable = __instance.GetType().GetField("prisonersTable", BindingFlags.NonPublic | BindingFlags.Instance);

            if (prisonersTable != null)
            {
                var SetDirty = prisonersTable.FieldType.GetMethod("SetDirty");
                if (SetDirty != null)
                {
                    SetDirty.Invoke(prisonersTable.GetValue(__instance), new object[] { });
                }
            }
        }
예제 #6
0
        public MainTabWindow_WorkTabMod_Tabs()
        {
            Type workTab = typeof(MainTabWindow_Work);

            try
            {
                ((Action)(() =>
                {
                    workTab = typeof(WorkTab.MainTabWindow_WorkTab);
                }))();
            }
            catch (TypeLoadException) { }
            catch (Exception e) { Log.Error($"MiscRobotsWorkTabSupport: Error when trying to load Fluffy's WorkTab - {AllErrorMessages(e)}"); }

            pawnTab = Activator.CreateInstance(workTab) as MainTabWindow_PawnTable;
        }
예제 #7
0
 private void DoListChangedNotifications()
 {
     if (Find.WindowStack != null)
     {
         WindowStack windowStack = Find.WindowStack;
         for (int i = 0; i < windowStack.Count; i++)
         {
             MainTabWindow_PawnTable mainTabWindow_PawnTable = windowStack[i] as MainTabWindow_PawnTable;
             if (mainTabWindow_PawnTable != null)
             {
                 mainTabWindow_PawnTable.Notify_PawnsChanged();
             }
         }
     }
     if (Find.ColonistBar != null)
     {
         Find.ColonistBar.MarkColonistsDirty();
     }
 }
        static IEnumerable <Pawn> Postfix(IEnumerable <Pawn> pawns, MainTabWindow_PawnTable __instance)
        {
            foreach (Pawn pawn in pawns)
            {
                yield return(pawn);
            }

            if (Autocleaner.settings.disableSchedule)
            {
                yield break;
            }

            if (!(__instance is MainTabWindow_Restrict))
            {
                yield break;
            }

            foreach (Pawn pawn in Find.CurrentMap.mapPawns.AllPawns.Where(x => x.Faction == Faction.OfPlayer && x.kindDef == Globals.AutocleanerPawnKind && !pawns.Contains(x)))
            {
                yield return(pawn);
            }
        }