57 lines
1.2 KiB
Plaintext
57 lines
1.2 KiB
Plaintext
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.Video;
|
|
|
|
public class PHomeDYWorldBallDisplayer : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private Image m_worldBallImage;
|
|
|
|
[SerializeField]
|
|
private float m_rotationSpeed;
|
|
|
|
[SerializeField]
|
|
private RawImage m_videoImage;
|
|
|
|
public void SetPlayVid(VideoPlayer videoPlayer, float ratio)
|
|
{
|
|
var curClip = videoPlayer.clip;
|
|
if (curClip != m_worldBall.PreviewClip)
|
|
{
|
|
videoPlayer.clip = m_worldBall.PreviewClip;
|
|
}
|
|
|
|
ratio = Mathf.Clamp(ratio, 0.0f, 1.0f);
|
|
videoPlayer.SetDirectAudioVolume(0, ratio);
|
|
|
|
m_videoImage.texture = videoPlayer.targetTexture;
|
|
}
|
|
|
|
private PHomeWorldBall m_worldBall;
|
|
public PHomeWorldBall WorldBall
|
|
{
|
|
get
|
|
{
|
|
return m_worldBall;
|
|
}
|
|
|
|
set
|
|
{
|
|
m_worldBall = value;
|
|
m_worldBallImage.sprite = value.Icon;
|
|
}
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
m_worldBallImage.transform.Rotate(new Vector3()
|
|
{
|
|
x = 0,
|
|
y = 0,
|
|
z = m_rotationSpeed * Time.deltaTime,
|
|
});
|
|
}
|
|
}
|