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;
|
public bool active;
|
||||||
|
|
||||||
private int childCountAtStart;
|
private int childCountAtStart;
|
||||||
|
|
||||||
public Dictionary<string, EventPropertyPrefab> currentProperties = new();
|
public Dictionary<string, EventPropertyPrefab> currentProperties = new();
|
||||||
|
|
||||||
public bool canDisable = true;
|
public bool canDisable = true;
|
||||||
|
@ -43,7 +43,8 @@ namespace HeavenStudio.Editor
|
||||||
{
|
{
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
||||||
if (PropertyPrefabs == null) {
|
if (PropertyPrefabs == null)
|
||||||
|
{
|
||||||
PropertyPrefabs = new() {
|
PropertyPrefabs = new() {
|
||||||
{ typeof(Integer), IntegerP },
|
{ typeof(Integer), IntegerP },
|
||||||
{ typeof(Float), FloatP },
|
{ typeof(Float), FloatP },
|
||||||
|
@ -131,11 +132,11 @@ namespace HeavenStudio.Editor
|
||||||
}
|
}
|
||||||
input.SetCollapses(p.parameter);
|
input.SetCollapses(p.parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var p in action.parameters)
|
foreach (var p in action.parameters)
|
||||||
{
|
{
|
||||||
EventPropertyPrefab prop = currentProperties[p.propertyName];
|
EventPropertyPrefab prop = currentProperties[p.propertyName];
|
||||||
|
|
||||||
prop.PostLoadProperties(p.parameter);
|
prop.PostLoadProperties(p.parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +152,8 @@ namespace HeavenStudio.Editor
|
||||||
{
|
{
|
||||||
Type typeType = type.GetType();
|
Type typeType = type.GetType();
|
||||||
GameObject propertyPrefab = DropdownP; // enum check is hardcoded because enums are awesome (lying)
|
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);
|
Debug.LogError("Can't make property interface of type: " + typeType);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -160,14 +162,12 @@ namespace HeavenStudio.Editor
|
||||||
input.SetActive(true);
|
input.SetActive(true);
|
||||||
input.transform.localScale = Vector3.one;
|
input.transform.localScale = Vector3.one;
|
||||||
|
|
||||||
if (tooltip != string.Empty) {
|
if (tooltip != string.Empty)
|
||||||
if (PersistentDataManager.gameSettings.showParamTooltips == 2) {
|
{
|
||||||
Tooltip.AddTooltip(input, tooltip);
|
Tooltip.AddTooltip(input, tooltip, null, PersistentDataManager.gameSettings.showParamTooltips);
|
||||||
} else {
|
|
||||||
Tooltip.AddTooltip(input, "", tooltip);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EventPropertyPrefab property = input.GetComponent<EventPropertyPrefab>();
|
EventPropertyPrefab property = input.GetComponent<EventPropertyPrefab>();
|
||||||
property.SetProperties(propertyName, type, caption);
|
property.SetProperties(propertyName, type, caption);
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ namespace HeavenStudio.Editor
|
||||||
{
|
{
|
||||||
Destroy(transform.GetChild(i).gameObject);
|
Destroy(transform.GetChild(i).gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
currentProperties.Clear();
|
currentProperties.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,9 +56,9 @@ namespace HeavenStudio.Editor
|
||||||
rectTransform.anchoredPosition = anchoredPosition / scale;
|
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()
|
public static void OnExit()
|
||||||
|
@ -68,19 +68,42 @@ namespace HeavenStudio.Editor
|
||||||
Editor.instance.tooltipText.ForceMeshUpdate();
|
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;
|
switch (type)
|
||||||
text.ForceMeshUpdate();
|
{
|
||||||
|
case 0:
|
||||||
|
group.alpha = 0;
|
||||||
|
|
||||||
Vector2 textSize = text.GetRenderedValues(false);
|
text.text = tooltipText;
|
||||||
Vector2 paddingSize = new Vector2(8, 8);
|
text.ForceMeshUpdate();
|
||||||
|
|
||||||
background.sizeDelta = textSize + paddingSize;
|
textSize = text.GetRenderedValues(false);
|
||||||
Editor.instance.tooltipText.text = altTooltipText.Replace("\n", "");
|
paddingSize = new Vector2(8, 8);
|
||||||
Editor.instance.tooltipText.ForceMeshUpdate();
|
|
||||||
|
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()
|
private void OnExitPrivate()
|
||||||
|
@ -99,15 +122,16 @@ namespace HeavenStudio.Editor
|
||||||
background.sizeDelta = textSize + paddingSize;
|
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;
|
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, altTooltipText); });
|
pointerEnter.callback.AddListener((data) => { OnEnter(tooltipText, altTooltipText, type); });
|
||||||
|
|
||||||
EventTrigger.Entry pointerExit = new EventTrigger.Entry();
|
EventTrigger.Entry pointerExit = new EventTrigger.Entry();
|
||||||
pointerExit.eventID = EventTriggerType.PointerExit;
|
pointerExit.eventID = EventTriggerType.PointerExit;
|
||||||
|
|
|
@ -61,8 +61,8 @@ namespace HeavenStudio.Editor
|
||||||
|
|
||||||
public void OnParamTooltipsChanged()
|
public void OnParamTooltipsChanged()
|
||||||
{
|
{
|
||||||
|
// tooltip types: 0 = only corner, 1 = delayed on mouse, 2 = instant on mouse
|
||||||
PersistentDataManager.gameSettings.showParamTooltips = paramTooltipsDropdown.value;
|
PersistentDataManager.gameSettings.showParamTooltips = paramTooltipsDropdown.value;
|
||||||
// Debug.Log(paramTooltipsDropdown.value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnPreviewNoteSoundsChanged()
|
public void OnPreviewNoteSoundsChanged()
|
||||||
|
|
Loading…
Reference in a new issue