Bottom right tooltip now matches hover tooltip if there is one

This commit is contained in:
Carson Kompon 2022-03-01 16:11:19 -05:00
parent 55f31b4501
commit 6a43469056
4 changed files with 19 additions and 6 deletions

View file

@ -14592,6 +14592,7 @@ MonoBehaviour:
EditorThemeBTN: {fileID: 528192061} EditorThemeBTN: {fileID: 528192061}
FullScreenBTN: {fileID: 151246938} FullScreenBTN: {fileID: 151246938}
TempoFinderBTN: {fileID: 1478799966} TempoFinderBTN: {fileID: 1478799966}
tooltipText: {fileID: 1196204504}
discordDuringTesting: 0 discordDuringTesting: 0
canSelect: 1 canSelect: 1
--- !u!114 &1423699438 --- !u!114 &1423699438

View file

@ -50,6 +50,9 @@ namespace RhythmHeavenMania.Editor
[SerializeField] private Button FullScreenBTN; [SerializeField] private Button FullScreenBTN;
[SerializeField] private Button TempoFinderBTN; [SerializeField] private Button TempoFinderBTN;
[Header("Tooltip")]
public TMP_Text tooltipText;
[Header("Properties")] [Header("Properties")]
private bool changedMusic = false; private bool changedMusic = false;
private bool loadedMusic = false; private bool loadedMusic = false;

View file

@ -50,20 +50,24 @@ namespace RhythmHeavenMania.Editor
rectTransform.anchoredPosition = anchoredPosition; rectTransform.anchoredPosition = anchoredPosition;
} }
public static void OnEnter(string tooltipText) public static void OnEnter(string tooltipText, string altTooltipText)
{ {
instance.OnEnterPrivate(tooltipText); instance.OnEnterPrivate(tooltipText, altTooltipText);
} }
public static void OnExit() public static void OnExit()
{ {
instance.OnExitPrivate(); instance.OnExitPrivate();
Editor.instance.tooltipText.text = "";
Editor.instance.tooltipText.ForceMeshUpdate();
} }
private void OnEnterPrivate(string tooltipText) private void OnEnterPrivate(string tooltipText, string altTooltipText)
{ {
group.alpha = 1; group.alpha = 1;
SetText(tooltipText); SetText(tooltipText);
Editor.instance.tooltipText.text = altTooltipText.Replace("\n","");
Editor.instance.tooltipText.ForceMeshUpdate();
} }
private void OnExitPrivate() private void OnExitPrivate()
@ -82,13 +86,16 @@ namespace RhythmHeavenMania.Editor
background.sizeDelta = textSize + paddingSize; background.sizeDelta = textSize + paddingSize;
} }
public static void AddTooltip(GameObject g, string tooltipText) public static void AddTooltip(GameObject g, string tooltipText, string altTooltipText = "")
{ {
if (altTooltipText == "")
altTooltipText = tooltipText;
EventTrigger et = g.AddComponent<EventTrigger>(); EventTrigger et = g.AddComponent<EventTrigger>();
EventTrigger.Entry pointerEnter = new EventTrigger.Entry(); EventTrigger.Entry pointerEnter = new EventTrigger.Entry();
pointerEnter.eventID = EventTriggerType.PointerEnter; pointerEnter.eventID = EventTriggerType.PointerEnter;
pointerEnter.callback.AddListener((data) => { OnEnter(tooltipText); }); pointerEnter.callback.AddListener((data) => { OnEnter(tooltipText, altTooltipText); });
EventTrigger.Entry pointerExit = new EventTrigger.Entry(); EventTrigger.Entry pointerExit = new EventTrigger.Entry();
pointerExit.eventID = EventTriggerType.PointerExit; pointerExit.eventID = EventTriggerType.PointerExit;

View file

@ -72,12 +72,14 @@ namespace RhythmHeavenMania
public string propertyName; public string propertyName;
public object parameter; public object parameter;
public string propertyCaption; public string propertyCaption;
public string tooltip;
public Param(string propertyName, object parameter, string propertyCaption) public Param(string propertyName, object parameter, string propertyCaption, string tooltip = "")
{ {
this.propertyName = propertyName; this.propertyName = propertyName;
this.parameter = parameter; this.parameter = parameter;
this.propertyCaption = propertyCaption; this.propertyCaption = propertyCaption;
this.tooltip = tooltip;
} }
} }