using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; using UnityEngine.SceneManagement; using uc; #if UNITY_EDITOR using UnityEditor; using UnityEditor.SceneManagement; #endif public class MoviePlayerBase : MonoBehaviour { public DShowClip VideoAsset; /* [Tooltip("the root path is unity project path")] [ContextMenuItem("Select Path", "SetRoot")] public string DataRoot = ""; public string Filename = ""; */ // virtual function public virtual bool Load(DShowClip path) { return true; } public virtual void Play() { } public virtual void Pause() { } public virtual void Stop() { } // virtual property public virtual bool Loop { set { } get { return true; } } public virtual Texture Texture { get { return null; } } public virtual uint Frame { set { } get { return 0; } } public virtual bool IsPaused { get { return false; } } public virtual bool IsLoaded { get { return true; } } public virtual bool IsPlaying { get { return !IsPaused; } } public virtual bool IsFinished { get { return TotalNumFrames == Frame; } } public virtual uint TotalNumFrames { get { return 1; } } public virtual float Volume { get { return 0; }set { } } public virtual float GetDuration { get { return 0; } } public virtual float GetCurrentTime { get { return 0; } } /* const string defaltFolderName = "Material"; DirectoryInfo internalRoot { get { return Directory.GetParent(Application.dataPath); } } DirectoryInfo pool_root; string pre_data_root = ""; protected DirectoryInfo PoolRoot { get { if (pool_root == null || pre_data_root != DataRoot) { if (DataRoot != "") { pool_root = internalRoot.CreateSubdirectory(DataRoot); } else { pool_root = internalRoot; } pre_data_root = DataRoot; } return pool_root; } } protected string FullPath { get { return PoolRoot.FullName + @"\" + Filename; } } protected void SetRoot() { #if UNITY_EDITOR string internalRootFull = Path.GetFullPath(internalRoot.FullName + "/../"); string path = EditorUtility.OpenFolderPanel("Select Root Path for Movie...", internalRootFull, defaltFolderName); if (path == "") return; Undo.RecordObject(this, "Set Root Path"); var relPath = path.GetRelativePath(internalRoot.FullName); DataRoot = relPath; EditorUtility.SetDirty(this); EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene()); Debug.Log(relPath); #endif } */ }