少年修仙传客户端代码仓库
client_Wu Xijin
2019-05-08 d32cc3dcba1d8d39b11152f19c4858aa7c83fa7f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Video;
 
public class VideoLoader
{
 
    public static VideoClip Load(string name)
    {
        VideoClip mp4 = null;
        if (Application.isEditor)
        {
#if UNITY_EDITOR
            var path = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath, "Video/", name, ".mp4");
            mp4 = UnityEditor.AssetDatabase.LoadAssetAtPath<VideoClip>(path);
            if (mp4 == null)
            {
                DebugEx.LogErrorFormat("VideoLoader.Load() => 加载不到资源: {0}.", name);
            }
#endif
        }
        else
        {
            var assetInfo = new AssetInfo("video", name);
            mp4 = AssetBundleUtility.Instance.Sync_LoadAsset(assetInfo) as VideoClip;
        }
 
        return mp4;
    }
 
}