Ejemplo n.º 1
0
        public static PedalOption AddRadialPedalToSubMenu(Action <float> onUpdate, string text = "Button Text", float startingValue = 0, Texture2D icon = null)
        {
            ActionMenuOpener actionMenuOpener = Utilities.GetActionMenuOpener();

            if (actionMenuOpener == null)
            {
                return(null);
            }
            PedalOption pedalOption = actionMenuOpener.GetActionMenu().AddOption();

            pedalOption.setText(text);
            pedalOption.setIcon(icon);
            pedalOption.field_Public_ActionButton_0.prop_String_1             = $"{Math.Round(startingValue)}%";
            pedalOption.field_Public_ActionButton_0.prop_Texture2D_2          = Utilities.GetExpressionsIcons().typeRadial;
            pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(new Action(delegate
            {
                Action <float> combinedAction = (System.Action <float>) Delegate.Combine(new Action <float>(delegate(float f)
                {
                    startingValue = f;

                    pedalOption.field_Public_ActionButton_0.prop_String_1 = $"{Math.Round(startingValue)}%";
                }), onUpdate);
                RadialPuppetManager.OpenRadialMenu(startingValue, combinedAction, text);
            }));
            return(pedalOption);
        }
Ejemplo n.º 2
0
 public static void RegisterFunctionType <TType, TReturns>()
 {
     DelegateSupport._functions[typeof(TType)][DelegateSupport.GetTypes(new Type[]
     {
         typeof(TReturns)
     })] = ((object target, object[] parms, Delegate @delegate) => ((Func <TType, TReturns>)@delegate)((TType)((object)target)));
 }
Ejemplo n.º 3
0
 static VariablesToSave()
 {
     VariablesToSave._randomNumber = UnityEngine.Random.Range(10, 200);
     DelegateSupport.RegisterFunctionType <VariablesToSave, string>();
     DelegateSupport.RegisterFunctionType <VariablesToSave, bool>();
     DelegateSupport.RegisterFunctionType <VariablesToSave, int>();
 }
Ejemplo n.º 4
0
        public static PedalOption AddTogglePedalToSubMenu(Action <bool> onToggle, bool startingState, string text, Texture2D icon = null)
        {
            ActionMenuOpener actionMenuOpener = Utilities.GetActionMenuOpener();

            if (actionMenuOpener == null)
            {
                return(null);
            }
            PedalOption pedalOption = actionMenuOpener.GetActionMenu().AddOption();

            pedalOption.setText(text);
            pedalOption.setIcon(icon);
            if (startingState)
            {
                pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = Utilities.GetExpressionsIcons().typeToggleOn;
            }
            else
            {
                pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = Utilities.GetExpressionsIcons().typeToggleOff;
            }
            pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(new Action(delegate
            {
                startingState = !startingState;
                if (startingState)
                {
                    pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = Utilities.GetExpressionsIcons().typeToggleOn;
                }
                else
                {
                    pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = Utilities.GetExpressionsIcons().typeToggleOff;
                }
                onToggle.Invoke(startingState);
            }));
            return(pedalOption);
        }
Ejemplo n.º 5
0
 private static string GetTypes(MethodInfo mi)
 {
     return(DelegateSupport.GetTypes((from p in mi.GetParameters()
                                      select p.ParameterType).Concat(new Type[]
     {
         mi.ReturnType
     }).ToArray <Type>()));
 }
Ejemplo n.º 6
0
 public void setAction(Action buttonAction)
 {
     button.GetComponent <Button>().onClick = new Button.ButtonClickedEvent();
     if (buttonAction != null)
     {
         button.GetComponent <Button>().onClick.AddListener(DelegateSupport.ConvertDelegate <UnityAction>(buttonAction));
     }
 }
Ejemplo n.º 7
0
 static StoreMaterials()
 {
     DelegateSupport.RegisterFunctionType <Texture2D, int>();
     DelegateSupport.RegisterFunctionType <StoreMaterials, List <MaterialProperty> >();
     DelegateSupport.RegisterFunctionType <MaterialProperty, MaterialProperty.PropertyType>();
     DelegateSupport.RegisterFunctionType <MaterialProperty, string>();
     DelegateSupport.RegisterFunctionType <StoredValue, MaterialProperty>();
     DelegateSupport.RegisterFunctionType <StoredValue, object>();
 }
Ejemplo n.º 8
0
 private static void AddPedalsInList(List <PedalStruct> pedalStructs, ActionMenu instance)
 {
     foreach (PedalStruct pedalStruct in pedalStructs)
     {
         PedalOption pedalOption = instance.AddOption();
         pedalOption.setText(pedalStruct.text); //    VVV
         pedalOption.setIcon(pedalStruct.icon); //Pretty self explanatory
         pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent);
     }
 }
Ejemplo n.º 9
0
 public static void RegisterFunctionType <TType, T1, T2, T3, TReturns>()
 {
     DelegateSupport._functions[typeof(TType)][DelegateSupport.GetTypes(new Type[]
     {
         typeof(T1),
         typeof(T2),
         typeof(T3),
         typeof(TReturns)
     })] = ((object target, object[] parms, Delegate @delegate) => ((Func <TType, T1, T2, T3, TReturns>)@delegate)((TType)((object)target), (T1)((object)parms[0]), (T2)((object)parms[1]), (T3)((object)parms[2])));
 }
Ejemplo n.º 10
0
 static StoreMaterials()
 {
     StoreMaterials.cache = new Index <string, List <StoreMaterials.MaterialProperty> >();
     DelegateSupport.RegisterFunctionType <Texture2D, int>();
     DelegateSupport.RegisterFunctionType <StoreMaterials, List <StoreMaterials.MaterialProperty> >();
     DelegateSupport.RegisterFunctionType <StoreMaterials.MaterialProperty, StoreMaterials.MaterialProperty.PropertyType>();
     DelegateSupport.RegisterFunctionType <StoreMaterials.MaterialProperty, string>();
     DelegateSupport.RegisterFunctionType <StoreMaterials.StoredValue, StoreMaterials.MaterialProperty>();
     DelegateSupport.RegisterFunctionType <StoreMaterials.StoredValue, object>();
 }
Ejemplo n.º 11
0
 public static void RegisterActionType <TType>()
 {
     DelegateSupport._functions[typeof(TType)][DelegateSupport.GetTypes(new Type[]
     {
         typeof(void)
     })] = delegate(object target, object[] parms, Delegate @delegate)
     {
         ((Action <TType>)@delegate)((TType)((object)target));
         return(null);
     };
 }
