Spaceball camera easings

This commit is contained in:
Braedon
2022-02-04 17:16:22 -05:00
parent b55a6dcabc
commit 686a8942f5
9 changed files with 2597 additions and 38 deletions

View File

@ -14,6 +14,7 @@ namespace RhythmHeavenMania.Editor
[Header("Property Prefabs")]
[SerializeField] private GameObject IntegerP;
[SerializeField] private GameObject DropdownP;
public Beatmap.Entity entity;
@ -88,6 +89,10 @@ namespace RhythmHeavenMania.Editor
{
prefab = IntegerP;
}
else if (type.GetType() == typeof(RhythmHeavenMania.Util.EasingFunction.Ease))
{
prefab = DropdownP;
}
GameObject input = Instantiate(prefab);
input.transform.SetParent(this.gameObject.transform);
@ -101,7 +106,7 @@ namespace RhythmHeavenMania.Editor
private void DestroyParams()
{
active = false;
for (int i = 1; i < transform.childCount; i++)
for (int i = 2; i < transform.childCount; i++)
{
Destroy(transform.GetChild(i).gameObject);
}

View File

@ -5,39 +5,68 @@ using UnityEngine.UI;
using TMPro;
using RhythmHeavenMania.Util;
namespace RhythmHeavenMania.Editor
{
public class EventPropertyPrefab : MonoBehaviour
{
public TMP_Text caption;
[SerializeField] private EventParameterManager parameterManager;
[Header("Integer and Float")]
[Space(10)]
public Slider slider;
public TMP_InputField inputField;
[Header("Dropdown")]
[Space(10)]
public TMP_Dropdown dropdown;
private string propertyName;
[SerializeField] private EventParameterManager parameterManager;
public void SetProperties(string propertyName, object type, string caption)
{
this.propertyName = propertyName;
this.caption.text = caption;
var integer = ((EntityTypes.Integer)type);
if (type.GetType() == typeof(EntityTypes.Integer))
{
var integer = ((EntityTypes.Integer)type);
slider.minValue = integer.min;
slider.maxValue = integer.max;
slider.minValue = integer.min;
slider.maxValue = integer.max;
slider.value = Mathf.RoundToInt(System.Convert.ToSingle(parameterManager.entity[propertyName]));
inputField.text = slider.value.ToString();
slider.value = Mathf.RoundToInt(System.Convert.ToSingle(parameterManager.entity[propertyName]));
inputField.text = slider.value.ToString();
slider.onValueChanged.AddListener(delegate { TestChange(); });
}
slider.onValueChanged.AddListener(delegate
{
inputField.text = slider.value.ToString();
parameterManager.entity[propertyName] = (int)slider.value;
});
}
else if (type.GetType() == typeof(EasingFunction.Ease))
{
List<TMP_Dropdown.OptionData> dropDownData = new List<TMP_Dropdown.OptionData>();
for (int i = 0; i < System.Enum.GetValues(typeof(EasingFunction.Ease)).Length; i++)
{
string name = System.Enum.GetNames(typeof(EasingFunction.Ease))[i];
TMP_Dropdown.OptionData optionData = new TMP_Dropdown.OptionData();
public void TestChange()
{
print("bru");
inputField.text = slider.value.ToString();
parameterManager.entity[propertyName] = (int)slider.value;
optionData.text = name;
dropDownData.Add(optionData);
}
dropdown.AddOptions(dropDownData);
dropdown.value = ((int)(EasingFunction.Ease)parameterManager.entity[propertyName]);
dropdown.onValueChanged.AddListener(delegate
{
parameterManager.entity[propertyName] = (EasingFunction.Ease)dropdown.value;
});
}
}
}
}