Skip to content
This repository was archived by the owner on Jan 24, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions UI/QuickMenu/ReMenuButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ public string Text
get => _text.text;
set => _text.SetText(value);
}

private VRC.UI.Elements.Tooltips.UiTooltip _tooltip;

public string Tooltip {
get => _tooltip != null ? _tooltip.field_Public_String_0 : "";
set
{
if (_tooltip == null) return;
_tooltip.field_Public_String_0 = value;
_tooltip.field_Public_String_1 = value;
}
}

private readonly StyleElement _styleElement;
private readonly Button _button;
Expand Down Expand Up @@ -99,20 +111,19 @@ public ReMenuButton(string text, string tooltip, Action onClick, Transform paren
Object.DestroyImmediate(RectTransform.Find("Badge_MMJump").gameObject);

var uiTooltips = GameObject.GetComponents<VRC.UI.Elements.Tooltips.UiTooltip>();
VRC.UI.Elements.Tooltips.UiTooltip uiTooltip = null;
if (uiTooltips.Length > 0)
{
//Fuck tooltips, all my friends hate tooltips
uiTooltip = uiTooltips[0];
_tooltip = uiTooltips[0];

for(int i=1; i<uiTooltips.Length; i++)
for(int i = 1; i < uiTooltips.Length; i++)
Object.DestroyImmediate(uiTooltips[i]);
}

if (uiTooltip != null)
if (_tooltip != null)
{
uiTooltip.field_Public_String_0 = tooltip;
uiTooltip.field_Public_String_1 = tooltip;
_tooltip.field_Public_String_0 = tooltip;
_tooltip.field_Public_String_1 = tooltip;
}

if (onClick != null)
Expand Down
18 changes: 15 additions & 3 deletions UI/QuickMenu/ReMenuSlider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ namespace ReMod.Core.UI.QuickMenu
public class ReMenuSlider : UiElement
{
private readonly Slider _sliderComponent;

private VRC.UI.Elements.Tooltips.UiTooltip _tooltip;

public string Tooltip {
get => _tooltip != null ? _tooltip.field_Public_String_0 : "";
set
{
if (_tooltip == null) return;
_tooltip.field_Public_String_0 = value;
_tooltip.field_Public_String_1 = value;
}
}

public ReMenuSlider(string text, string tooltip, Action<float> onSlide, Transform parent, float defaultValue = 0, float minValue = 0, float maxValue = 10) : base(QuickMenuEx.SliderPrefab, parent, $"Slider_{text}")
{
Expand All @@ -35,9 +47,9 @@ public ReMenuSlider(string text, string tooltip, Action<float> onSlide, Transfor
_sliderComponent.maxValue = maxValue;
_sliderComponent.value = defaultValue;

var uiTooltip = GameObject.GetComponent<VRC.UI.Elements.Tooltips.UiTooltip>();
uiTooltip.field_Public_String_0 = tooltip;
uiTooltip.field_Public_String_1 = tooltip;
_tooltip = GameObject.GetComponent<VRC.UI.Elements.Tooltips.UiTooltip>();
_tooltip.field_Public_String_0 = tooltip;
_tooltip.field_Public_String_1 = tooltip;

Slide(defaultValue,false);

Expand Down
18 changes: 15 additions & 3 deletions UI/QuickMenu/ReMenuToggle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ public string Text
get => _textComponent.text;
set => _textComponent.text = value;
}

private VRC.UI.Elements.Tooltips.UiToggleTooltip _tooltip;

public string Tooltip {
get => _tooltip != null ? _tooltip.field_Public_String_0 : "";
set
{
if (_tooltip == null) return;
_tooltip.field_Public_String_0 = value;
_tooltip.field_Public_String_1 = value;
}
}

public ReMenuToggle(string text, string tooltip, Action<bool> onToggle, Transform parent, bool defaultValue = false) : base(QuickMenuEx.TogglePrefab, parent, $"Button_Toggle{text}")
{
Expand All @@ -67,9 +79,9 @@ public ReMenuToggle(string text, string tooltip, Action<bool> onToggle, Transfor
_textComponent.m_fontColor = new Color(0.4157f, 0.8902f, 0.9765f, 1f);
_textComponent.m_htmlColor = new Color(0.4157f, 0.8902f, 0.9765f, 1f);

var uiTooltip = GameObject.GetComponent<VRC.UI.Elements.Tooltips.UiToggleTooltip>();
uiTooltip.field_Public_String_0 = tooltip;
uiTooltip.field_Public_String_1 = tooltip;
_tooltip = GameObject.GetComponent<VRC.UI.Elements.Tooltips.UiToggleTooltip>();
_tooltip.field_Public_String_0 = tooltip;
_tooltip.field_Public_String_1 = tooltip;

Toggle(defaultValue,false);

Expand Down