can turn on and off much better
now i can ACTUALLY get the delay working
This commit is contained in:
parent
024684c1fd
commit
32eed3d283
|
@ -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 == 2) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,9 +56,9 @@ namespace HeavenStudio.Editor
|
|||
rectTransform.anchoredPosition = anchoredPosition / scale;
|
||||
}
|
||||
|
||||
public static void OnEnter(string tooltipText, string altTooltipText)
|
||||
public static void OnEnter(string tooltipText, string altTooltipText, int type)
|
||||
{
|
||||
instance.OnEnterPrivate(tooltipText, altTooltipText);
|
||||
instance.OnEnterPrivate(tooltipText, altTooltipText, type);
|
||||
}
|
||||
|
||||
public static void OnExit()
|
||||
|
@ -68,19 +68,42 @@ namespace HeavenStudio.Editor
|
|||
Editor.instance.tooltipText.ForceMeshUpdate();
|
||||
}
|
||||
|
||||
private void OnEnterPrivate(string tooltipText, string altTooltipText)
|
||||
private void OnEnterPrivate(string tooltipText, string altTooltipText, int type)
|
||||
{
|
||||
group.alpha = 1;
|
||||
Vector2 textSize;
|
||||
Vector2 paddingSize;
|
||||
|
||||
text.text = tooltipText;
|
||||
text.ForceMeshUpdate();
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
group.alpha = 0;
|
||||
|
||||
Vector2 textSize = text.GetRenderedValues(false);
|
||||
Vector2 paddingSize = new Vector2(8, 8);
|
||||
text.text = tooltipText;
|
||||
text.ForceMeshUpdate();
|
||||
|
||||
background.sizeDelta = textSize + paddingSize;
|
||||
Editor.instance.tooltipText.text = altTooltipText.Replace("\n", "");
|
||||
Editor.instance.tooltipText.ForceMeshUpdate();
|
||||
textSize = text.GetRenderedValues(false);
|
||||
paddingSize = new Vector2(8, 8);
|
||||
|
||||
background.sizeDelta = textSize + paddingSize;
|
||||
Editor.instance.tooltipText.text = altTooltipText.Replace("\n", "");
|
||||
Editor.instance.tooltipText.ForceMeshUpdate();
|
||||
return;
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
group.alpha = 1;
|
||||
|
||||
text.text = tooltipText;
|
||||
text.ForceMeshUpdate();
|
||||
|
||||
textSize = text.GetRenderedValues(false);
|
||||
paddingSize = new Vector2(8, 8);
|
||||
|
||||
background.sizeDelta = textSize + paddingSize;
|
||||
Editor.instance.tooltipText.text = altTooltipText.Replace("\n", "");
|
||||
Editor.instance.tooltipText.ForceMeshUpdate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnExitPrivate()
|
||||
|
@ -99,15 +122,16 @@ namespace HeavenStudio.Editor
|
|||
background.sizeDelta = textSize + paddingSize;
|
||||
}
|
||||
|
||||
public static void AddTooltip(GameObject g, string tooltipText, string altTooltipText = null)
|
||||
public static void AddTooltip(GameObject g, string tooltipText, string altTooltipText = null, int type = 2)
|
||||
{
|
||||
// tooltip types: 0 = only corner, 1 = delayed on mouse, 2 = instant on mouse
|
||||
altTooltipText ??= tooltipText;
|
||||
|
||||
EventTrigger et = g.AddComponent<EventTrigger>();
|
||||
|
||||
EventTrigger.Entry pointerEnter = new EventTrigger.Entry();
|
||||
pointerEnter.eventID = EventTriggerType.PointerEnter;
|
||||
pointerEnter.callback.AddListener((data) => { OnEnter(tooltipText, altTooltipText); });
|
||||
pointerEnter.callback.AddListener((data) => { OnEnter(tooltipText, altTooltipText, type); });
|
||||
|
||||
EventTrigger.Entry pointerExit = new EventTrigger.Entry();
|
||||
pointerExit.eventID = EventTriggerType.PointerExit;
|
||||
|
|
|
@ -61,8 +61,8 @@ namespace HeavenStudio.Editor
|
|||
|
||||
public void OnParamTooltipsChanged()
|
||||
{
|
||||
// tooltip types: 0 = only corner, 1 = delayed on mouse, 2 = instant on mouse
|
||||
PersistentDataManager.gameSettings.showParamTooltips = paramTooltipsDropdown.value;
|
||||
// Debug.Log(paramTooltipsDropdown.value);
|
||||
}
|
||||
|
||||
public void OnPreviewNoteSoundsChanged()
|
||||
|
|
Loading…
Reference in a new issue