上海杨浦大连路地铁站单机版电子沙盘
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

55 lines
1.2 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System;
public class VideoSlider : MonoBehaviour,IPointerDownHandler,IPointerUpHandler,IDragHandler
{
private Slider videoSlider;
private bool isPlaying;
private VideoPanel videoPanel;
// Use this for initialization
void Start()
{
videoSlider = GetComponent<Slider>();
videoPanel = transform.parent.parent.GetComponent<VideoPanel>();
}
// Update is called once per frame
void Update()
{
}
public void OnPointerDown(PointerEventData eventData)
{
videoPanel.skip = true;
if (videoPanel.videoPlayer.isPlaying)
{
isPlaying = true;
videoPanel.Pause();
}
else
{
isPlaying = false;
}
}
public void OnPointerUp(PointerEventData eventData)
{
videoPanel.videoPlayer.time = videoSlider.value;
videoPanel.skip = false;
if (isPlaying)
{
videoPanel.Play();
}
}
public void OnDrag(PointerEventData eventData)
{
videoPanel.videoPlayer.time = videoSlider.value;
}
}