Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Commit

Permalink
Wait 1 frame before moving/disabling/resizing buttons.
Browse files Browse the repository at this point in the history
  • Loading branch information
RequiDev committed Sep 22, 2021
1 parent dd1c092 commit 691911b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ReModCE/Components/ButtonAdjustmentsComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

namespace ReModCE.Components
{
// We want this to run last.
[ComponentPriority(int.MaxValue)]
internal class ButtonAdjustmentsComponent : ModComponent
{
private Button.ButtonClickedEvent _originalButtonClickedEvent;
Expand All @@ -36,6 +34,13 @@ public override void OnUiManagerInit(UiManager uiManager)
_disablerMenu = menu.AddSubMenu("Disabler", "Disable VRChat buttons in your Quick Menu");
_moverMenu = menu.AddSubMenu("Mover", "Move buttons around in your Qick Menu");
_sizerMenu = menu.AddSubMenu("Sizer", "Make any button half size if needed");
}

private IEnumerator RunDelayed()
{
// wait 1 frame so other mods are initialized and won't copy a resized/moved button
yield return new WaitForEndOfFrame();

var shortcutMenu = ExtendedQuickMenu.ShortcutMenu;
var childrenButtons = shortcutMenu.gameObject.GetComponentsInDirectChildren<Button>();
foreach (var button in childrenButtons)
Expand All @@ -53,11 +58,11 @@ public override void OnUiManagerInit(UiManager uiManager)
var text = texts[0];
if (text.text.Length == 0)
continue;

CreateUiForButton(button.gameObject, text.text);
}

CreateUiForButton(ExtendedQuickMenu.UserIconCameraButton.gameObject, "Camera Icon Button", disable:false, size: false); //
CreateUiForButton(ExtendedQuickMenu.UserIconCameraButton.gameObject, "Camera Icon Button", disable: false, size: false); //
CreateUiForButton(ExtendedQuickMenu.VRCPlusPet.gameObject, "VRC+ Pet", false, disable: false, size: false);
}

Expand Down

0 comments on commit 691911b

Please sign in to comment.