Esempio n. 1
0
        private void OnEnable()
        {
            this.m_ShowRenderTexture.valueChanged.AddListener(new UnityAction(base.Repaint));
            this.m_ShowTargetCamera.valueChanged.AddListener(new UnityAction(base.Repaint));
            this.m_ShowRenderer.valueChanged.AddListener(new UnityAction(base.Repaint));
            this.m_ShowMaterialProperty.valueChanged.AddListener(new UnityAction(base.Repaint));
            this.m_DataSourceIsClip.valueChanged.AddListener(new UnityAction(base.Repaint));
            this.m_ShowAspectRatio.valueChanged.AddListener(new UnityAction(base.Repaint));
            this.m_ShowAudioControls.valueChanged.AddListener(new UnityAction(base.Repaint));
            this.m_DataSource                = base.serializedObject.FindProperty("m_DataSource");
            this.m_VideoClip                 = base.serializedObject.FindProperty("m_VideoClip");
            this.m_Url                       = base.serializedObject.FindProperty("m_Url");
            this.m_PlayOnAwake               = base.serializedObject.FindProperty("m_PlayOnAwake");
            this.m_WaitForFirstFrame         = base.serializedObject.FindProperty("m_WaitForFirstFrame");
            this.m_Looping                   = base.serializedObject.FindProperty("m_Looping");
            this.m_PlaybackSpeed             = base.serializedObject.FindProperty("m_PlaybackSpeed");
            this.m_RenderMode                = base.serializedObject.FindProperty("m_RenderMode");
            this.m_TargetTexture             = base.serializedObject.FindProperty("m_TargetTexture");
            this.m_TargetCamera              = base.serializedObject.FindProperty("m_TargetCamera");
            this.m_TargetMaterialRenderer    = base.serializedObject.FindProperty("m_TargetMaterialRenderer");
            this.m_TargetMaterialProperty    = base.serializedObject.FindProperty("m_TargetMaterialProperty");
            this.m_AspectRatio               = base.serializedObject.FindProperty("m_AspectRatio");
            this.m_TargetCameraAlpha         = base.serializedObject.FindProperty("m_TargetCameraAlpha");
            this.m_TargetCamera3DLayout      = base.serializedObject.FindProperty("m_TargetCamera3DLayout");
            this.m_AudioOutputMode           = base.serializedObject.FindProperty("m_AudioOutputMode");
            this.m_ControlledAudioTrackCount = base.serializedObject.FindProperty("m_ControlledAudioTrackCount");
            this.m_EnabledAudioTracks        = base.serializedObject.FindProperty("m_EnabledAudioTracks");
            this.m_TargetAudioSources        = base.serializedObject.FindProperty("m_TargetAudioSources");
            this.m_DirectAudioVolumes        = base.serializedObject.FindProperty("m_DirectAudioVolumes");
            this.m_DirectAudioMutes          = base.serializedObject.FindProperty("m_DirectAudioMutes");
            this.m_ShowRenderTexture.value   = (this.m_RenderMode.intValue == 2);
            this.m_ShowTargetCamera.value    = (this.m_RenderMode.intValue == 0 || this.m_RenderMode.intValue == 1);
            this.m_ShowRenderer.value        = (this.m_RenderMode.intValue == 3);
            UnityEngine.Object[] arg_321_0 = base.targets;
            if (VideoPlayerEditor.< > f__mg$cache0 == null)
            {
                VideoPlayerEditor.< > f__mg$cache0 = new VideoPlayerEditor.EntryGenerator(VideoPlayerEditor.GetMaterialPropertyNames);
            }
            this.m_MaterialPropertyPopupContent     = VideoPlayerEditor.BuildPopupEntries(arg_321_0, VideoPlayerEditor.< > f__mg$cache0, out this.m_MaterialPropertyPopupSelection, out this.m_MaterialPropertyPopupInvalidSelections);
            this.m_MaterialPropertyPopupContentHash = VideoPlayerEditor.GetMaterialPropertyPopupHash(base.targets);
            this.m_ShowMaterialProperty.value       = (base.targets.Count <UnityEngine.Object>() > 1 || (this.m_MaterialPropertyPopupSelection >= 0 && this.m_MaterialPropertyPopupContent.Length > 0));
            this.m_DataSourceIsClip.value           = (this.m_DataSource.intValue == 0);
            this.m_ShowAspectRatio.value            = (this.m_RenderMode.intValue != 3 && this.m_RenderMode.intValue != 4);
            this.m_ShowAudioControls.value          = (this.m_AudioOutputMode.intValue != 0);
            VideoPlayer videoPlayer = base.target as VideoPlayer;

            videoPlayer.prepareCompleted += new VideoPlayer.EventHandler(this.PrepareCompleted);
            this.m_AudioTrackInfos        = new List <VideoPlayerEditor.AudioTrackInfo>();
        }
