Delayed Property Tooltips (#886)

* add dropdown

yes im really making a pr for something as tiny as this

* can now turn on/off

now for the hard part

* can turn on and off much better

now i can ACTUALLY get the delay working

* it works!!!

currently waits for 400 frames regardless of fps, should probably be changed in the future but it works well enough rn

* Timer waits 1.5 seconds

much better, thanks astrl
This commit is contained in:
Zeo
2024-04-21 16:39:19 -05:00
committed by minenice55
parent 701608cf25
commit 47fb4911e5
9 changed files with 1645 additions and 265 deletions

View File

@ -32,7 +32,7 @@ namespace HeavenStudio.Editor
public bool active;
private int childCountAtStart;
public Dictionary<string, EventPropertyPrefab> currentProperties = new();
public bool canDisable = true;
@ -43,7 +43,8 @@ namespace HeavenStudio.Editor
{
instance = this;
if (PropertyPrefabs == null) {
if (PropertyPrefabs == null)
{
PropertyPrefabs = new() {
{ typeof(Integer), IntegerP },
{ typeof(Float), FloatP },
@ -131,11 +132,11 @@ namespace HeavenStudio.Editor
}
input.SetCollapses(p.parameter);
}
foreach (var p in action.parameters)
{
EventPropertyPrefab prop = currentProperties[p.propertyName];
prop.PostLoadProperties(p.parameter);
}
@ -151,7 +152,8 @@ namespace HeavenStudio.Editor
{
Type typeType = type.GetType();
GameObject propertyPrefab = DropdownP; // enum check is hardcoded because enums are awesome (lying)
if (!typeType.IsEnum && !PropertyPrefabs.TryGetValue(typeType, out propertyPrefab)) {
if (!typeType.IsEnum && !PropertyPrefabs.TryGetValue(typeType, out propertyPrefab))
{
Debug.LogError("Can't make property interface of type: " + typeType);
return null;
}
@ -160,14 +162,12 @@ namespace HeavenStudio.Editor
input.SetActive(true);
input.transform.localScale = Vector3.one;
if (tooltip != string.Empty) {
if (PersistentDataManager.gameSettings.showParamTooltips) {
Tooltip.AddTooltip(input, tooltip);
} else {
Tooltip.AddTooltip(input, "", tooltip);
}
if (tooltip != string.Empty)
{
Tooltip.AddTooltip(input, tooltip, null, PersistentDataManager.gameSettings.showParamTooltips);
}
EventPropertyPrefab property = input.GetComponent<EventPropertyPrefab>();
property.SetProperties(propertyName, type, caption);
@ -182,7 +182,7 @@ namespace HeavenStudio.Editor
{
Destroy(transform.GetChild(i).gameObject);
}
currentProperties.Clear();
}
}