mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-29 21:13:07 +00:00
e08ce8f0b0
* additive angle in rhythm rally * remove old keyboard controller compat * fix control style dropdowns * using mouse on title screen selects keyboard instead default to keyboard for invalid controllers * temporarily ditch discord RPC we need a new API key lol * remove this discord call too * certain editor shortcuts now exit fullscreen fix color hex input not locking editor shortcuts * increase max queued frames turns out this may not be an issue for audio rhythm games
44 lines
No EOL
1.4 KiB
C#
44 lines
No EOL
1.4 KiB
C#
using UnityEngine;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using TMPro;
|
|
|
|
namespace HeavenStudio.Editor
|
|
{
|
|
public class EnumChartPropertyPrefab : RemixPropertyPrefab
|
|
{
|
|
[Header("Dropdown")]
|
|
[Space(10)]
|
|
public TMP_Dropdown dropdown;
|
|
|
|
new public void SetProperties(RemixPropertiesDialog diag, string propertyName, object type, string caption)
|
|
{
|
|
InitProperties(diag, propertyName, caption);
|
|
|
|
Type enumType = type.GetType();
|
|
Array enumVals = Enum.GetValues(enumType);
|
|
List<string> enumNames = Enum.GetNames(enumType).ToList();
|
|
|
|
// Can we assume non-holey enum?
|
|
// If we can we can simplify to dropdown.value = (int) parameterManager.chart[propertyName]
|
|
var currentlySelected = (int) parameterManager.chart[propertyName];
|
|
var selected = enumVals
|
|
.Cast<object>()
|
|
.ToList()
|
|
.FindIndex(val => (int) val == currentlySelected);
|
|
|
|
dropdown.AddOptions(enumNames);
|
|
dropdown.value = selected;
|
|
|
|
dropdown.onValueChanged.AddListener(_ =>
|
|
parameterManager.chart[propertyName] = Enum.ToObject(enumType, (int) enumVals.GetValue(dropdown.value))
|
|
);
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
}
|
|
}
|
|
} |