Beispiel #1
0
        public static void ShowQuickmenuPage(string pagename)
        {
            QuickMenu quickMenuInstance = QuickMenuUtils.GetQuickMenuInstance();
            Transform transform         = (quickMenuInstance != null) ? quickMenuInstance.transform.Find(pagename) : null;

            if (transform == null)
            {
            }
            if (QuickMenuUtils.currentPageGetter == null)
            {
                GameObject gameObject = quickMenuInstance.transform.Find("ShortcutMenu").gameObject;
                if (!gameObject.activeInHierarchy)
                {
                    gameObject = quickMenuInstance.transform.Find("UserInteractMenu").gameObject;
                }
                FieldInfo[] array = (from fi in Il2CppType.Of <QuickMenu>().GetFields(BindingFlags.Instance | BindingFlags.NonPublic)
                                     where fi.FieldType == Il2CppType.Of <GameObject>()
                                     select fi).ToArray <FieldInfo>();
                int num = 0;
                foreach (FieldInfo fieldInfo in array)
                {
                    Il2CppSystem.Object value = fieldInfo.GetValue(quickMenuInstance);
                    if (((value != null) ? value.TryCast <GameObject>() : null) == gameObject && ++num == 2)
                    {
                        QuickMenuUtils.currentPageGetter = fieldInfo;
                        break;
                    }
                }
                if (QuickMenuUtils.currentPageGetter == null)
                {
                    return;
                }
            }
            Il2CppSystem.Object value2 = QuickMenuUtils.currentPageGetter.GetValue(quickMenuInstance);
            if (value2 != null)
            {
                value2.Cast <GameObject>().SetActive(false);
            }
            QuickMenuUtils.GetQuickMenuInstance().transform.Find("QuickMenu_NewElements/_InfoBar").gameObject.SetActive(pagename == "ShortcutMenu");
            QuickMenuUtils.GetQuickMenuInstance().field_Private_QuickMenuContextualDisplay_0.Method_Public_Void_EnumNPublicSealedvaUnNoToUs7vUsNoUnique_0(QuickMenuContextualDisplay.EnumNPublicSealedvaUnNoToUs7vUsNoUnique.NoSelection);
            transform.gameObject.SetActive(true);
            QuickMenuUtils.currentPageGetter.SetValue(quickMenuInstance, transform.gameObject);
            if (pagename == "ShortcutMenu")
            {
                QuickMenuUtils.SetIndex(0);
                return;
            }
            if (pagename == "UserInteractMenu")
            {
                QuickMenuUtils.SetIndex(3);
                return;
            }
            QuickMenuUtils.SetIndex(-1);
        }
 /// <summary>
 /// (Cross-Game compatible) Check if object is the same type as T
 /// </summary>
 /// <typeparam name="T">Type to check</typeparam>
 public static bool IsType <T>(this Object instance) where T : Object
 {
     return(instance?.TryCast <T>() != null);
 }
 /// <summary>
 /// (Cross-Game compatible) Check if object is the same type as T
 /// </summary>
 /// <param name="instance"></param>
 /// <param name="castObject">The casted object if this is of type T</param>
 /// <typeparam name="T">Type to check</typeparam>
 public static bool IsType <T>(this Object instance, out T castObject) where T : Object
 {
     castObject = instance?.TryCast <T>();
     return(castObject != null);
 }
 /// <summary>
 /// (Cross-Game compatible) Is this Reference equal to another Object's Reference?
 /// </summary>
 /// <param name="instance"></param>
 /// <param name="to">Object to compare to</param>
 /// <returns></returns>
 public static bool ReferenceEquals(this Object instance, Object to)
 {
     return(ReferenceEquals(instance, (object)to));
 }