public void ResolveHamonTab()
 {
     if (!this.Pawn.story.traits.HasTrait(JJBRDefOf.JJBR_HamonWielder))
     {
         InspectTabBase inspectTabsx = base.AbilityUser.GetInspectTabs().FirstOrDefault((InspectTabBase x) => x.labelKey == "JJBR_TabHamon");
         IEnumerable <InspectTabBase> inspectTabs = base.AbilityUser.GetInspectTabs();
         bool flag = inspectTabs != null && inspectTabs.Count <InspectTabBase>() > 0;
         if (flag)
         {
             if (inspectTabsx == null)
             {
                 try
                 {
                     base.AbilityUser.def.inspectorTabsResolved.Add(InspectTabManager.GetSharedInstance(typeof(ITab_Hamon)));
                 }
                 catch (Exception ex)
                 {
                     Log.Error(string.Concat(new object[]
                     {
                         "Could not instantiate inspector tab of type ",
                         typeof(ITab_Hamon),
                         ": ",
                         ex
                     }));
                 }
             }
         }
     }
 }
 private static void InterfaceToggleTab(InspectTabBase tab, IInspectPane pane)
 {
     if (!TutorSystem.TutorialMode || InspectPaneUtility.IsOpen(tab, pane) || TutorSystem.AllowAction("ITab-" + tab.tutorTag + "-Open"))
     {
         InspectPaneUtility.ToggleTab(tab, pane);
     }
 }
Exemplo n.º 3
0
 public static void Postfix(InspectTabBase __instance, ref Rect __result)
 {
     if (__instance as ITab_Storage != null)
     {
         //Log.Message("Patching ITab_Storage Rectangle");
         __result.y      -= 95f;
         __result.height += 95f;
     }
 }
Exemplo n.º 4
0
        private static void InterfaceToggleTab(InspectTabBase tab, IInspectPane pane)
        {
            if (TutorSystem.TutorialMode && !IsOpen(tab, pane) &&
                !TutorSystem.AllowAction("ITab-" + tab.tutorTag + "-Open"))
            {
                return;
            }

            ToggleTab(tab, pane);
        }
 static void Postfix(ref IEnumerable <InspectTabBase> __result)
 {
     if (Find.Selector.NumSelected > 1)
     {
         List <InspectTabBase> resultAsList         = __result.ToList();
         InspectTabBase        blueprintTabInstance = ITab_Blueprints.Instance;
         resultAsList.Add(blueprintTabInstance);
         __result = resultAsList;
     }
 }
Exemplo n.º 6
0
 private static void ToggleTab(InspectTabBase tab, IInspectPane pane)
 {
     if (InspectPaneUtility.IsOpen(tab, pane) || (tab == null && pane.OpenTabType == null))
     {
         pane.OpenTabType = null;
         SoundDefOf.TabClose.PlayOneShotOnCamera(null);
     }
     else
     {
         tab.OnOpen();
         pane.OpenTabType = tab.GetType();
         SoundDefOf.TabOpen.PlayOneShotOnCamera(null);
     }
 }
