コード例 #1
0
    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;
                }
            }
        }
    }
コード例 #2
0
    private void ResetDateToggle(GameObject dateTabGO, DateTime dateTime)
    {
        DateToggle dateToggle = ReturnComponent <DateToggle>(dateTabGO);

        dateToggle.memoDateTime = dateTime;
        if (!dateTabGO.activeSelf)
        {
            dateTabGO.SetActive(true);
        }
    }
コード例 #3
0
    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);
    }