public void LoadDateToggle() { DateTime[] dateTimes = Backpack.GetSortKeys(); if (dateTimes == null || dateTimes.Length <= 0) { return; } LoadButtons(ref currentDateToggleGOs, dateTimes, CreateDateToggle, ResetDateToggle); if (currentDisplayDateTime == DateTime.MinValue) { currentDateToggleGOs[0].GetComponent <DateToggle>().OnPointerClick(new PointerEventData(EventSystem.current)); } else { foreach (GameObject tempDateToggleGO in currentDateToggleGOs) { DateToggle dateToggle = tempDateToggleGO.GetComponent <DateToggle>(); if (dateToggle.memoDateTime == currentDisplayDateTime) { dateToggle.OnPointerClick(new PointerEventData(EventSystem.current)); break; } else { dateToggle.isOn = false; } } } }
private void ResetDateToggle(GameObject dateTabGO, DateTime dateTime) { DateToggle dateToggle = ReturnComponent <DateToggle>(dateTabGO); dateToggle.memoDateTime = dateTime; if (!dateTabGO.activeSelf) { dateTabGO.SetActive(true); } }
private GameObject CreateDateToggle(DateTime dateTime) { GameObject ins = Instantiate(dateTogglePrefab, dateTabGridTrans); DateToggle dateToggle = ReturnComponent <DateToggle>(ins); dateToggle.group = dateToggleGroup; dateToggle.memoDateTime = dateTime; dateToggle.onValueChanged.AddListener((bool isOn) => { //if (!isOn) //{ // MarkDisplayDateTime(); // LoadItemIconButton(); //} MarkDisplayDateTime(); LoadItemIconButton(); }); return(ins); }