55 lines
1.4 KiB
C#
55 lines
1.4 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.Video;
|
|
|
|
public class ServerGameWaittingPanel : MonoBehaviour
|
|
{
|
|
public static ServerGameWaittingPanel Instance;
|
|
|
|
public VideoPlayer introVideoPlayer;
|
|
public RawImage introRawImage;
|
|
|
|
void SetupIntroVideoPlayer()
|
|
{
|
|
if (introVideoPlayer != null)
|
|
{
|
|
// 設置影片結束事件
|
|
introVideoPlayer.loopPointReached += OnIntroVideoFinished;
|
|
|
|
// 設置影片顯示
|
|
if (introVideoPlayer != null)
|
|
{
|
|
introVideoPlayer.isLooping = true;
|
|
introVideoPlayer.targetTexture = null;
|
|
introVideoPlayer.renderMode = VideoRenderMode.RenderTexture;
|
|
RenderTexture rt = new RenderTexture(1920, 1080, 24);
|
|
introVideoPlayer.targetTexture = rt;
|
|
introRawImage.texture = rt;
|
|
}
|
|
}
|
|
}
|
|
|
|
void OnIntroVideoFinished(VideoPlayer vp)
|
|
{
|
|
//Debug.Log("影片播放完成");
|
|
//StartCoroutine(LoadNextScene());
|
|
|
|
}
|
|
|
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
|
void Start()
|
|
{
|
|
SetupIntroVideoPlayer();
|
|
if (introVideoPlayer)
|
|
{
|
|
introVideoPlayer.Play();
|
|
}
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|