Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using UnityEngine.UI;
- public class ToggleSave : MonoBehaviour {
- public Toggle workingDay1;
- public OnChecmark wd1;
- public Toggle workingDay2;
- public OnChecmark wd2;
- public Toggle workingDay3;
- public OnChecmark wd3;
- public Toggle workingDay4;
- public OnChecmark wd4;
- public Toggle educationalDay1;
- public OnChecmark ed1;
- public Toggle educationalDay2;
- public OnChecmark ed2;
- public Toggle educationalDay3;
- public OnChecmark ed3;
- public Toggle educationalDay4;
- public OnChecmark ed4;
- public DayProccessor _proccessor;
- public GameObject _working_day1;
- public GameObject _working_day2;
- public GameObject _working_day3;
- public GameObject _working_day4;
- public GameObject _educational_day1;
- public GameObject _educational_day2;
- public GameObject _educational_day3;
- public GameObject _educational_day4;
- public bool _wd1;
- public bool _wd2;
- public bool _wd3;
- public bool _wd4;
- public bool _ed1;
- public bool _ed2;
- public bool _ed3;
- public bool _ed4;
- public float timer;
- public bool tim;
- public int day1;
- public int day2;
- public int day3;
- public int day4;
- public int day5;
- public int day6;
- public int day7;
- public int day8;
- void Start()
- {
- tim = false;
- timer = 0.0f;
- day1 = 0;
- day2 = 0;
- day3 = 0;
- day4 = 0;
- day5 = 0;
- day6 = 0;
- day7 = 0;
- day8 = 0;
- }
- public void OnButton()
- {
- tim = true;
- }
- public void LoadDays()
- {
- day1 = PlayerPrefs.GetInt("Day1");
- day2 = PlayerPrefs.GetInt("Day2");
- day3 = PlayerPrefs.GetInt("Day3");
- day4 = PlayerPrefs.GetInt("Day4");
- day5 = PlayerPrefs.GetInt("Day5");
- day6 = PlayerPrefs.GetInt("Day6");
- day7 = PlayerPrefs.GetInt("Day7");
- day8 = PlayerPrefs.GetInt("Day8");
- Debug.Log("LoadDays");
- }
- public void SaveDays()
- {
- PlayerPrefs.SetInt("Day1", day1);
- PlayerPrefs.SetInt("Day2", day2);
- PlayerPrefs.SetInt("Day3", day3);
- PlayerPrefs.SetInt("Day4", day4);
- PlayerPrefs.SetInt("Day5", day5);
- PlayerPrefs.SetInt("Day6", day6);
- PlayerPrefs.SetInt("Day7", day7);
- PlayerPrefs.SetInt("Day8", day8);
- Debug.Log("SaveDays");
- }
- void Update()
- {
- if (tim == true)
- {
- if (day1 == 1)
- {
- _wd1 = true;
- }
- if (day2 == 1)
- {
- _wd2 = true;
- }
- if (day3 == 1)
- {
- _wd3 = true;
- }
- if (day4 == 1)
- {
- _wd4 = true;
- }
- if (day5 == 1)
- {
- _ed1 = true;
- }
- if (day6 == 1)
- {
- _ed2 = true;
- }
- if (day7 == 1)
- {
- _ed3 = true;
- }
- if (day8 == 1)
- {
- _ed4 = true;
- }
- timer += Time.deltaTime;
- if (timer >= 0.05)
- {
- tim = false;
- timer = 0.0f;
- }
- if (_wd1 == true)
- {
- _proccessor.WD1();
- workingDay1.isOn = true;
- _working_day1.gameObject.SetActive(true);
- }
- if (_wd2 == true)
- {
- _proccessor.WD2();
- workingDay2.isOn = true;
- _working_day2.gameObject.SetActive(true);
- }
- if (_wd3 == true)
- {
- _proccessor.WD3();
- workingDay3.isOn = true;
- _working_day3.gameObject.SetActive(true);
- }
- if (_wd4 == true)
- {
- _proccessor.WD4();
- workingDay4.isOn = true;
- _working_day4.gameObject.SetActive(true);
- }
- if (_ed1 == true)
- {
- _proccessor.ED1();
- educationalDay1.isOn = true;
- _educational_day1.gameObject.SetActive(true);
- }
- if (_ed2 == true)
- {
- _proccessor.ED2();
- educationalDay2.isOn = true;
- _educational_day2.gameObject.SetActive(true);
- }
- if (_ed3 == true)
- {
- _proccessor.ED3();
- educationalDay3.isOn = true;
- _educational_day3.gameObject.SetActive(true);
- }
- if (_ed4 == true)
- {
- _proccessor.ED4();
- educationalDay4.isOn = true;
- _educational_day4.gameObject.SetActive(true);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement