Advertisement
Guest User

Untitled

a guest
Aug 10th, 2016
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.UI;
  4. public class ToggleSave : MonoBehaviour {
  5. public Toggle workingDay1;
  6. public OnChecmark wd1;
  7. public Toggle workingDay2;
  8. public OnChecmark wd2;
  9. public Toggle workingDay3;
  10. public OnChecmark wd3;
  11. public Toggle workingDay4;
  12. public OnChecmark wd4;
  13. public Toggle educationalDay1;
  14. public OnChecmark ed1;
  15. public Toggle educationalDay2;
  16. public OnChecmark ed2;
  17. public Toggle educationalDay3;
  18. public OnChecmark ed3;
  19. public Toggle educationalDay4;
  20. public OnChecmark ed4;
  21. public DayProccessor _proccessor;
  22. public GameObject _working_day1;
  23. public GameObject _working_day2;
  24. public GameObject _working_day3;
  25. public GameObject _working_day4;
  26. public GameObject _educational_day1;
  27. public GameObject _educational_day2;
  28. public GameObject _educational_day3;
  29. public GameObject _educational_day4;
  30. public bool _wd1;
  31. public bool _wd2;
  32. public bool _wd3;
  33. public bool _wd4;
  34. public bool _ed1;
  35. public bool _ed2;
  36. public bool _ed3;
  37. public bool _ed4;
  38. public float timer;
  39. public bool tim;
  40. public int day1;
  41. public int day2;
  42. public int day3;
  43. public int day4;
  44. public int day5;
  45. public int day6;
  46. public int day7;
  47. public int day8;
  48. void Start()
  49. {
  50. tim = false;
  51. timer = 0.0f;
  52. day1 = 0;
  53. day2 = 0;
  54. day3 = 0;
  55. day4 = 0;
  56. day5 = 0;
  57. day6 = 0;
  58. day7 = 0;
  59. day8 = 0;
  60. }
  61. public void OnButton()
  62. {
  63. tim = true;
  64. }
  65. public void LoadDays()
  66. {
  67. day1 = PlayerPrefs.GetInt("Day1");
  68. day2 = PlayerPrefs.GetInt("Day2");
  69. day3 = PlayerPrefs.GetInt("Day3");
  70. day4 = PlayerPrefs.GetInt("Day4");
  71. day5 = PlayerPrefs.GetInt("Day5");
  72. day6 = PlayerPrefs.GetInt("Day6");
  73. day7 = PlayerPrefs.GetInt("Day7");
  74. day8 = PlayerPrefs.GetInt("Day8");
  75. Debug.Log("LoadDays");
  76. }
  77. public void SaveDays()
  78. {
  79. PlayerPrefs.SetInt("Day1", day1);
  80. PlayerPrefs.SetInt("Day2", day2);
  81. PlayerPrefs.SetInt("Day3", day3);
  82. PlayerPrefs.SetInt("Day4", day4);
  83. PlayerPrefs.SetInt("Day5", day5);
  84. PlayerPrefs.SetInt("Day6", day6);
  85. PlayerPrefs.SetInt("Day7", day7);
  86. PlayerPrefs.SetInt("Day8", day8);
  87. Debug.Log("SaveDays");
  88. }
  89. void Update()
  90. {
  91. if (tim == true)
  92. {
  93. if (day1 == 1)
  94. {
  95. _wd1 = true;
  96. }
  97. if (day2 == 1)
  98. {
  99. _wd2 = true;
  100. }
  101. if (day3 == 1)
  102. {
  103. _wd3 = true;
  104. }
  105. if (day4 == 1)
  106. {
  107. _wd4 = true;
  108. }
  109. if (day5 == 1)
  110. {
  111. _ed1 = true;
  112. }
  113. if (day6 == 1)
  114. {
  115. _ed2 = true;
  116. }
  117. if (day7 == 1)
  118. {
  119. _ed3 = true;
  120. }
  121. if (day8 == 1)
  122. {
  123. _ed4 = true;
  124. }
  125. timer += Time.deltaTime;
  126. if (timer >= 0.05)
  127. {
  128. tim = false;
  129. timer = 0.0f;
  130. }
  131. if (_wd1 == true)
  132. {
  133. _proccessor.WD1();
  134. workingDay1.isOn = true;
  135. _working_day1.gameObject.SetActive(true);
  136. }
  137. if (_wd2 == true)
  138. {
  139. _proccessor.WD2();
  140. workingDay2.isOn = true;
  141. _working_day2.gameObject.SetActive(true);
  142. }
  143. if (_wd3 == true)
  144. {
  145. _proccessor.WD3();
  146. workingDay3.isOn = true;
  147. _working_day3.gameObject.SetActive(true);
  148. }
  149. if (_wd4 == true)
  150. {
  151. _proccessor.WD4();
  152. workingDay4.isOn = true;
  153. _working_day4.gameObject.SetActive(true);
  154. }
  155. if (_ed1 == true)
  156. {
  157. _proccessor.ED1();
  158. educationalDay1.isOn = true;
  159. _educational_day1.gameObject.SetActive(true);
  160. }
  161. if (_ed2 == true)
  162. {
  163. _proccessor.ED2();
  164. educationalDay2.isOn = true;
  165. _educational_day2.gameObject.SetActive(true);
  166. }
  167. if (_ed3 == true)
  168. {
  169. _proccessor.ED3();
  170. educationalDay3.isOn = true;
  171. _educational_day3.gameObject.SetActive(true);
  172. }
  173. if (_ed4 == true)
  174. {
  175. _proccessor.ED4();
  176. educationalDay4.isOn = true;
  177. _educational_day4.gameObject.SetActive(true);
  178. }
  179. }
  180. }
  181. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement