t1 / TFDContents / Assets / 01.Script / VideoController.cs @ 11
이력 | 보기 | 이력해설 | 다운로드 (2.12 KB)
| 1 | 11 | YCH | using System.Collections; | 
|---|---|---|---|
| 2 | using System.Collections.Generic; | ||
| 3 | using UnityEngine; | ||
| 4 | |||
| 5 | public class VideoController : MonoBehaviour {
 | ||
| 6 | [SerializeField] | ||
| 7 | PlayVLC vlc; | ||
| 8 | |||
| 9 | int currentIndex = 1; | ||
| 10 | int destIndex = 0; | ||
| 11 | // Use this for initialization | ||
| 12 | void Start () | ||
| 13 |     {
 | ||
| 14 | //StartCoroutine(VideoFollower()); | ||
| 15 | } | ||
| 16 | |||
| 17 | //void PlayListAt(int index) | ||
| 18 |     //{
 | ||
| 19 | // vlc.StreamingAssetsVideoFilename = vlc.StreamingAssetsVideoPlaylistItems[index]; | ||
| 20 | // print(vlc.StreamingAssetsVideoPlaylistItems[index]); | ||
| 21 | // vlc.Play(); | ||
| 22 | //} | ||
| 23 | // Update is called once per frame | ||
| 24 | int oldPercentage; | ||
| 25 | bool isChange; | ||
| 26 | bool check = true; | ||
| 27 | |||
| 28 | void Update() | ||
| 29 |     {
 | ||
| 30 | int time = vlc.CR_GetCurrentTime(); | ||
| 31 | if ((time == 18 || time == 38 || time == 58 || time == 78 || time == 98 || time == 118 || time == 138 || time == 158 || time == 178) && check == true) | ||
| 32 |         {
 | ||
| 33 | vlc.CR_SeekAdditive(-18); | ||
| 34 | check = false; | ||
| 35 | } | ||
| 36 | |||
| 37 | if (time == ((destIndex ) * 20) + 2) | ||
| 38 |         {
 | ||
| 39 | check = true; | ||
| 40 | } | ||
| 41 | if (Input.GetKeyDown(KeyCode.Alpha0)) | ||
| 42 |         {
 | ||
| 43 | vlc.CR_SeekAdditive(5); | ||
| 44 | } | ||
| 45 | //Debug.Log(time); | ||
| 46 | for (int keycode = (int)KeyCode.Alpha1; keycode <= (int)KeyCode.Alpha9; keycode++) | ||
| 47 |         {
 | ||
| 48 | if (Input.GetKeyDown((KeyCode)keycode)) | ||
| 49 |                 {
 | ||
| 50 | currentIndex = destIndex; | ||
| 51 | destIndex = keycode - (int)KeyCode.Alpha1; // 누른 index | ||
| 52 | |||
| 53 | int d = destIndex - currentIndex; | ||
| 54 | Debug.Log(d); | ||
| 55 | vlc.CR_SeekAdditive(20 * d); | ||
| 56 | |||
| 57 | |||
| 58 | // oldPercentage = (int)(vlc.CR_GetCurrentVideoSeekPosition() * 100); | ||
| 59 | // vlc.CR_PlayItem(destIndex, time); | ||
| 60 | isChange = true; | ||
| 61 | } | ||
| 62 | }/* | ||
| 63 | if(!vlc.IsPlaying && isChange && (int)(vlc.CR_GetCurrentVideoSeekPosition() * 100) < oldPercentage) | ||
| 64 |         {
 | ||
| 65 | isChange = false; | ||
| 66 | vlc.CR_SetPersentage(destIndex, (int)(vlc.CR_GetCurrentVideoSeekPosition() * 100)); | ||
| 67 | }*/ | ||
| 68 | } | ||
| 69 | } |