示例#1
0
        public static bool CheatMenuPre(ref CheatMenu __instance)
        {
            if (__instance.name != "CheatsMenu")
            {
                return(true);
            }

            Type      typeInQuestion  = typeof(CheatMenu);
            var       newMenuObject   = UIExBlueprint.Duplicate(__instance.menuBlueprint_);
            FieldInfo menuObjectField = typeInQuestion.BaseType.GetField("menuObject_", BindingFlags.Instance | BindingFlags.NonPublic);

            if (menuObjectField == null)
            {
                Util.Logger.Instance.Log($"[CheatMenuPre] {__instance.name} menuObject_ field get fail");
                return(true);
            }

            menuObjectField.SetValue(__instance, newMenuObject);
            SuperDuperMenu newMenu   = newMenuObject.GetComponent <SuperDuperMenu>();
            FieldInfo      menuField = typeInQuestion.BaseType.GetField("menu_", BindingFlags.NonPublic | BindingFlags.Instance);

            menuField.SetValue(__instance, newMenu);

            if (newMenu == null)
            {
                Util.Logger.Instance.Log($"[CheatMenuPre] {__instance.name}  NewMenu is null (oh shit!)");
                return(false);
            }

            newMenu.Init(__instance);
            newMenu.menuTitleLabel_.text = "PLZ NO CHEAT :D";
            newMenuObject.name           = __instance.Name_;

            return(false);
        }
        public OptionsSubmenuButton(string text)
        {
            _blueprint = GetBlueprint();

            if (_blueprint == null)
            {
                return;
            }

            _button      = UIExBlueprint.Duplicate(_blueprint);
            _buttonLabel = _button.transform.Find("UILabel")?.GetComponent <UILabel>();

            _buttonLabel.text = text;
            Text = text;

            _button.SetActive(true);
            _buttonsTable.repositionNow = true;
        }