Ejemplo n.º 12
0
        private IEnumerator WaitForUiManagerInit()
        {
            while (VRCUiManager.prop_VRCUiManager_0 == null)
            {
                yield return(null);
            }

            GameObject SafetyUiMenu = GameObject.Find("UserInterface/MenuContent/Screens/Settings_Safety");

            _cachedPageSafety = SafetyUiMenu.GetComponent <VRCUiPageSafety>();

            Transform SafetyMatrixTogglesTransform = GameObject.Find("UserInterface/MenuContent/Screens/Settings_Safety/_SafetyMatrix/_Toggles").transform;

            // Rescale all children to make it not be  S Q U I S H
            foreach (var t in SafetyMatrixTogglesTransform)
            {
                t.Cast <Transform>().localScale = new Vector3(0.9f, 0.9f, 0.9f);
            }

            GameObject DynamicBoneToggle = GameObject.Instantiate(GameObject.Find("UserInterface/MenuContent/Screens/Settings_Safety/_SafetyMatrix/_Toggles/Toggle_CustomAnimations"), SafetyMatrixTogglesTransform);

            DynamicBoneToggle.name = "Toggle_DynamicBones";

            DynamicBoneToggle.GetComponentInChildren <Text>().text = "Dynamic Bones";

            UiSafetyFeatureToggle UiSafetyFeature = DynamicBoneToggle.GetComponent <UiSafetyFeatureToggle>();

            UiSafetyFeature.field_Public_String_0 = "<i>Dynamic Bones</i> turns on or off dynamic bones on a user's avatar for the combined <i>Safety Mode</i> and <i>User Trust Rank</i>.";
            UiSafetyFeature.GetType().GetProperties().Where(prop => prop.PropertyType.IsEnum).First().SetValue(UiSafetyFeature, DynamicBonesEnumValue);

            Toggle BoneToggle = DynamicBoneToggle.GetComponent <Toggle>();

            BoneToggle.onValueChanged.AddListener(DelegateSupport.ConvertDelegate <UnityAction <bool> >(new Action <bool>(delegate
            {
                CanUseBones[UiPageSafetySelectedSocial] = BoneToggle.isOn;
                File.WriteAllText("UserData/DynamicBonesSafety.json", JsonConvert.SerializeObject(CanUseBones, Formatting.Indented));
            })));

            // Load our icon
            // Taken directly from UIX
            AssetBundle assetBundle;

            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("DynamicBonesSafety.dbsmod"))
                using (var tempStream = new MemoryStream((int)stream.Length))
                {
                    stream.CopyTo(tempStream);

                    assetBundle            = AssetBundle.LoadFromMemory_Internal(tempStream.ToArray(), 0);
                    assetBundle.hideFlags |= HideFlags.DontUnloadUnusedAsset;
                }

            DynamicBoneToggle.GetComponentInChildren <RawImage>().texture = assetBundle.LoadAsset_Internal("boneIcon", Il2CppType.Of <Texture2D>()).Cast <Texture2D>();
        }
Ejemplo n.º 13
0
 //thanks to Plague#2850 for helping with the popup and abbeybabbey for helping with the ImmobilizePlayer code
 internal static void InputPopup(string title, Action <string> okaction)
 {
     ImmobilizePlayer(true);
     VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0
     .Method_Public_Void_String_String_InputType_Boolean_String_Action_3_String_List_1_KeyCode_Text_Action_String_Boolean_Action_1_VRCUiPopup_0(
         title, "", InputField.InputType.Standard, false, "Confirm",
         DelegateSupport.ConvertDelegate <Il2CppSystem.Action <string, List <KeyCode>, Text> >(
             (Action <string, List <KeyCode>, Text>) delegate(string s, List <KeyCode> k, Text t)
     {
         ImmobilizePlayer(false);
         okaction(s);
     }), new Action(() => { ImmobilizePlayer(false); }), "...");
 }
Ejemplo n.º 14
0
 public static void RegisterActionType <TType, T1, T2, T3>()
 {
     DelegateSupport._functions[typeof(TType)][DelegateSupport.GetTypes(new Type[]
     {
         typeof(T1),
         typeof(T2),
         typeof(T3),
         typeof(void)
     })] = delegate(object target, object[] parms, Delegate @delegate)
     {
         ((Action <TType, T1, T2, T3>)@delegate)((TType)((object)target), (T1)((object)parms[0]), (T2)((object)parms[1]), (T3)((object)parms[2]));
         return(null);
     };
 }
