Boat Attack使用了Universal RP的许多新图形功能,可以用于探索 Universal RP 的使用方式和技巧。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

38 行
1.7 KiB

using UnityEngine;
using UnityEditor;
namespace Cinemachine.Editor
{
[CustomPropertyDrawer(typeof(CinemachineBlendDefinitionPropertyAttribute))]
public sealed class CinemachineBlendDefinitionPropertyDrawer : PropertyDrawer
{
CinemachineBlendDefinition myClass = new CinemachineBlendDefinition(); // to access name strings
public override void OnGUI(Rect rect, SerializedProperty property, GUIContent label)
{
float vSpace = 0;
float floatFieldWidth = EditorGUIUtility.singleLineHeight * 2.5f;
SerializedProperty timeProp = property.FindPropertyRelative(() => myClass.m_Time);
GUIContent timeText = new GUIContent(" sec ", timeProp.tooltip);
var textDimensions = GUI.skin.label.CalcSize(timeText);
rect = EditorGUI.PrefixLabel(rect, label);
rect.y += vSpace; rect.height = EditorGUIUtility.singleLineHeight;
rect.width -= floatFieldWidth + textDimensions.x;
SerializedProperty styleProp = property.FindPropertyRelative(() => myClass.m_Style);
EditorGUI.PropertyField(rect, styleProp, GUIContent.none);
if (styleProp.intValue != (int)CinemachineBlendDefinition.Style.Cut)
{
float oldWidth = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = textDimensions.x;
rect.x += rect.width; rect.width = floatFieldWidth + EditorGUIUtility.labelWidth;
EditorGUI.PropertyField(rect, timeProp, timeText);
timeProp.floatValue = Mathf.Max(timeProp.floatValue, 0);
EditorGUIUtility.labelWidth = oldWidth;
}
}
}
}