Exemplo n.º 7
0
        private static void AddComp()
        {
            //unrelated, single time load mod check
            //foreach (ModContentPack p in LoadedModManager.RunningMods)
            //{
            //    Log.Message(p.Name + "");
            //}

            //&& def.HasComp(typeof(CompQuality))
            IEnumerable <ThingDef> enumerable = from def in DefDatabase <ThingDef> .AllDefs
                                                where (def.IsMeleeWeapon || def.IsRangedWeapon || def.IsApparel) && !def.HasComp(typeof(CompEnchantedItem))
                                                select def;
            Type           typeFromHandle = typeof(ITab_Enchantment);
            InspectTabBase sharedInstance = InspectTabManager.GetSharedInstance(typeFromHandle);

            foreach (ThingDef current in enumerable)
            {
                //if (current.defName != "TM_ThrumboAxe" && current.defName != "TM_FireWand" && current.defName != "TM_IceWand" && current.defName != "TM_LightningWand" &&
                //    current.defName != "TM_BlazingPowerStaff" && current.defName != "TM_DefenderStaff")
                if (!current.defName.Contains("TM_"))
                {
                    CompProperties_EnchantedItem item = new CompProperties_EnchantedItem
                    {
                        compClass = typeof(CompEnchantedItem)
                    };
                    current.comps.Add(item);

                    if (current.inspectorTabs == null || current.inspectorTabs.Count == 0)
                    {
                        current.inspectorTabs         = new List <Type>();
                        current.inspectorTabsResolved = new List <InspectTabBase>();
                    }
                    current.inspectorTabs.Add(typeFromHandle);
                    current.inspectorTabsResolved.Add(sharedInstance);
                }
            }

            //IEnumerable<ThingDef> enumerable1 = from def in DefDatabase<ThingDef>.AllDefs
            //                                   where (def.race != null && def.race.Humanlike && !def.HasComp(typeof(CompEnchant)))
            //                                    select def;
            //foreach (ThingDef current1 in enumerable1)
            //{
            //    CompProperties_Enchant enchanting = new CompProperties_Enchant
            //    {
            //        compClass = typeof(CompEnchant)
            //    };
            //    current1.comps.Add(enchanting);
            //}
        }
Exemplo n.º 8
0
        public static InspectTabBase OpenTab(Type inspectTabType)
        {
            MainTabWindow_Inspect mainTabWindow_Inspect = (MainTabWindow_Inspect)MainButtonDefOf.Inspect.TabWindow;
            InspectTabBase        t = null;

            if (mainTabWindow_Inspect.CurTabs != null)
            {
                IList list = mainTabWindow_Inspect.CurTabs as IList;
                if (list != null)
                {
                    for (int i = 0; i < list.Count && !FindFunction((InspectTabBase)list[i]); i++)
                    {
                    }
                }
                else
                {
                    using (IEnumerator <InspectTabBase> enumerator = mainTabWindow_Inspect.CurTabs.GetEnumerator())
                    {
                        while (enumerator.MoveNext() && !FindFunction(enumerator.Current))
                        {
                        }
                    }
                }
            }
            if (t != null)
            {
                if (Find.MainTabsRoot.OpenTab != MainButtonDefOf.Inspect)
                {
                    Find.MainTabsRoot.SetCurrentTab(MainButtonDefOf.Inspect);
                }
                if (!IsOpen(t, mainTabWindow_Inspect))
                {
                    ToggleTab(t, mainTabWindow_Inspect);
                }
            }
            return(t);

            bool FindFunction(InspectTabBase inspect)
            {
                if (inspectTabType.IsAssignableFrom(inspect.GetType()))
                {
                    return(true);
                }
                return(false);
            }
        }
Exemplo n.º 9
0
        private void ToggleTab()
        {
            MainTabWindow_Inspect mainTabWindow_Inspect = (MainTabWindow_Inspect)Find.MainTabsRoot.OpenTab.TabWindow;

            if (_tabType == mainTabWindow_Inspect.OpenTabType)
            {
                mainTabWindow_Inspect.OpenTabType = null;
                SoundDefOf.TabClose.PlayOneShotOnCamera();
            }
            else
            {
                InspectTabBase inspectTabBase = mainTabWindow_Inspect.CurTabs.Where((InspectTabBase t) => _tabType.IsAssignableFrom(t.GetType())).FirstOrDefault();
                inspectTabBase?.OnOpen();
                mainTabWindow_Inspect.OpenTabType = _tabType;
                SoundDefOf.TabOpen.PlayOneShotOnCamera();
            }
        }
