public virtual void DrawUI(Rect rect) { if (m_PlayingClip != null) { Texture image = GetAssetPreviewTexture(m_PlayingClip); if (image != null) { GetImageAppropriateSize(image, out var targetVideoSize); GUILayout.Label("", GUILayout.Width(targetVideoSize.x), GUILayout.Height(targetVideoSize.y)); Rect videoRect = new Rect(rect.x + 10, rect.y + 10, targetVideoSize.x, targetVideoSize.y); if (GUI.Button(videoRect, "")) { VideoWindow.ShowVideo(this.GetTrickOverViewInfo().VideoPath, delegate { Resources.FindObjectsOfTypeAll <AllTrickOverViewEditorWindow>()[0].Focus(); }); } EditorGUI.DrawPreviewTexture(videoRect, image); Rect playIconRect = new Rect(videoRect.center - new Vector2(25, 25), new Vector2(50, 50)); GUI.DrawTexture(playIconRect, m_PlayVideoIcon); EditorGUIUtility.AddCursorRect(videoRect, MouseCursor.Link); } return; } if (m_PreviewPic != null) { GetImageAppropriateSize(m_PreviewPic, out var targetVideoSize); GUILayout.Label("", GUILayout.Width(targetVideoSize.x), GUILayout.Height(targetVideoSize.y)); EditorGUI.DrawTextureTransparent( new Rect(rect.x + 10, rect.y + 10, targetVideoSize.x, targetVideoSize.y), m_PreviewPic, ScaleMode.ScaleToFit); } }
private static void ShowWindow() { VideoWindow.ShowVideo("Assets/Editor/Examples/Example_15_SubWindowDock/SubWindowDockVideo.mp4"); }