您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
34 行
996 B
34 行
996 B
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace UnityEditor.Recorder
|
|
{
|
|
abstract class EnumProperyDrawer<T> : PropertyDrawer
|
|
{
|
|
GUIContent[] m_DisplayNames;
|
|
|
|
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
|
{
|
|
if (m_DisplayNames == null)
|
|
{
|
|
var displayNames = new List<GUIContent>();
|
|
|
|
foreach (T frameRate in Enum.GetValues(typeof(T)))
|
|
{
|
|
displayNames.Add(new GUIContent(ToLabel(frameRate)));
|
|
}
|
|
|
|
m_DisplayNames = displayNames.ToArray();
|
|
}
|
|
|
|
EditorGUI.BeginProperty(position, label, property);
|
|
|
|
property.intValue = EditorGUI.Popup(position, label, property.intValue, m_DisplayNames);
|
|
|
|
EditorGUI.EndProperty();
|
|
}
|
|
|
|
protected abstract string ToLabel(T value);
|
|
}
|
|
}
|