Exemplo n.º 10
0
        public override bool Inject()
        {
            // get reference to lists of itabs
            List <Type>           itabs         = ThingDefOf.Human.inspectorTabs;
            List <InspectTabBase> itabsResolved = ThingDefOf.Human.inspectorTabsResolved;

            /*
             *
             #if DEBUG
             * Log.Message( "Inspector tab types on humans:" );
             * foreach ( var tab in itabs )
             * {
             *  Log.Message( "\t" + tab.Name );
             * }
             * Log.Message( "Resolved tab instances on humans:" );
             * foreach ( var tab in itabsResolved )
             * {
             *  Log.Message( "\t" + tab.labelKey.Translate() );
             * }
             #endif
             */

            // replace ITab in the unresolved list
            int index = itabs.IndexOf(typeof(ITab_Pawn_Gear));

            if (index != -1)
            {
                itabs.Remove(typeof(ITab_Pawn_Gear));
                itabs.Insert(index, typeof(ITab_Inventory));
            }

            // replace resolved ITab, if needed.
            InspectTabBase oldGearTab = InspectTabManager.GetSharedInstance(typeof(ITab_Pawn_Gear));
            InspectTabBase newGearTab = InspectTabManager.GetSharedInstance(typeof(ITab_Inventory));

            if (!itabsResolved.NullOrEmpty() && itabsResolved.Contains(oldGearTab))
            {
                int resolvedIndex = itabsResolved.IndexOf(oldGearTab);
                itabsResolved.Insert(resolvedIndex, newGearTab);
                itabsResolved.Remove(oldGearTab);
            }

            return(true);
        }
Exemplo n.º 11
0
        public static void ChooseMenuAction(InspectTabBase tab)
        {
            bool flag = tab is ITab;

            if (flag)
            {
                InspectPaneUtility.OpenTab(tab.GetType());
            }
            else
            {
                bool flag2 = tab is WITab;
                if (flag2)
                {
                    Find.MainTabsRoot.EscapeCurrentTab(false);
                    tab.OnOpen();
                    Find.World.UI.inspectPane.OpenTabType = tab.GetType();
                }
            }
        }
        public static InspectTabBase OpenTab(Type inspectTabType)
        {
            MainTabWindow_Inspect mainTabWindow_Inspect = (MainTabWindow_Inspect)MainButtonDefOf.Inspect.TabWindow;
            InspectTabBase        inspectTabBase        = (from t in mainTabWindow_Inspect.CurTabs
                                                           where inspectTabType.IsAssignableFrom(t.GetType())
                                                           select t).FirstOrDefault <InspectTabBase>();

            if (inspectTabBase != null)
            {
                if (Find.MainTabsRoot.OpenTab != MainButtonDefOf.Inspect)
                {
                    Find.MainTabsRoot.SetCurrentTab(MainButtonDefOf.Inspect, true);
                }
                if (!InspectPaneUtility.IsOpen(inspectTabBase, mainTabWindow_Inspect))
                {
                    InspectPaneUtility.ToggleTab(inspectTabBase, mainTabWindow_Inspect);
                }
            }
            return(inspectTabBase);
        }
Exemplo n.º 13
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    this.$current = Zone_Stockpile.StorageTab;
                    if (!this.$disposing)
                    {
                        this.$PC = 1;
                    }
                    return(true);

                case 1u:
                    this.$PC = -1;
                    break;
                }
                return(false);
            }
Exemplo n.º 14
0
        public static bool Prefix(MethodBase __originalMethod, InspectTabBase tab, ref string __state)
        {
            if (!Active)
            {
                return(true);
            }

            __state = string.Empty;
            if (tab is InspectTabBase f)
            {
                __state = string.Intern($"{tab.GetType()} {tab.labelKey}");
            }
            else
            {
                __state = string.Intern($"{tab.GetType()}");
            }

            ProfileController.Start(__state, null, tab.GetType(), __originalMethod);

            return(true);
        }