Esempio n. 2
0
 private void HandleTargetField(VideoRenderMode currentRenderMode)
 {
     this.m_ShowRenderTexture.target = (currentRenderMode == VideoRenderMode.RenderTexture);
     if (EditorGUILayout.BeginFadeGroup(this.m_ShowRenderTexture.faded))
     {
         EditorGUILayout.PropertyField(this.m_TargetTexture, VideoPlayerEditor.s_Styles.textureContent, new GUILayoutOption[0]);
     }
     EditorGUILayout.EndFadeGroup();
     this.m_ShowTargetCamera.target = (currentRenderMode == VideoRenderMode.CameraFarPlane || currentRenderMode == VideoRenderMode.CameraNearPlane);
     if (EditorGUILayout.BeginFadeGroup(this.m_ShowTargetCamera.faded))
     {
         EditorGUILayout.PropertyField(this.m_TargetCamera, VideoPlayerEditor.s_Styles.cameraContent, new GUILayoutOption[0]);
         EditorGUILayout.Slider(this.m_TargetCameraAlpha, 0f, 1f, VideoPlayerEditor.s_Styles.alphaContent, new GUILayoutOption[0]);
     }
     EditorGUILayout.EndFadeGroup();
     this.m_ShowRenderer.target = (currentRenderMode == VideoRenderMode.MaterialOverride);
     if (EditorGUILayout.BeginFadeGroup(this.m_ShowRenderer.faded))
     {
         bool flag = base.targets.Count <UnityEngine.Object>() > 1;
         if (flag)
         {
             EditorGUILayout.PropertyField(this.m_TargetMaterialRenderer, VideoPlayerEditor.s_Styles.materialRendererContent, new GUILayoutOption[0]);
         }
         else
         {
             Rect       controlRect = EditorGUILayout.GetControlRect(true, 16f, new GUILayoutOption[0]);
             GUIContent label       = EditorGUI.BeginProperty(controlRect, VideoPlayerEditor.s_Styles.materialRendererContent, this.m_TargetMaterialRenderer);
             EditorGUI.BeginChangeCheck();
             UnityEngine.Object objectReferenceValue = EditorGUI.ObjectField(controlRect, label, VideoPlayerEditor.GetTargetRenderer((VideoPlayer)base.target), typeof(Renderer), true);
             if (EditorGUI.EndChangeCheck())
             {
                 this.m_TargetMaterialRenderer.objectReferenceValue = objectReferenceValue;
             }
             EditorGUI.EndProperty();
         }
         int materialPropertyPopupHash = VideoPlayerEditor.GetMaterialPropertyPopupHash(base.targets);
         if (this.m_MaterialPropertyPopupContentHash != materialPropertyPopupHash)
         {
             UnityEngine.Object[] arg_1CE_0 = base.targets;
             if (VideoPlayerEditor.< > f__mg$cache1 == null)
             {
                 VideoPlayerEditor.< > f__mg$cache1 = new VideoPlayerEditor.EntryGenerator(VideoPlayerEditor.GetMaterialPropertyNames);
             }
             this.m_MaterialPropertyPopupContent = VideoPlayerEditor.BuildPopupEntries(arg_1CE_0, VideoPlayerEditor.< > f__mg$cache1, out this.m_MaterialPropertyPopupSelection, out this.m_MaterialPropertyPopupInvalidSelections);
         }
         VideoPlayerEditor.HandlePopup(VideoPlayerEditor.s_Styles.materialPropertyContent, this.m_TargetMaterialProperty, this.m_MaterialPropertyPopupContent, this.m_MaterialPropertyPopupSelection);
         if (this.m_MaterialPropertyPopupInvalidSelections > 0 || this.m_MaterialPropertyPopupContent.Length == 0)
         {
             GUILayout.BeginHorizontal(new GUILayoutOption[0]);
             GUILayout.Space(EditorGUIUtility.labelWidth);
             if (this.m_MaterialPropertyPopupContent.Length == 0)
             {
                 if (!flag)
                 {
                     EditorGUILayout.HelpBox(VideoPlayerEditor.s_Styles.rendererMaterialsHaveNoTexPropsHelp, MessageType.Warning);
                 }
                 else
                 {
                     EditorGUILayout.HelpBox(VideoPlayerEditor.s_Styles.someRendererMaterialsHaveNoTexPropsHelp, MessageType.Warning);
                 }
             }
             else if (!flag)
             {
                 EditorGUILayout.HelpBox(VideoPlayerEditor.s_Styles.invalidTexPropSelectionHelp, MessageType.Warning);
             }
             else if (this.m_MaterialPropertyPopupInvalidSelections == 1)
             {
                 EditorGUILayout.HelpBox(VideoPlayerEditor.s_Styles.oneInvalidTexPropSelectionHelp, MessageType.Warning);
             }
             else
             {
                 EditorGUILayout.HelpBox(string.Format(VideoPlayerEditor.s_Styles.someInvalidTexPropSelectionsHelp, this.m_MaterialPropertyPopupInvalidSelections), MessageType.Warning);
             }
             GUILayout.EndHorizontal();
         }
         else
         {
             this.DisplayMultiMaterialInformation(this.m_MaterialPropertyPopupContentHash != materialPropertyPopupHash);
         }
         this.m_MaterialPropertyPopupContentHash = materialPropertyPopupHash;
     }
     EditorGUILayout.EndFadeGroup();
     this.m_ShowAspectRatio.target = (currentRenderMode != VideoRenderMode.MaterialOverride && currentRenderMode != VideoRenderMode.APIOnly);
     if (EditorGUILayout.BeginFadeGroup(this.m_ShowAspectRatio.faded))
     {
         EditorGUILayout.PropertyField(this.m_AspectRatio, VideoPlayerEditor.s_Styles.aspectRatioLabel, new GUILayoutOption[0]);
     }
     EditorGUILayout.EndFadeGroup();
 }