48 lines
1.0 KiB
C#
48 lines
1.0 KiB
C#
|
|
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using UnityEngine;
|
|||
|
|
|
|||
|
|
public class TestVideoFrameButton : MonoBehaviour
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
public int Frame { get; private set; }
|
|||
|
|
private TestVideoController manager { get; set; }
|
|||
|
|
|
|||
|
|
public GameObject Bg;
|
|||
|
|
// Start is called before the first frame update
|
|||
|
|
void Start()
|
|||
|
|
{
|
|||
|
|
manager = FindObjectOfType<TestVideoController>();
|
|||
|
|
|
|||
|
|
UIManager.AddEvent(gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (e) =>
|
|||
|
|
{
|
|||
|
|
SelectFrame(Frame);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void SelectFrame(int frame)
|
|||
|
|
{
|
|||
|
|
manager.PlayToFrame(Frame);
|
|||
|
|
var list = FindObjectsOfType<TestVideoFrameButton>();
|
|||
|
|
foreach (var item in list)
|
|||
|
|
{
|
|||
|
|
item.SetBg(item.Frame == Frame);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void SetBg(bool active)
|
|||
|
|
{
|
|||
|
|
Bg.SetActive(active);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void SetInfo(int frame)
|
|||
|
|
{
|
|||
|
|
this.Frame = frame;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void Destroy()
|
|||
|
|
{
|
|||
|
|
gameObject.Destroy();
|
|||
|
|
}
|
|||
|
|
}
|