Example #1
0
 private void BindingInspector(SerializedProperty bindingProperty, PlayableBinding binding)
 {
     if (!(binding.sourceObject == null))
     {
         UnityEngine.Object objectReferenceValue = bindingProperty.objectReferenceValue;
         if (binding.streamType == DataStreamType.Audio)
         {
             this.m_AudioContent.text    = binding.streamName;
             this.m_AudioContent.tooltip = ((!(objectReferenceValue == null)) ? string.Empty : DirectorEditor.Styles.NoBindingsContent.text);
             DirectorEditor.PropertyFieldAsObject(bindingProperty, this.m_AudioContent, typeof(AudioSource), false, false);
         }
         else if (binding.streamType == DataStreamType.Animation)
         {
             this.m_AnimatorContent.text    = binding.streamName;
             this.m_AnimatorContent.tooltip = ((!(objectReferenceValue is GameObject)) ? string.Empty : DirectorEditor.Styles.NoBindingsContent.text);
             DirectorEditor.PropertyFieldAsObject(bindingProperty, this.m_AnimatorContent, typeof(Animator), true, true);
         }
         else if (binding.streamType == DataStreamType.None)
         {
             this.m_ScriptContent.text    = binding.streamName;
             this.m_ScriptContent.tooltip = ((!(objectReferenceValue == null)) ? string.Empty : DirectorEditor.Styles.NoBindingsContent.text);
             this.m_ScriptContent.image   = (AssetPreview.GetMiniTypeThumbnail(binding.sourceBindingType) ?? this.m_DefaultScriptContentTexture);
             if (binding.sourceBindingType != null && typeof(UnityEngine.Object).IsAssignableFrom(binding.sourceBindingType))
             {
                 DirectorEditor.PropertyFieldAsObject(bindingProperty, this.m_ScriptContent, binding.sourceBindingType, true, false);
             }
         }
     }
 }
Example #2
0
        public override void OnInspectorGUI()
        {
            if (this.PlayableAssetOutputsChanged())
            {
                this.SynchSceneBindings();
            }
            base.serializedObject.Update();
            if (DirectorEditor.PropertyFieldAsObject(this.m_PlayableAsset, DirectorEditor.Styles.PlayableText, typeof(PlayableAsset), false, false))
            {
                base.serializedObject.ApplyModifiedProperties();
                this.SynchSceneBindings();
                InternalEditorUtility.RepaintAllViews();
            }
            EditorGUILayout.PropertyField(this.m_UpdateMethod, DirectorEditor.Styles.UpdateMethod, new GUILayoutOption[0]);
            Rect       controlRect = EditorGUILayout.GetControlRect(true, new GUILayoutOption[0]);
            GUIContent label       = EditorGUI.BeginProperty(controlRect, DirectorEditor.Styles.InitialStateContent, this.m_InitialState);
            bool       flag        = this.m_InitialState.enumValueIndex != 0;

            EditorGUI.BeginChangeCheck();
            flag = EditorGUI.Toggle(controlRect, label, flag);
            if (EditorGUI.EndChangeCheck())
            {
                this.m_InitialState.enumValueIndex = ((!flag) ? 0 : 1);
            }
            EditorGUI.EndProperty();
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(this.m_WrapMode, DirectorEditor.Styles.WrapModeContent, new GUILayoutOption[0]);
            if (EditorGUI.EndChangeCheck())
            {
                DirectorWrapMode enumValueIndex = (DirectorWrapMode)this.m_WrapMode.enumValueIndex;
                foreach (PlayableDirector current in base.targets.OfType <PlayableDirector>())
                {
                    current.extrapolationMode = enumValueIndex;
                }
            }
            DirectorEditor.PropertyFieldAsFloat(this.m_InitialTime, DirectorEditor.Styles.InitialTimeContent);
            if (Application.isPlaying)
            {
                this.CurrentTimeField();
            }
            if (base.targets.Length == 1)
            {
                PlayableAsset x = this.m_PlayableAsset.objectReferenceValue as PlayableAsset;
                if (x != null)
                {
                    this.DoDirectorBindingInspector();
                }
            }
            base.serializedObject.ApplyModifiedProperties();
        }