Exemplo n.º 15
0
        public static void MakeFCIFloatMenu(Action <InspectTabBase> itemAction, ISelectable selObj)
        {
            bool flag = selObj is Thing;

            if (flag)
            {
                Find.Selector.ClearSelection();
                Find.Selector.Select(selObj, false, true);
            }
            else
            {
                bool flag2 = selObj is WorldObject;
                if (flag2)
                {
                    Find.WorldSelector.ClearSelection();
                    Find.WorldSelector.Select((WorldObject)selObj, false);
                }
            }
            IEnumerable <InspectTabBase> inspectTabs = selObj.GetInspectTabs();
            List <FloatMenuOption>       list        = new List <FloatMenuOption>();

            using (IEnumerator <InspectTabBase> enumerator = inspectTabs.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    InspectTabBase tab       = enumerator.Current;
                    bool           isVisible = tab.IsVisible;
                    if (isVisible)
                    {
                        list.Add(new FloatMenuOption(Translator.Translate(tab.labelKey), delegate()
                        {
                            itemAction(tab);
                        }, MenuOptionPriority.Default, null, null, 0f, null, null));
                    }
                }
            }
            list.Reverse();
            Find.WindowStack.Add(new FloatMenu(list));
        }
Exemplo n.º 16
0
        private static void AddComp()
        {
            IEnumerable <ThingDef> enumerable = from def in DefDatabase <ThingDef> .AllDefs
                                                where (def.IsMeleeWeapon || def.IsRangedWeapon || def.IsApparel) && def.HasComp(typeof(CompQuality)) && !def.HasComp(typeof(CompEnchantedItem))
                                                select def;
            Type           typeFromHandle = typeof(ITab_Enchantment);
            InspectTabBase sharedInstance = InspectTabManager.GetSharedInstance(typeFromHandle);

            foreach (ThingDef current in enumerable)
            {
                CompProperties_EnchantedItem item = new CompProperties_EnchantedItem
                {
                    compClass = typeof(CompEnchantedItem)
                };
                current.comps.Add(item);

                if (current.inspectorTabs == null || current.inspectorTabs.Count == 0)
                {
                    current.inspectorTabs         = new List <Type>();
                    current.inspectorTabsResolved = new List <InspectTabBase>();
                }
                current.inspectorTabs.Add(typeFromHandle);
                current.inspectorTabsResolved.Add(sharedInstance);
            }

            //IEnumerable<ThingDef> enumerable1 = from def in DefDatabase<ThingDef>.AllDefs
            //                                   where (def.race != null && def.race.Humanlike && !def.HasComp(typeof(CompEnchant)))
            //                                    select def;
            //foreach (ThingDef current1 in enumerable1)
            //{
            //    CompProperties_Enchant enchanting = new CompProperties_Enchant
            //    {
            //        compClass = typeof(CompEnchant)
            //    };
            //    current1.comps.Add(enchanting);
            //}
        }
Exemplo n.º 17
0
 static void InterfaceToggleTab(InspectTabBase current, IInspectPane pane)
 {
     typeof(RimWorld.InspectPaneUtility).GetMethod("InterfaceToggleTab", AccessTools.all).Invoke(null, new object[] { current, pane });
 }
Exemplo n.º 18
0
 public bool IsOfTypeRimFactoryBillsTab(InspectTabBase tab)
 {
     return(_isRimfactoryLoaded && tab?.GetType() == _rimFactoryBillsTabType);
 }
Exemplo n.º 19
0
 private static void InterfaceToggleTab(InspectTabBase tab, IInspectPane pane) => Access.Method_RimWorld_InspectPaneUtility_InterfaceToggleTab.Invoke(null, new object[] { tab, pane });
 static void InterfaceToggleTab(InspectTabBase current, IInspectPane pane)
 {
     typeof(RimWorld.InspectPaneUtility).GetMethod("InterfaceToggleTab", Helpers.AllBindingFlags).Invoke(null, new object[] { current, pane });
 }
 internal bool <> m__0(InspectTabBase t)
 {
     return(this.inspectTabType.IsAssignableFrom(t.GetType()));
 }
Exemplo n.º 22
0
 private static bool IsOpen(InspectTabBase tab, IInspectPane pane)
 {
     return(tab.GetType() == pane.OpenTabType);
 }