Ejemplo n.º 15
0
        public static PedalOption AddButtonPedalToSubMenu(Action triggerEvent, string text = "Button Text", Texture2D icon = null)
        {
            ActionMenuOpener actionMenuOpener = Utilities.GetActionMenuOpener();

            if (actionMenuOpener == null)
            {
                return(null);
            }
            PedalOption pedalOption = actionMenuOpener.GetActionMenu().AddOption();

            pedalOption.setText(text);
            pedalOption.setIcon(icon);
            pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(triggerEvent);
            return(pedalOption);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// If you create a custom Submenu you can use this to add your pedals to it
        /// </summary>
        /// <param name="triggerEvent">Called on pedal click</param>
        /// <param name="text">Pedal Text</param>
        /// <param name="icon">Pedal Icon</param>
        public PedalOption AddPedalToCustomMenu(System.Action triggerEvent, string text = "Button Text", Texture2D icon = null)
        {
            ActionMenuOpener actionMenuOpener = GetActionMenuOpener();

            if (actionMenuOpener == null)
            {
                return(null);
            }
            PedalOption pedalOption = actionMenuOpener.field_Public_ActionMenu_0.AddOption();

            pedalOption.setText(text); //    VVV
            pedalOption.setIcon(icon); //Pretty self explanatory
            pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(triggerEvent);

            return(pedalOption);
        }
Ejemplo n.º 17
0
 public static IntPtr EnumerableSetup(Vector3 position, float radius, IntPtr something1, IntPtr something2, IntPtr nativeMethodInfo)
 {
     if (!IsUp)
     {
         return(_playerIEnumerableSetupDelegate(position, radius, something1, something2, nativeMethodInfo));
     }
     try
     {
         var myFunc = DelegateSupport.ConvertDelegate <Il2CppSystem.Func <Player, bool> >
                          (new Func <Player, bool>(player => player.prop_APIUser_0.id == Player.prop_Player_0.prop_APIUser_0.id));
         return(_playerIEnumerableSetupDelegate(position, radius, something1, myFunc.Pointer, nativeMethodInfo));
     }
     catch (Exception e)
     {
         Main.Logger.Msg(ConsoleColor.Yellow, "Something went wrong in PlayerIEnumerableSetup Patch, please tell Davi:");
         Main.Logger.Error($"{e}");
     }
     return(_playerIEnumerableSetupDelegate(position, radius, something1, something2, nativeMethodInfo));
 }
Ejemplo n.º 18
0
    public static object FastInvoke(this MethodInfo mi, object target, params object[] parameters)
    {
        Func <object, object[], object> func;

        if (DelegateSupport._methods.TryGetValue(mi, out func))
        {
            return(func(target, parameters));
        }
        string types;

        if (!mi.IsStatic && DelegateSupport._functions.ContainsKey(mi.DeclaringType) && DelegateSupport._functions[mi.DeclaringType].ContainsKey(types = DelegateSupport.GetTypes(mi)))
        {
            Delegate @delegate = DelegateSupport.ToOpenDelegate(mi);
            Func <object, object[], Delegate, object> inner = DelegateSupport._functions[mi.DeclaringType][types];
            Func <object, object[], object>           func2 = (object t, object[] p) => inner(t, p, @delegate);
            DelegateSupport._methods[mi] = func2;
            Func <object, object[], object> func3 = func2;
            return(func3(target, parameters));
        }
        return(mi.Invoke(target, parameters));
    }
Ejemplo n.º 19
0
        public override void VRChat_OnUiManagerInit()
        {
            GameObject unblockButton = GameObject
                                       .Instantiate(
                GameObject.Find(
                    "UserInterface/MenuContent/Popups/LoadingPopup/ProgressPanel/Parent_Loading_Progress/GoButton")
                .transform,
                GameObject.Find("UserInterface/MenuContent/Popups/LoadingPopup/ProgressPanel").transform)
                                       .gameObject;

            unblockButton.GetComponentInChildren <Text>().text = "Unblock Queue";
            unblockButton.GetComponent <Button>().onClick      = new Button.ButtonClickedEvent();
            unblockButton.GetComponent <Button>().onClick.AddListener(DelegateSupport.ConvertDelegate <UnityAction>(
                                                                          new Action(delegate
            {
                Utilities.UnblockUnPackQueue();
                Utilities.DeselectClickedButton(unblockButton);
            })));
            unblockButton.GetComponent <Transform>().localPosition = new Vector3(-2.4f, -124f, 0);
            GameObject.Find("UserInterface/MenuContent/Popups/LoadingPopup/ProgressPanel/Parent_Loading_Progress")
            .transform.localPosition = new Vector3(0, 17, 0);
        }
Ejemplo n.º 20
0
        public static PedalOption AddFourAxisPedalToSubMenu(string text, Vector2 startingValue, Action <Vector2> onUpdate, Texture2D icon = null, string topButtonText = "Up",
                                                            string rightButtonText = "Right", string downButtonText = "Down", string leftButtonText = "Left")
        {
            ActionMenuOpener actionMenuOpener = Utilities.GetActionMenuOpener();

            if (actionMenuOpener == null)
            {
                return(null);
            }
            PedalOption pedalOption = actionMenuOpener.GetActionMenu().AddOption();

            pedalOption.setText(text);
            pedalOption.setIcon(icon);
            pedalOption.field_Public_ActionButton_0.prop_Texture2D_2          = Utilities.GetExpressionsIcons().typeAxis;
            pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(new Action(delegate
            {
                FourAxisPuppetManager.OpenFourAxisMenu(startingValue, v => startingValue = v, text, onUpdate);
                FourAxisPuppetManager.current.GetButtonUp().SetButtonText(topButtonText);
                FourAxisPuppetManager.current.GetButtonRight().SetButtonText(rightButtonText);
                FourAxisPuppetManager.current.GetButtonDown().SetButtonText(downButtonText);
                FourAxisPuppetManager.current.GetButtonLeft().SetButtonText(leftButtonText);
            }));
            return(pedalOption);
        }
Ejemplo n.º 21
0
        private static void main_menu()
        {
            //page 1 mains
            var ck_flight = utils.make_text_toggle(0, 0, "Flight", fly_mode, main_menu_mod, new Action <bool>((a) =>
            {
                if (a == true)
                {
                    fly_mode = true;
                    if (isNoclip)
                    {
                        return;
                    }
                    Physics.gravity = new Vector3(0, 0, 0);
                }
                if (a == false)
                {
                    fly_mode = false;
                    if (isNoclip)
                    {
                        return;
                    }
                    Physics.gravity = VRCSDK2.VRC_SceneDescriptor.Instance.gravity;
                    VRCPlayer.field_Internal_Static_VRCPlayer_0.GetComponent <VRCMotionState>().Method_Public_Void_0();
                }
            }));

            var ck_noclip = utils.make_text_toggle(1100, 0, "No-clip", isNoclip, main_menu_mod, new Action <bool>((a) =>
            {
                if (a)
                {
                    if (fly_mode == true)
                    {
                        fly_mode = false;
                    }
                    isNoclip = true;
                    flying.noclip();
                }
                else
                {
                    isNoclip = false;
                    flying.noclip();
                }
            }));

            var ck_forceclone = utils.make_text_toggle(0, 150, "Force-clone", clone_mode, main_menu_mod, new Action <bool>((a) =>
            {
                if (a)
                {
                    clone_mode = true;
                }
                else
                {
                    clone_mode = false;
                }
            }));

            var ck_playeresp = utils.make_text_toggle(1100, 150, "Player-ESP", esp_players, main_menu_mod, new Action <bool>((a) =>
            {
                if (a)
                {
                    esp_players = true;
                }
                else
                {
                    esp_players        = false;
                    GameObject[] array = GameObject.FindGameObjectsWithTag("Player");
                    for (int i = 0; i < array.Length; i++)
                    {
                        if (array[i].transform.Find("SelectRegion"))
                        {
                            utils.toggle_outline(array[i].transform.Find("SelectRegion").GetComponent <Renderer>(), false);
                        }
                    }
                }
            }));

            var ck_portalkiller = utils.make_text_toggle(0, 300, "Delete-portals", delete_portals, main_menu_mod, new Action <bool>((a) =>
            {
                if (a)
                {
                    delete_portals = true;
                }
                else
                {
                    delete_portals = false;
                }
            }));

            var ck_infoplus = utils.make_text_toggle(1100, 300, "Info+", info_plus_toggle, main_menu_mod, new Action <bool>((a) =>
            {
                if (a)
                {
                    info_plus_toggle = true;
                }
                else
                {
                    info_plus_toggle = false;

                    var users = utils.get_all_player();
                    var self  = utils.get_local();
                    if (self == null || users == null)
                    {
                        return;
                    }
                    for (int i = 0; i < users.Count; i++)
                    {
                        var user = users[i];
                        if (user == null || user.field_Private_APIUser_0 == null)
                        {
                            continue;
                        }
                        var canvas   = user.transform.Find("Canvas - Profile (1)/Text/Text - NameTag");
                        var canvas_2 = user.transform.Find("Canvas - Profile (1)/Text/Text - NameTag Drop");
                        if (canvas == null)
                        {
                            continue;
                        }
                        if (canvas_2 == null)
                        {
                            continue;
                        }
                        var text_object   = canvas.GetComponent <UnityEngine.UI.Text>();
                        var text_object_2 = canvas_2.GetComponent <UnityEngine.UI.Text>();
                        if (text_object == null || text_object_2 == null || text_object.enabled == false)
                        {
                            continue;
                        }
                        text_object.supportRichText = true;
                        text_object_2.text          = $"{user.field_Private_APIUser_0.displayName}";
                        text_object.text            = $"{user.field_Private_APIUser_0.displayName}";
                    }
                }
            }));

            var ck_speedup = utils.make_text_toggle(0, 450, "Speed+", speed_hacks, main_menu_mod, new Action <bool>((a) =>
            {
                if (a)
                {
                    speed_hacks = true;
                }
                else
                {
                    speed_hacks = false; speed.set_speeds(2f, 4f);
                }
            }));

            var ck_ignorefriend = utils.make_text_toggle(1100, 450, "IgnoreFriends", anti_crasher_ignore_friends, main_menu_mod, new Action <bool>((a) =>
            {
                if (a)
                {
                    anti_crasher_ignore_friends = true;
                }
                else
                {
                    anti_crasher_ignore_friends = false;
                }
            }));

            var ck_esprainbow = utils.make_text_toggle(0, 600, "ESP-rainbow", esp_rainbow_mode, main_menu_mod, new Action <bool>((a) =>
            {
                if (a)
                {
                    esp_rainbow_mode = true;
                }
                else
                {
                    esp_rainbow_mode = false;
                }
            }));

            var ck_antispawnsound = utils.make_text_toggle(1100, 600, "AntiSpawnMusic", anti_spawn_music, main_menu_mod, new Action <bool>((a) =>
            {
                if (a)
                {
                    anti_spawn_music = true;
                }
                else
                {
                    anti_spawn_music = false;
                }
            }));

            var ck_rainbowfriends = utils.make_text_toggle(0, 750, "Friend-rainbow", rainbow_friend_nameborder, main_menu_mod, new Action <bool>((a) =>
            {
                if (a)
                {
                    rainbow_friend_nameborder = true;
                }
                else
                {
                    rainbow_friend_nameborder = false;
                    var users = utils.get_all_player();
                    if (users == null)
                    {
                        return;
                    }
                    for (var i = 0; i < users.Count; i++)
                    {
                        var obj = users[i];
                        if (obj == null)
                        {
                            continue;
                        }
                        if (obj.field_Private_APIUser_0 == null)
                        {
                            continue;
                        }
                        if (utils.is_friend(obj) == false)
                        {
                            continue;
                        }
                        obj.field_Private_VRCPlayerApi_0.SetNamePlateColor(new Color(1f, 1f, 0f));
                    }
                }
            }));

            var ck_antishader = utils.make_text_toggle(1100, 750, "Anti-shader", anti_crasher_shader, main_menu_mod, new Action <bool>((a) =>
            {
                if (a)
                {
                    anti_crasher_shader = true;
                }
                else
                {
                    anti_crasher_shader = false; shader_menu.reset_all();
                }
            }));

            var ck_antishader_fetched = utils.make_text_toggle(0, 900, "Anti-shader-fetched", should_use_fetched_list, main_menu_mod, new Action <bool>((a) =>
            {
                if (a)
                {
                    should_use_fetched_list = true;
                }
                else
                {
                    should_use_fetched_list = false;
                }
            }));

            var ck_flying_onpress = utils.make_text_toggle(1100, 900, "Fly onpress", fly_mode_onpress, main_menu_mod, new Action <bool>((a) =>
            {
                if (a)
                {
                    fly_mode_onpress = true;
                }
                else
                {
                    fly_mode_onpress = false;
                }
            }));

            //half2
            var b_jump = btn_utils.create_btn(false, ButtonType.Default, "Allow jump", "Enables jumping in a world that has it disabled", Color.white, Color.green, -3, 1, main_menu_mod.transform, new Action(() => { if (VRCPlayer.field_Internal_Static_VRCPlayer_0.gameObject.GetComponent <PlayerModComponentJump>() == null)
                                                                                                                                                                                                                       {
                                                                                                                                                                                                                           VRCPlayer.field_Internal_Static_VRCPlayer_0.gameObject.AddComponent <PlayerModComponentJump>();
                                                                                                                                                                                                                       }
                                                                                                                                                                                                               }), new Action(() => { }), 2);
            var b_avi_by_id = btn_utils.create_btn(false, ButtonType.Default, "Avi-by-id", "Saved a avatar to Fav+ just by using the avatars ID", Color.white, Color.green, -2, 1, main_menu_mod.transform, new Action(() =>
            {
                menu.input_text("Enter the avatar ID (avtr_...)", "Confirm", new Action <string>((a) =>
                {
                    if (!a.Contains("avtr_"))
                    {
                        MelonModLogger.Log("Invalid avatar id!");
                        return;
                    }

                    var model = new ApiAvatar();
                    model.id  = a;

                    model.Get(DelegateSupport.ConvertDelegate <Il2CppSystem.Action <ApiContainer> >
                                  (new Action <ApiContainer>
                                      (delegate(ApiContainer t)
                    {
                        MelonModLogger.Log("Found avatar with name:" + model.name);
                        MelonModLogger.Log("Avatar status is: " + model.releaseStatus);
                        MelonModLogger.Log("Avatar asset URL: " + model.assetUrl);
                        if (model.releaseStatus.Contains("public"))
                        {
                            //add to list
                            avatar_utils.add_to_list(model);
                            avatar_utils.update_list(avatar_config.avatar_list.Select(x => x.avatar_ident), hashmod.fav_list.listing_avatars);
                            error_type_poput("Done!", "Added avatar to Fav+ (" + model.name + ")" + " by " + model.authorName);
                        }
                        else
                        {
                            MelonModLogger.Log("Avatar is private, can not add to Fav+!");
                        }
                    })));
                }));
            }), new Action(() => { }), 2);
            var b_pubs_by_id = btn_utils.create_btn(false, ButtonType.Default, "Pub-by-id", "Shows all public avatars for a user by his user ID", Color.white, Color.green, -1, 1, main_menu_mod.transform, new Action(() =>
            {
                if (Time.time > last_apicall)
                {
                    last_apicall = Time.time + 60;
                    menu.input_text("Enter the User ID (usr_...)", "Confirm", new Action <string>((a) =>
                    {
                        if (!a.Contains("usr_"))
                        {
                            MelonModLogger.Log("Invalid user id!");
                            return;
                        }

                        pubavatar.update_public_user_list(a);
                        VRCUiManager.prop_VRCUiManager_0.Method_Public_Boolean_1();
                    }));
                }
                else
                {
                    var sec_left = last_apicall - Time.time;
                    error_type_poput("Function is still on cooldown!", "Please wait " + Math.Floor(sec_left) + " seconds before trying again!");
                }
            }), new Action(() => { }), 2);
            var b_reset_dynbone = btn_utils.create_btn(false, ButtonType.Default, "Reset-bones", "Dsiables and clears current dynamic bone configurations", Color.white, Color.green, 0, 1, main_menu_mod.transform, new Action(() =>
            {
                foreach (var a in dynbones.map)
                {
                    dynbones.remove(a.Key);
                }
            }), new Action(() => { }), 2);
        }
Ejemplo n.º 22
0
        public override void VRChat_OnUiManagerInit()
        {
            var shortcutmenu = utils.get_quick_menu().transform.Find("ShortcutMenu");

            var screensmenu = GameObject.Find("Screens").transform.Find("UserInfo");

            if (!setup_userinfo_button && screensmenu != null && utils.get_quick_menu().transform.Find("ShortcutMenu/BuildNumText") != null)
            {
                setup_userinfo_button = true;

                /*setup of stuff*/
                pubavatar.setup_user_avatars_list();
                favplus.setup_fav_plus();

                /*clones*/
                var back_button                = screensmenu.transform.Find("BackButton");
                var clone_button               = UnityEngine.Object.Instantiate <GameObject>(back_button.gameObject);
                var clone_button_getasset      = UnityEngine.Object.Instantiate <GameObject>(back_button.gameObject);
                var clone_button_clonepub      = UnityEngine.Object.Instantiate <GameObject>(back_button.gameObject);
                var clone_button_clone_favplus = UnityEngine.Object.Instantiate <GameObject>(back_button.gameObject);
                var clone_button_clone_msg     = UnityEngine.Object.Instantiate <GameObject>(back_button.gameObject);
                var clone_button_clone         = UnityEngine.Object.Instantiate <GameObject>(utils.get_interact_menu().cloneAvatarButton.gameObject);

                clone_button.gameObject.name          = "Teleport";
                clone_button.transform.localPosition -= new Vector3(250, 0, 0);
                clone_button.GetComponentInChildren <UnityEngine.UI.Text>().text      = $"Teleport";
                clone_button.GetComponentInChildren <UnityEngine.UI.Button>().onClick = new UnityEngine.UI.Button.ButtonClickedEvent();
                clone_button.GetComponentInChildren <UnityEngine.UI.Button>().onClick.AddListener(new Action(() => { social.do_tp_to_social(); }));

                clone_button_getasset.gameObject.name          = $"Log asset";
                clone_button_getasset.transform.localPosition -= new Vector3(500, 0, 0);
                clone_button_getasset.GetComponentInChildren <UnityEngine.UI.Text>().text      = $"Log asset";
                clone_button_getasset.GetComponentInChildren <UnityEngine.UI.Button>().onClick = new UnityEngine.UI.Button.ButtonClickedEvent();
                clone_button_getasset.GetComponentInChildren <UnityEngine.UI.Button>().onClick.AddListener(new Action(() =>
                {
                    var menu         = GameObject.Find("Screens").transform.Find("UserInfo");
                    var userInfo     = menu.transform.GetComponentInChildren <VRC.UI.PageUserInfo>();
                    var found_player = utils.get_player(userInfo.user.id);
                    if (found_player == null)
                    {
                        MelonModLogger.Log("player could not be found id " + userInfo.user.id);
                        return;
                    }

                    MelonModLogger.Log("Asset for user " + userInfo.user.displayName + " -> " + found_player.field_Private_VRCAvatarManager_0.field_Private_ApiAvatar_0.assetUrl);
                    MelonModLogger.Log("Avatar ID: " + found_player.field_Private_VRCAvatarManager_0.field_Private_ApiAvatar_0.id);
                    MelonModLogger.Log("User ID: " + userInfo.user.id);
                }));

                clone_button_clonepub.gameObject.name          = $"Clone 2";
                clone_button_clonepub.transform.localPosition -= new Vector3(750, 0, 0);
                clone_button_clonepub.GetComponentInChildren <UnityEngine.UI.Text>().text      = $"Clone";
                clone_button_clonepub.GetComponentInChildren <UnityEngine.UI.Button>().onClick = new UnityEngine.UI.Button.ButtonClickedEvent();
                clone_button_clonepub.GetComponentInChildren <UnityEngine.UI.Button>().onClick.AddListener(new Action(() => { social.do_clone_to_social(); }));

                clone_button_clone_favplus.gameObject.name          = $"Clone F+";
                clone_button_clone_favplus.transform.localPosition -= new Vector3(1000, 0, 0);
                clone_button_clone_favplus.GetComponentInChildren <UnityEngine.UI.Text>().text      = $"Add Fav+";
                clone_button_clone_favplus.GetComponentInChildren <UnityEngine.UI.Button>().onClick = new UnityEngine.UI.Button.ButtonClickedEvent();
                clone_button_clone_favplus.GetComponentInChildren <UnityEngine.UI.Button>().onClick.AddListener(new Action(() => { favplus.save_social_to_favplus(); }));

                clone_button_clone_msg.gameObject.name          = $"MSG invite";
                clone_button_clone_msg.transform.localPosition -= new Vector3(1250, 0, 0);
                clone_button_clone_msg.GetComponentInChildren <UnityEngine.UI.Text>().text      = $"Send msg";
                clone_button_clone_msg.GetComponentInChildren <UnityEngine.UI.Text>().fontSize -= 8;
                clone_button_clone_msg.GetComponentInChildren <UnityEngine.UI.Button>().onClick = new UnityEngine.UI.Button.ButtonClickedEvent();
                clone_button_clone_msg.GetComponentInChildren <UnityEngine.UI.Button>().onClick.AddListener(new Action(() =>
                {
                    var ff       = GameObject.Find("Screens").transform.Find("UserInfo");
                    var userInfo = ff.transform.GetComponentInChildren <VRC.UI.PageUserInfo>();
                    MelonModLogger.Log("user selected " + userInfo.displayName + " id " + userInfo.user.id);

                    if (Time.time > last_msg_apicall)
                    {
                        last_msg_apicall = Time.time + 30;
                        in_input_shit    = true;
                        menu.input_text("Enter the text to send", "A message to send to the target", new Action <string>((a) =>
                        {
                            in_input_shit = false;

                            VRCWebSocketsManager.field_Private_Static_VRCWebSocketsManager_0.field_Private_Api_0.PostOffice.Send(Invite.Create(userInfo.user.id, "", new Location("", new Transmtn.DTO.Instance("", userInfo.user.id, "", "", "", false)), a));
                        }));
                    }
                    else
                    {
                        in_input_shit = false;

                        var sec_left = last_msg_apicall - Time.time;
                        error_type_poput("Function is still on cooldown!", "Please wait " + Math.Floor(sec_left) + " seconds before trying again!");
                    }
                }));


                clone_button.transform.SetParent(screensmenu, false);
                clone_button_getasset.transform.SetParent(screensmenu, false);
                clone_button_clonepub.transform.SetParent(screensmenu, false);
                clone_button_clone_favplus.transform.SetParent(screensmenu, false);
                clone_button_clone_msg.transform.SetParent(screensmenu, false);
            }

            if (shortcutmenu != null && setup_button == false)
            {
                setup_button = true;

                main_menu_mod       = menu.make_blank_page("sub_menu");
                main_menu_page2_mod = menu.make_blank_page("sub_menu_2");
                main_menu_utils     = menu.make_blank_page("sub_menu_3");

                //menu entrance
                var menubutton = btn_utils.create_btn(false, ButtonType.Default, "Open menu", "Opens the mod menu", Color.white, Color.red, -4, 3, shortcutmenu,
                                                      new Action(() =>
                {
                    sub_menu_open = true;
                    main_menu_mod.SetActive(true);
                    shortcutmenu.gameObject.SetActive(false);
                }),
                                                      new Action(() =>
                {
                }));
                //menu-menu entrance
                var submenubutton = btn_utils.create_btn(false, ButtonType.Default, "Next page", "Next page of the mod", Color.white, Color.red, -4, 3, main_menu_mod.transform,
                                                         new Action(() =>
                {
                    sub_menu_open     = false;
                    sub_sub_menu_open = true;
                    main_menu_mod.SetActive(false);
                    main_menu_page2_mod.SetActive(true);
                    shortcutmenu.gameObject.SetActive(false);
                }),
                                                         new Action(() =>
                {
                }));

                main_menu();
                direct_menu();

                //menu 2
                slider_fov_txt = utils.make_slider(main_menu_page2_mod, delegate(float v)
                {
                    fov_cam             = v;
                    slider_fov_txt.text = "  Cam FOV (" + String.Format("{0:0.##}", v) + ")";
                }, -3, 4, "  Cam FOV (" + String.Format("{0:0.##}", fov_cam) + ")", fov_cam, 100, 60, 350);

                slider_flyspeed_txt = utils.make_slider(main_menu_page2_mod, delegate(float v)
                {
                    flying_speed             = v;
                    slider_flyspeed_txt.text = "  Fly-speed (" + String.Format("{0:0.##}", v) + ")";
                }, -1, 4, "  Fly-speed (" + String.Format("{0:0.##}", flying_speed) + ")", flying_speed, 18, 1, 350);

                slider_runspeed_txt = utils.make_slider(main_menu_page2_mod, delegate(float v)
                {
                    run_speed = v;
                    slider_runspeed_txt.text = "  Run-speed (" + String.Format("{0:0.##}", v) + ")";
                }, -3, 3, "  Run-speed (" + String.Format("{0:0.##}", run_speed) + ")", run_speed, 24, 4, 200);

                slider_walkspeed_txt = utils.make_slider(main_menu_page2_mod, delegate(float v)
                {
                    walk_speed = v;
                    slider_walkspeed_txt.text = "  Walk-speed (" + String.Format("{0:0.##}", v) + ")";
                }, -1, 3, "  Walk-speed (" + String.Format("{0:0.##}", walk_speed) + ")", walk_speed, 20, 2, 200);

                var add_by_id = btn_utils.create_btn(false, ButtonType.Default, "Add avatar to Fav+ by avatar ID", "Opens a dialog to add a avatar with just the avatar ID", Color.white, Color.red, -3, 1, main_menu_page2_mod.transform,
                                                     new Action(() =>
                {
                    menu.input_text("Enter the avatar ID (avtr_...)", "Confirm", new Action <string>((a) =>
                    {
                        if (!a.Contains("avtr_"))
                        {
                            MelonModLogger.Log("Invalid avatar id!");
                            return;
                        }

                        var model = new ApiAvatar();
                        model.id  = a;

                        model.Get(DelegateSupport.ConvertDelegate <Il2CppSystem.Action <ApiContainer> >
                                      (new Action <ApiContainer>
                                          (delegate(ApiContainer t)
                        {
                            MelonModLogger.Log("Found avatar with name:" + model.name);
                            MelonModLogger.Log("Avatar status is: " + model.releaseStatus);
                            MelonModLogger.Log("Avatar asset URL: " + model.assetUrl);
                            if (model.releaseStatus.Contains("public"))
                            {
                                //add to list
                                avatar_utils.add_to_list(model);
                                avatar_utils.update_list(avatar_config.avatar_list.Select(x => x.avatar_ident), hashmod.fav_list.listing_avatars);
                                MelonModLogger.Log("Attempted to add model to fav+");
                            }
                            else
                            {
                                MelonModLogger.Log("Avatar is private, can not add to Fav+!");
                            }
                        })));
                    }));
                }),
                                                     new Action(() =>
                {
                }));

                var rainbow_nameborder_friends = btn_utils.create_btn(rainbow_friend_nameborder, ButtonType.Toggle, "RBG friend border", "Enables a rainbow effect for friends name borders", Color.white, Color.red, -3, 0, main_menu_page2_mod.transform,
                                                                      new Action(() =>
                {
                    rainbow_friend_nameborder = true;
                }),
                                                                      new Action(() =>
                {
                    rainbow_friend_nameborder = false;
                    //and reset colors
                    var users = utils.get_all_player();
                    if (users == null)
                    {
                        return;
                    }
                    for (var i = 0; i < users.Count; i++)
                    {
                        var obj = users[i];
                        if (obj == null)
                        {
                            continue;
                        }
                        if (obj.field_Private_APIUser_0 == null)
                        {
                            continue;
                        }
                        if (utils.is_friend(obj) == false)
                        {
                            continue;
                        }
                        obj.field_Private_VRCPlayerApi_0.SetNamePlateColor(new Color(1f, 1f, 0f));
                    }
                }));
                var antishader = btn_utils.create_btn(anti_crasher_shader, ButtonType.Toggle, "Anti-shader", "Attempts to remove possibly toxic shaders", Color.white, Color.red, -2, 0, main_menu_page2_mod.transform,
                                                      new Action(() =>
                {
                    anti_crasher_shader = true;
                }),
                                                      new Action(() =>
                {
                    anti_crasher_shader = false;
                    shader_menu.reset_all();
                }));
                var antishader_fetched_list = btn_utils.create_btn(should_use_fetched_list, ButtonType.Toggle, "Anti-shader Fetched", "Will enable anti-shader to use a server hosted list of shaders as well", Color.white, Color.red, -1, 0, main_menu_page2_mod.transform,
                                                                   new Action(() =>
                {
                    should_use_fetched_list = true;
                }),
                                                                   new Action(() =>
                {
                    should_use_fetched_list = false;
                }));

                var pub_avatars_by_user_id = btn_utils.create_btn(false, ButtonType.Default, "Show public avatars by user ID", "Opens a dialog to look for the users public avatsr (Input a userid)", Color.white, Color.red, -2, 1, main_menu_page2_mod.transform,
                                                                  new Action(() =>
                {
                    if (Time.time > last_apicall)
                    {
                        last_apicall = Time.time + 60;
                        menu.input_text("Enter the User ID (usr_...)", "Confirm", new Action <string>((a) =>
                        {
                            if (!a.Contains("usr_"))
                            {
                                MelonModLogger.Log("Invalid user id!");
                                return;
                            }

                            pubavatar.update_public_user_list(a);
                            MelonModLogger.Log("Check the avatar page to see public-avats by this author!");
                            VRCUiManager.prop_VRCUiManager_0.Method_Public_Boolean_1();
                        }));
                    }
                    else
                    {
                        var sec_left = last_apicall - Time.time;
                        error_type_poput("Function is still on cooldown!", "Please wait " + Math.Floor(sec_left) + " seconds before trying again!");
                    }
                }),
                                                                  new Action(() =>
                {
                }));

                var resetdynbones = btn_utils.create_btn(false, ButtonType.Default, "Reset dynamic bone cache", "Forces dyn bones to re-apply colliders", Color.white, Color.red, -1, 1, main_menu_page2_mod.transform,
                                                         new Action(() =>
                {
                    foreach (var a in dynbones.map)
                    {
                        dynbones.remove(a.Key);
                    }
                }),
                                                         new Action(() =>
                {
                }));


                Application.targetFrameRate = max_fps;
            }
        }
Ejemplo n.º 23
0
 public static void input_text(string title, string text, System.Action <string> okaction)
 {
     VRCUiPopupManager.field_Private_Static_VRCUiPopupManager_0.Method_Public_Void_String_String_InputType_Boolean_String_Action_3_String_List_1_KeyCode_Text_Action_String_Boolean_Action_1_VRCUiPopup_5(title, "", InputField.InputType.Standard, false, text,
                                                                                                                                                                                                          DelegateSupport.ConvertDelegate <Il2CppSystem.Action <string, Il2CppSystem.Collections.Generic.List <KeyCode>, Text> >
                                                                                                                                                                                                              (new Action <string, Il2CppSystem.Collections.Generic.List <KeyCode>, Text>
                                                                                                                                                                                                                  (delegate(string s, Il2CppSystem.Collections.Generic.List <KeyCode> k, Text t)
     {
         okaction(s);
     })), null, "...", true, null);
 }
Ejemplo n.º 24
0
 static RadicalRoutineHelper()
 {
     DelegateSupport.RegisterFunctionType <RadicalRoutineHelper, string>();
     DelegateSupport.RegisterFunctionType <RadicalRoutineHelper, bool>();
     DelegateSupport.RegisterFunctionType <RadicalRoutineHelper, Transform>();
 }
Ejemplo n.º 25
0
 static VariablesToSave()
 {
     DelegateSupport.RegisterFunctionType <VariablesToSave, string>();
     DelegateSupport.RegisterFunctionType <VariablesToSave, bool>();
     DelegateSupport.RegisterFunctionType <VariablesToSave, int>();
 }
Ejemplo n.º 26
0
 static CreateChildSphere()
 {
     DelegateSupport.RegisterFunctionType <CreateChildSphere, string>();
     DelegateSupport.RegisterFunctionType <CreateChildSphere, bool>();
     DelegateSupport.RegisterFunctionType <CreateChildSphere, Transform>();
 }
Ejemplo n.º 27
0
 public static void SetPedalAction(this PedalOption pedalOption, Action action)
 {
     pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 =
         DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(action);
 }
Ejemplo n.º 28
0
        public static void AddPedalsInList(List <PedalStruct> list, ActionMenu instance)
        {
            foreach (var pedalStruct in list)
            {
                PedalOption pedalOption = instance.AddOption();
                switch (pedalStruct.Type)
                {
                case PedalType.Button:
                    pedalOption.setText(pedalStruct.text);
                    pedalOption.setIcon(pedalStruct.icon);
                    pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent);
                    break;

                case PedalType.SubMenu:
                    pedalOption.setText(pedalStruct.text);
                    pedalOption.setIcon(pedalStruct.icon);
                    pedalOption.field_Public_ActionButton_0.prop_Texture2D_2          = GetExpressionsIcons().typeFolder;
                    pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent);
                    break;

                case PedalType.RadialPuppet:
                    PedalRadial pedalRadial = (PedalRadial)pedalStruct;
                    pedalOption.setText(pedalStruct.text);
                    pedalOption.setIcon(pedalStruct.icon);
                    pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = GetExpressionsIcons().typeRadial;
                    pedalOption.field_Public_ActionButton_0.prop_String_1    = $"{Math.Round(pedalRadial.currentValue)}%";
                    pedalRadial.pedal = pedalOption;
                    pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent);
                    break;

                case PedalType.Toggle:
                    PedalToggle pedalToggle = (PedalToggle)pedalStruct;
                    pedalOption.setText(pedalStruct.text);
                    if (pedalToggle.toggled)
                    {
                        pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = GetExpressionsIcons().typeToggleOn;
                    }
                    else
                    {
                        pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = GetExpressionsIcons().typeToggleOff;
                    }
                    pedalOption.setIcon(pedalToggle.icon);
                    pedalToggle.pedal = pedalOption;
                    pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent);
                    break;

                case PedalType.FourAxisPuppet:
                    pedalOption.setText(pedalStruct.text);
                    pedalOption.setIcon(pedalStruct.icon);
                    pedalOption.field_Public_ActionButton_0.prop_Texture2D_2          = GetExpressionsIcons().typeAxis;
                    pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent);
                    break;
                }
            }
        }
