Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public IEnumerator PlayerUpd()
- {
- while (!source.isPlaying)
- {
- if (clickCount == 0)
- {
- Debug.Log("!playing");
- yield return new WaitForSeconds(0.4f);
- }
- else
- {
- if (Input.GetKeyDown(KeyCode.Delete))
- {
- clickCount = 0;
- DeleteTrack(indexTrackSelected);
- }
- if (clickCount == 2 && !load)
- {
- if (indexTrackPlaying != -1)
- {
- isPaused = true;
- source.clip = null;
- Transform child = grid.GetChild(indexTrackPlaying).GetChild(0);
- child.GetComponent<Text>().fontStyle = FontStyle.Normal;
- fill.enabled = false;
- handle.enabled = false;
- sldSeek.interactable = false;
- }
- Play(indexTrackSelected);
- clickCount = 0;
- }
- yield return new WaitForSeconds(0.01f);
- }
- }
- while (source.isPlaying)
- {
- if (mPlayer.activeSelf == true)
- {
- if (!hClick.click)
- sldSeek.value = source.time;
- int hours = (int)(source.time) / 3600;
- int seconds = (int)(source.time) - (3600 * hours);
- int minutes = seconds / 60;
- seconds = seconds - (minutes * 60);
- string time = "";
- if (hours.ToString().Length != 2)
- time = " 0" + hours.ToString();
- else
- time = " " + hours.ToString ();
- if (minutes.ToString().Length != 2)
- time += ":0" + minutes.ToString();
- else
- time += ":" + minutes.ToString();
- if (seconds.ToString().Length != 2)
- time += ":0" + seconds.ToString();
- else
- time += ":" + seconds.ToString();
- timeNowLabel.text = time;
- if (clickCount == 0)
- {
- Debug.Log("playing");
- yield return new WaitForSeconds(0.4f);
- }
- else
- {
- if (Input.GetKeyDown(KeyCode.Delete))
- {
- clickCount = 0;
- DeleteTrack(indexTrackSelected);
- }
- if (clickCount == 2 && !load && !adding)
- {
- isPaused = true;
- source.clip = null;
- if (indexTrackPlaying != -1)
- {
- Transform child = grid.GetChild (indexTrackPlaying).GetChild(0);
- child.GetComponent<Text>().fontStyle = FontStyle.Normal;
- }
- fill.enabled = false;
- handle.enabled = false;
- sldSeek.interactable = false;
- Play(indexTrackSelected);
- clickCount = 0;
- }
- yield return new WaitForSeconds(0.01f);
- }
- }
- else
- {
- Debug.Log ("call corutine");
- yield return new WaitForSeconds(3f);
- }
- }
- if (!source.isPlaying && !isPaused && next)
- {
- if (!load && !adding)
- {
- Next();
- }
- else if (load || adding)
- {
- Stop();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement