// Start is called before the first frame update void Start() { tableList = new List <GameObject>(); vacaList = new List <TempVacation>(); RestClient.Get <accRejVacations>("https://fir-unity-6f472.firebaseio.com/accRejVacations/.json").Then(response2 => { accRejVacations ar2 = new accRejVacations(); ar2 = response2; string[] acomp = ar2.accepted.Split('&'); for (int i = 1; i < acomp.Length; i++) { string[] acompsplit = acomp[i].Split(';'); DateTime baseDate = new DateTime(2020, 1, 1); string formatString = "yyyy##MM##dd"; DateTime deprt = new DateTime(); DateTime arv = new DateTime(); deprt = DateTime.ParseExact(acompsplit[1], formatString, null); arv = DateTime.ParseExact(acompsplit[2], formatString, null); startDate = deprt; endDate = arv; Debug.Log("++" + acompsplit[0]); //DateTime randDepartDate = baseDate.AddDays(UnityEngine.Random.Range(0, 360)); //DateTime randDepartDate = new DateTime(2020, month, day); /* int randPeriod = UnityEngine.Random.Range(3, 6); * DateTime randArriveDate = randDepartDate.AddDays(randPeriod); * int vacaKind = UnityEngine.Random.Range(0, 2); */ vacaList.Add(new TempVacation(acompsplit[0], UnityEngine.Random.Range(0, 2), deprt, arv, 0, "vacaname")); } //yield on a new YieldInstruction that waits for 5 seconds. DateSet(24); }); /*do * { * dm = DataManager.dm; * //yield return new WaitForSeconds(5); * } while (DataManager.dm == null);//get Data*/ }
void Start() { SoldierScreen4Tables = new List <GameObject>(); do { sdm = SoldierDataManager.sdm; } while (sdm == null); RestClient.Get <accRejVacations>("https://fir-unity-6f472.firebaseio.com/accRejVacations/.json").Then(response => { accRejVacations ar2 = new accRejVacations(); ar2 = response; string[] acomp = ar2.accepted.Split('&'); for (int i = 1; i < acomp.Length; i++) { string[] acompsplit = acomp[i].Split(';'); DateTime baseDate = new DateTime(2020, 1, 1); string formatString = "yyyy##MM##dd"; DateTime deprt = new DateTime(); DateTime arv = new DateTime(); deprt = DateTime.ParseExact(acompsplit[1], formatString, null); arv = DateTime.ParseExact(acompsplit[2], formatString, null); Debug.Log("++" + acompsplit[0]); sdm.vacaList.Add(new TempVacation(acompsplit[0], UnityEngine.Random.Range(0, 2), deprt, arv, 2, "General")); } Refresh(); }); }
public void acceptClick() { Debug.Log("-" + vacation_buttons_Select[0]); RestClient.Get <vacapply>("https://fir-unity-6f472.firebaseio.com/vacapply.json").Then(response => { vacapply v2 = new vacapply(); v2 = response; string[] peopleAr = v2.people.Split(','); string[] departAr = v2.depart.Split(','); string[] arriveAr = v2.arrive.Split(','); string[] vackindAr = v2.vackind.Split(','); string[] vacapplykindAr = v2.vacapplykind.Split(','); string peoplestr = "", depstr = "", arrstr = "", vk = "", vak = ""; string Rpeoplestr = "", Rdepstr = "", Rarrstr = ""; string acceptedstr = ""; for (int i = 0; i < peopleAr.Length; i++) { if (vacation_buttons_Select[i]) { acceptedstr = acceptedstr + "&" + peopleAr[i] + ";" + departAr[i] + ";" + arriveAr[i]; //Debug.Log(vacation_buttons[i]); deleteSelectedButton(); Debug.Log(acceptedstr); // Destroy(vacation_buttons[i]); } //if you run the below code then it will delete from the server just try to figure out how to delete from UI if (!vacation_buttons_Select[i]) { peoplestr = peoplestr + peopleAr[i] + ","; depstr = depstr + departAr[i] + ","; arrstr = arrstr + arriveAr[i] + ","; vk = vk + vackindAr[i] + ","; vak = vak + vacapplykindAr[i] + ","; } Debug.Log(acceptedstr); } /**/ Debug.Log("-0-" + peoplestr); RestClient.Get <accRejVacations>("https://fir-unity-6f472.firebaseio.com/accRejVacations/.json").Then(response2 => { accRejVacations ar2 = new accRejVacations(); ar2 = response2; Debug.Log(acceptedstr); accvac = ar2.accepted + acceptedstr; Debug.Log(accvac); accRejVacations ar = new accRejVacations(); RestClient.Put("https://fir-unity-6f472.firebaseio.com/accRejVacations/.json", ar); vacapply v3 = new vacapply(); v3.people = peoplestr; v3.depart = depstr; v3.arrive = arrstr; v3.vacapplykind = vak; v3.vackind = vk; RestClient.Put("https://fir-unity-6f472.firebaseio.com/vacapply.json", v3); }); }); }