Certain UI elements that are supposed to hide if a feature is disabled are properly refreshed at the beginning

Setup hover UI functionality
This commit is contained in:
LadyAliceMargatroid 2024-08-26 20:08:43 -07:00
parent e9c8da9c51
commit e143d2ad3d
7 changed files with 204 additions and 2 deletions

View file

@ -1,4 +1,5 @@
using DunGenPlus.DevTools.UIElements.Collections;
using DunGenPlus.DevTools.HoverUI;
using DunGenPlus.DevTools.UIElements.Collections;
using System;
using System.Collections.Generic;
using System.Linq;
@ -20,6 +21,7 @@ namespace DunGenPlus.DevTools.UIElements {
public void SetupBase(TitleParameter titleParameter) {
title = titleParameter.text;
SetText(title);
SetHoverText(titleParameter.hoverText);
layoutOffset = titleParameter.offset;
if (layoutElement) {
@ -32,6 +34,12 @@ namespace DunGenPlus.DevTools.UIElements {
titleTextMesh.text = value;
}
public void SetHoverText(string value){
var hoverChild = GetComponentInChildren<HoverUIChild>();
if (hoverChild) {
hoverChild.hoverText = value;
}
}
}
}

View file

@ -8,10 +8,18 @@ namespace DunGenPlus.DevTools.UIElements.Collections {
internal struct TitleParameter {
public string text;
public float offset;
public string hoverText;
public TitleParameter(string text, float offset = 0f) {
this.text = text;
this.offset = offset;
this.hoverText = null;
}
public TitleParameter(string text, string hoverText, float offset = 0f){
this.text = text;
this.offset = offset;
this.hoverText = hoverText;
}
public static implicit operator TitleParameter(string text) => new TitleParameter(text);