Music _play_music_mp3() { Music music = MusicMgr.PlayMp3(clipMp3); EventMgr.startEvent("显示关闭按钮"); Debug.Log("播放音乐文件:" + clipMp3.name); return(music); }
public static void ShowList(LIST_TYPE newType) { listType = newType; Instance.objEditPanel.SetActive(true); int nCount = 0; switch (listType) { case LIST_TYPE.audio_Inner: nCount = audio.lisVideoRes.Count; foreach (string mediaName in audio.lisVideoRes) { Button button = EditorPanel.AddItem(mediaName); button.onClick.AddListener(() => { EventMgr.startEvent("显示关闭按钮"); GameObject objLayer = UIMgr.CreateLayer(10); if (objLayer != null) { EditorPanel.Instance.gameObject.SetActive(false); AudioClip clipMp3 = Resources.Load <AudioClip>("Media/" + mediaName); Music music = MusicMgr.PlayMp3(clipMp3); music.gameObject.AddComponent <_Astroid>(); } }); } break; case LIST_TYPE.audio_Url: nCount = audio.lisVideoUrl.Count; foreach (string mediaName in audio.lisVideoUrl) { Button button = EditorPanel.AddItem(mediaName); button.onClick.AddListener(() => { EventMgr.startEvent("显示关闭按钮"); GameObject objLayer = UIMgr.CreateLayer(10); if (objLayer != null) { EditorPanel.Instance.gameObject.SetActive(false); VideoFile theVideo = VideoMgr.CreateVideoPanel("movie", objLayer); theVideo.playUrl(mediaName); } }); } break; case LIST_TYPE.audio_Streaming: nCount = audio.lisVideoStreaming.Count; foreach (string mediaName in audio.lisVideoStreaming) { Button button = EditorPanel.AddItem(mediaName); button.onClick.AddListener(() => { EventMgr.startEvent("显示关闭按钮"); GameObject objLayer = UIMgr.CreateLayer(10); if (objLayer != null) { EditorPanel.Instance.gameObject.SetActive(false); Instance.StartCoroutine(Instance.LoadMusic(mediaName)); // VideoFile theVideo = VideoMgr.CreateVideoPanel("movie", objLayer); // theVideo.playUrl(mediaName); } }); } break; case LIST_TYPE.video_Inner: nCount = video.lisVideoRes.Count; foreach (string mediaName in video.lisVideoRes) { Button button = EditorPanel.AddItem(mediaName); button.onClick.AddListener(() => { EventMgr.startEvent("显示关闭按钮"); GameObject objLayer = UIMgr.CreateLayer(10); if (objLayer != null) { EditorPanel.Instance.gameObject.SetActive(false); VideoFile theVideo = VideoMgr.CreateVideoPanel("movie", objLayer); VideoClip videoClip = Resources.Load <VideoClip>("Media/" + mediaName); theVideo.Play(videoClip); } }); } break; case LIST_TYPE.video_Url: nCount = video.lisVideoUrl.Count; foreach (string mediaName in video.lisVideoUrl) { Button button = EditorPanel.AddItem(mediaName); button.onClick.AddListener(() => { EventMgr.startEvent("显示关闭按钮"); GameObject objLayer = UIMgr.CreateLayer(10); if (objLayer != null) { EditorPanel.Instance.gameObject.SetActive(false); VideoFile theVideo = VideoMgr.CreateVideoPanel("movie", objLayer); theVideo.playUrl(mediaName); } }); } break; case LIST_TYPE.video_Streaming: nCount = video.lisVideoStreaming.Count; foreach (string mediaName in video.lisVideoStreaming) { Button button = EditorPanel.AddItem(mediaName); button.onClick.AddListener(() => { EventMgr.startEvent("显示关闭按钮"); GameObject objLayer = UIMgr.CreateLayer(10); if (objLayer != null) { EditorPanel.Instance.gameObject.SetActive(false); VideoFile theVideo = VideoMgr.CreateVideoPanel("movie", objLayer); theVideo.playUrl(mediaName); } }); } break; case LIST_TYPE.List_None: break; } Vector2 sz = EditorPanel.Instance.parent.GetComponent <RectTransform>().sizeDelta; sz.y += 20; sz.y = nCount * 64; EditorPanel.Instance.parent.GetComponent <RectTransform>().sizeDelta = sz; }