Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. public IEnumerator PlayerUpd()
  2. {
  3. while (!source.isPlaying)
  4. {
  5. if (clickCount == 0)
  6. {
  7. Debug.Log("!playing");
  8. yield return new WaitForSeconds(0.4f);
  9. }
  10. else
  11. {
  12. if (Input.GetKeyDown(KeyCode.Delete))
  13. {
  14. clickCount = 0;
  15. DeleteTrack(indexTrackSelected);
  16. }
  17. if (clickCount == 2 && !load)
  18. {
  19. if (indexTrackPlaying != -1)
  20. {
  21. isPaused = true;
  22. source.clip = null;
  23. Transform child = grid.GetChild(indexTrackPlaying).GetChild(0);
  24. child.GetComponent<Text>().fontStyle = FontStyle.Normal;
  25. fill.enabled = false;
  26. handle.enabled = false;
  27. sldSeek.interactable = false;
  28. }
  29. Play(indexTrackSelected);
  30. clickCount = 0;
  31. }
  32. yield return new WaitForSeconds(0.01f);
  33. }
  34. }
  35. while (source.isPlaying)
  36. {
  37. if (mPlayer.activeSelf == true)
  38. {
  39. if (!hClick.click)
  40. sldSeek.value = source.time;
  41. int hours = (int)(source.time) / 3600;
  42. int seconds = (int)(source.time) - (3600 * hours);
  43. int minutes = seconds / 60;
  44. seconds = seconds - (minutes * 60);
  45. string time = "";
  46. if (hours.ToString().Length != 2)
  47. time = " 0" + hours.ToString();
  48. else
  49. time = " " + hours.ToString ();
  50. if (minutes.ToString().Length != 2)
  51. time += ":0" + minutes.ToString();
  52. else
  53. time += ":" + minutes.ToString();
  54. if (seconds.ToString().Length != 2)
  55. time += ":0" + seconds.ToString();
  56. else
  57. time += ":" + seconds.ToString();
  58. timeNowLabel.text = time;
  59. if (clickCount == 0)
  60. {
  61. Debug.Log("playing");
  62. yield return new WaitForSeconds(0.4f);
  63. }
  64. else
  65. {
  66. if (Input.GetKeyDown(KeyCode.Delete))
  67. {
  68. clickCount = 0;
  69. DeleteTrack(indexTrackSelected);
  70. }
  71. if (clickCount == 2 && !load && !adding)
  72. {
  73. isPaused = true;
  74. source.clip = null;
  75. if (indexTrackPlaying != -1)
  76. {
  77. Transform child = grid.GetChild (indexTrackPlaying).GetChild(0);
  78. child.GetComponent<Text>().fontStyle = FontStyle.Normal;
  79. }
  80. fill.enabled = false;
  81. handle.enabled = false;
  82. sldSeek.interactable = false;
  83. Play(indexTrackSelected);
  84. clickCount = 0;
  85. }
  86. yield return new WaitForSeconds(0.01f);
  87. }
  88. }
  89. else
  90. {
  91. Debug.Log ("call corutine");
  92. yield return new WaitForSeconds(3f);
  93. }
  94. }
  95. if (!source.isPlaying && !isPaused && next)
  96. {
  97. if (!load && !adding)
  98. {
  99. Next();
  100. }
  101. else if (load || adding)
  102. {
  103. Stop();
  104. }
  105. }
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement