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

Commit

Permalink
Ignore buttons with empty text.
Browse files Browse the repository at this point in the history
  • Loading branch information
RequiDev committed Aug 21, 2021
1 parent 7cfb1ff commit 104e7c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions ReModCE/Components/ButtonAdjustmentsComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,16 @@ public override void OnUiManagerInit(UiManager uiManager)
var name = button.name;
if (name == "DevToolsButton") continue;

var text = button.gameObject.GetComponentsInDirectChildren<Text>();
if (text == null || text.Length == 0)
var texts = button.gameObject.GetComponentsInDirectChildren<Text>();
if (texts == null || texts.Length == 0)
{
continue;
}

CreateUiForButton(button.gameObject, text[0].text);
var text = texts[0];
if (text.text.Length == 0)
return;
CreateUiForButton(button.gameObject, text.text);
}

CreateUiForButton(ExtendedQuickMenu.UserIconCameraButton.gameObject, "Camera Icon Button", size: false);
Expand Down
2 changes: 1 addition & 1 deletion ReModCE/UI/ReQuickButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public bool Interactable

public ReQuickButton(Vector2 pos, string text, string tooltip, Action onClick, Transform parent = null) : base(ExtendedQuickMenu.ReportWorldButton.gameObject, parent, pos, $"{text}Button")
{
Object.DestroyImmediate(GameObject.GetComponentsInChildren<Image>(true).First(a => a.transform != GameObject.transform));
Object.DestroyImmediate(RectTransform.Find("CLIcon"));

_textComponent = GameObject.GetComponentInChildren<Text>();
_textComponent.resizeTextForBestFit = true;
Expand Down

0 comments on commit 104e7c7

Please sign in to comment.