|
|
|
|
|
|
VisualElement m_TargetContainer; |
|
|
|
ToolbarMenu m_TargetPropertyMenu; |
|
|
|
SerializedProperty m_SerializedProperty; |
|
|
|
SerializedProperty m_TargetGameObjectProperty; |
|
|
|
SerializedProperty m_Target; |
|
|
|
SerializedProperty m_TargetGameObject; |
|
|
|
SerializedProperty m_ApplicationFrequency; |
|
|
|
|
|
|
|
const string k_CollapsedParameterClass = "collapsed-parameter"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_TargetContainer = this.Q<VisualElement>("target-container"); |
|
|
|
m_TargetPropertyMenu = this.Q<ToolbarMenu>("property-select-menu"); |
|
|
|
m_TargetGameObjectProperty = m_SerializedProperty.FindPropertyRelative("target.gameObject"); |
|
|
|
m_Target = m_SerializedProperty.FindPropertyRelative("target"); |
|
|
|
m_TargetGameObject = m_Target.FindPropertyRelative("gameObject"); |
|
|
|
frequencyField.BindProperty(m_SerializedProperty.FindPropertyRelative("target.applicationFrequency")); |
|
|
|
m_ApplicationFrequency = m_Target.FindPropertyRelative("applicationFrequency"); |
|
|
|
frequencyField.BindProperty(m_ApplicationFrequency); |
|
|
|
targetField.value = m_TargetGameObjectProperty.objectReferenceValue; |
|
|
|
targetField.value = m_TargetGameObject.objectReferenceValue; |
|
|
|
m_TargetGameObjectProperty.objectReferenceValue = (GameObject)evt.newValue; |
|
|
|
var appFreqEnumIndex = m_ApplicationFrequency.enumValueIndex; |
|
|
|
m_TargetGameObject.objectReferenceValue = (GameObject)evt.newValue; |
|
|
|
m_ApplicationFrequency.enumValueIndex = appFreqEnumIndex; |
|
|
|
m_SerializedProperty.serializedObject.ApplyModifiedProperties(); |
|
|
|
ToggleTargetContainer(); |
|
|
|
FillPropertySelectMenu(); |
|
|
|
|
|
|
|
|
|
|
void ToggleTargetContainer() |
|
|
|
{ |
|
|
|
m_TargetContainer.style.display = m_TargetGameObjectProperty.objectReferenceValue == null |
|
|
|
m_TargetContainer.style.display = m_TargetGameObject.objectReferenceValue == null |
|
|
|
? new StyleEnum<DisplayStyle>(DisplayStyle.None) |
|
|
|
: new StyleEnum<DisplayStyle>(DisplayStyle.Flex); |
|
|
|
} |
|
|
|
|
|
|
m_SerializedProperty.FindPropertyRelative("target.component").objectReferenceValue = null; |
|
|
|
m_SerializedProperty.FindPropertyRelative("target.propertyName").stringValue = string.Empty; |
|
|
|
m_SerializedProperty.FindPropertyRelative("target.applicationFrequency").enumValueIndex = 0; |
|
|
|
m_Target.FindPropertyRelative("component").objectReferenceValue = null; |
|
|
|
m_Target.FindPropertyRelative("propertyName").stringValue = string.Empty; |
|
|
|
m_SerializedProperty.FindPropertyRelative("target.gameObject").objectReferenceValue = newTarget.gameObject; |
|
|
|
m_SerializedProperty.FindPropertyRelative("target.component").objectReferenceValue = newTarget.component; |
|
|
|
m_SerializedProperty.FindPropertyRelative("target.propertyName").stringValue = newTarget.propertyName; |
|
|
|
m_SerializedProperty.FindPropertyRelative("target.fieldOrProperty").enumValueIndex = (int)newTarget.fieldOrProperty; |
|
|
|
m_TargetGameObject.objectReferenceValue = newTarget.gameObject; |
|
|
|
m_Target.FindPropertyRelative("component").objectReferenceValue = newTarget.component; |
|
|
|
m_Target.FindPropertyRelative("propertyName").stringValue = newTarget.propertyName; |
|
|
|
m_Target.FindPropertyRelative("fieldOrProperty").enumValueIndex = (int)newTarget.fieldOrProperty; |
|
|
|
m_SerializedProperty.serializedObject.ApplyModifiedProperties(); |
|
|
|
m_TargetPropertyMenu.text = TargetPropertyDisplayText(parameter.target); |
|
|
|
} |
|
|
|