Ejemplo n.º 29
0
        public override void VRChat_OnUiManagerInit()
        {
            ShowUserMethod = typeof(QuickMenu).GetMethods().Where(it => it.GetParameters().Length == 2 && it.GetParameters()[0].ParameterType.ToString() == "System.Int32" && it.GetParameters()[1].ParameterType.ToString() == "System.Boolean").First();
            GameObject pageUserInfoObj = GameObject.Find("UserInterface/MenuContent/Screens/UserInfo");

            if (pageUserInfoObj != null)
            {
                pageUserInfo = pageUserInfoObj.GetComponent <VRC.UI.PageUserInfo>();
                if (pageUserInfo != null)
                {
                    pageAvatar = Resources.FindObjectsOfTypeAll <VRC.UI.PageAvatar>().First(p => (p.transform.Find("Change Button") != null));
                    if (pageAvatar != null)
                    {
                        GameObject statspopup = GameObject.Find("UserInterface/MenuContent/Popups/AvatarStatsPopup");
                        if (statspopup != null)
                        {
                            Transform documentationbutton = statspopup.transform.Find("AvatarStatsMenu/_Buttons/DocumentationButton");
                            if (documentationbutton != null)
                            {
                                RectTransform recttrans = documentationbutton.GetComponent <RectTransform>();
                                if (recttrans != null)
                                {
                                    recttrans.sizeDelta     = new Vector2((recttrans.sizeDelta.x - 600), recttrans.sizeDelta.y);
                                    recttrans.localPosition = new Vector3((recttrans.localPosition.x - 300), recttrans.localPosition.y, recttrans.localPosition.z);
                                }

                                Transform buttontxt_trans = documentationbutton.Find("Text");
                                if (buttontxt_trans != null)
                                {
                                    Text buttontxt = buttontxt_trans.GetComponent <Text>();
                                    if (buttontxt != null)
                                    {
                                        buttontxt.fontSize -= 10;
                                    }
                                }

                                Transform buttonoverheadtxt_trans = documentationbutton.Find("Text (1)");
                                if (buttonoverheadtxt_trans != null)
                                {
                                    RectTransform recttranstxt = buttonoverheadtxt_trans.GetComponent <RectTransform>();
                                    if (recttranstxt != null)
                                    {
                                        recttranstxt.sizeDelta     = new Vector2((recttranstxt.sizeDelta.x + 600), recttranstxt.sizeDelta.y);
                                        recttranstxt.localPosition = new Vector3((recttranstxt.localPosition.x + 300), recttranstxt.localPosition.y, recttranstxt.localPosition.z);
                                    }
                                }

                                Transform showcreatorbutton_trans = DuplicateButton(documentationbutton, "Show Avatar Author", new Vector2(600, 0));
                                Button    showcreatorbutton       = showcreatorbutton_trans.GetComponent <Button>();
                                showcreatorbutton.onClick = new Button.ButtonClickedEvent();
                                showcreatorbutton.onClick.AddListener(DelegateSupport.ConvertDelegate <UnityAction>(new Action(() => {
                                    if ((pageUserInfo != null) && (pageAvatar != null) && (pageAvatar.field_Public_SimpleAvatarPedestal_0 != null))
                                    {
                                        VRC.Core.ApiAvatar currentApiAvatar = pageAvatar.field_Public_SimpleAvatarPedestal_0.field_Internal_ApiAvatar_0;
                                        if (currentApiAvatar != null)
                                        {
                                            string authorid = currentApiAvatar.authorId;
                                            if (!string.IsNullOrEmpty(authorid))
                                            {
                                                HideCurrentPopup();
                                                VRCUiManager.prop_VRCUiManager_0.Method_Public_Void_Boolean_1(true);
                                                VRC.Core.APIUser.FetchUser(authorid, new Action <VRC.Core.APIUser>((user) =>
                                                {
                                                    QuickMenu.prop_QuickMenu_0.prop_APIUser_0 = user;
                                                    ShowUserMethod.Invoke(QuickMenu.prop_QuickMenu_0, new object[] { 4, false });
                                                }), null);
                                            }
                                        }
                                    }
                                })));
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 30
0
        internal static void OnUpdate()
        {
            if (CustomAvatarFavorites.PublicAvatarList == null || CustomAvatarFavorites.FavoriteButtonNew == null || RoomManager.field_Internal_Static_ApiWorld_0 == null)
            {
                return;
            }
            if (CustomAvatarFavorites.searchBox == null && CustomAvatarFavorites.NewAvatarList.gameObject.activeInHierarchy)
            {
                VRCUiPageHeader componentInChildren = QuickMenuUtils.GetVRCUiMInstance().GetComponentInChildren <VRCUiPageHeader>(true);
                if (componentInChildren != null)
                {
                    CustomAvatarFavorites.searchBox = componentInChildren.field_Public_UiInputField_0;
                }
            }
            if (CustomAvatarFavorites.searchBoxAction == null)
            {
                CustomAvatarFavorites.searchBoxAction = DelegateSupport.ConvertDelegate <UnityAction <string> >(new Action <string>(delegate(string searchTerm)
                {
                    if (searchTerm == "" || searchTerm.Length < 2)
                    {
                        return;
                    }

                    MelonCoroutines.Start(CustomAvatarFavorites.SearchAvatars(searchTerm));
                }));
            }
            if (CustomAvatarFavorites.searchBox != null && CustomAvatarFavorites.searchBox.field_Public_Button_0 != null && !CustomAvatarFavorites.searchBox.field_Public_Button_0.interactable && CustomAvatarFavorites.PublicAvatarList.activeInHierarchy && BetterEmmVRC.BetterEmmVRC.NetworkLib.authToken != null && RoomManager.field_Internal_Static_ApiWorld_0 != null)
            {
                CustomAvatarFavorites.searchBox.field_Public_Button_0.interactable  = true;
                CustomAvatarFavorites.searchBox.field_Public_UnityAction_1_String_0 = CustomAvatarFavorites.searchBoxAction;
            }
            if (CustomAvatarFavorites.PublicAvatarList.activeSelf && BetterEmmVRC.BetterEmmVRC.NetworkLib.authToken != null)
            {
                CustomAvatarFavorites.NewAvatarList.collapsedCount = 500;
                CustomAvatarFavorites.NewAvatarList.expandedCount  = 500;
                if (!CustomAvatarFavorites.menuJustActivated)
                {
                    CustomAvatarFavorites.Searching       = false;
                    CustomAvatarFavorites.avTextText.text = "(" + CustomAvatarFavorites.LoadedAvatars.Count.ToString() + ") BetterEmmVRC Favorites";
                    MelonCoroutines.Start(CustomAvatarFavorites.RefreshMenu(1f));
                    CustomAvatarFavorites.menuJustActivated = true;
                }
                if (CustomAvatarFavorites.menuJustActivated && (CustomAvatarFavorites.NewAvatarList.pickers.Count < CustomAvatarFavorites.LoadedAvatars.Count || CustomAvatarFavorites.NewAvatarList.isOffScreen))
                {
                    CustomAvatarFavorites.menuJustActivated = false;
                }
                if (CustomAvatarFavorites.currPageAvatar != null && CustomAvatarFavorites.currPageAvatar.field_Public_SimpleAvatarPedestal_0 != null && CustomAvatarFavorites.currPageAvatar.field_Public_SimpleAvatarPedestal_0.field_Internal_ApiAvatar_0 != null && CustomAvatarFavorites.LoadedAvatars != null && CustomAvatarFavorites.FavoriteButtonNew != null)
                {
                    bool flag = false;
                    for (int i = 0; i < CustomAvatarFavorites.LoadedAvatars.Count; i++)
                    {
                        if (CustomAvatarFavorites.LoadedAvatars[i].id == CustomAvatarFavorites.currPageAvatar.field_Public_SimpleAvatarPedestal_0.field_Internal_ApiAvatar_0.id)
                        {
                            flag = true;
                        }
                    }
                    if (!flag)
                    {
                        CustomAvatarFavorites.FavoriteButtonNewText.text = "<color=#FF69B4>emmVRC</color> Favorite";
                    }
                    else
                    {
                        CustomAvatarFavorites.FavoriteButtonNewText.text = "<color=#FF69B4>emmVRC</color> Unfavorite";
                    }
                }
            }
            if ((BetterEmmVRC.BetterEmmVRC.NetworkLib.authToken == null) && (CustomAvatarFavorites.PublicAvatarList.activeSelf || CustomAvatarFavorites.FavoriteButtonNew.activeSelf))
            {
                CustomAvatarFavorites.PublicAvatarList.SetActive(false);
                CustomAvatarFavorites.FavoriteButtonNew.SetActive(false);
            }
            else if ((!CustomAvatarFavorites.PublicAvatarList.activeSelf || !CustomAvatarFavorites.FavoriteButtonNew.activeSelf) && BetterEmmVRC.BetterEmmVRC.NetworkLib.authToken != null)
            {
                CustomAvatarFavorites.PublicAvatarList.SetActive(true);
                CustomAvatarFavorites.FavoriteButtonNew.SetActive(true);
            }
            if (CustomAvatarFavorites.error && !CustomAvatarFavorites.errorWarned)
            {
                CustomAvatarFavorites.errorWarned = true;
            }
        }