Beispiel #1
0
    private void OnMyDiaryStateHandler(MyDiaryStateRes res)
    {
        Debug.Log("OnMyDiaryStateHandler");
        for (int i = 0; i < res.UserDiaryDates.Count; i++)
        {
            GetData <LoveDiaryModel>().AddCalendarData(res.UserDiaryDates[i]);
        }

        DateTime unlockDt = DateUtil.GetDataTime(res.UnlockTime);

        GetData <LoveDiaryModel>().UnlockDt = unlockDt;

        DateTime dt = _requestDT;

        for (int i = 0; i < _requestDTNum; i++)
        {
            GetData <LoveDiaryModel>().AddCalendarYearMonth(dt.Year * 100 + dt.Month);
            dt = _requestDT.AddMonths(-1);
        }

        List <DateTime> dts = LoveDiaryModel.ToDays(_curDT);

        CurCalendarView.SetData(
            dts,
            GetData <LoveDiaryModel>().GetCalendarDatas(dts),
            GetData <LoveDiaryModel>().UnlockDt
            );
    }
Beispiel #2
0
    private void SetColorToggleOn(Color color)
    {
        ToggleGroup tg  = _bottom.Find("BottomSelect/Text/ColorScrollView/Viewport/Content").GetComponent <ToggleGroup>();
        int         inx = LoveDiaryModel.GetIndexByColor(TextEditColor);
        Toggle      t   = _bottom.Find("BottomSelect/Text/ColorScrollView/Viewport/Content").GetChild(inx)
                          .GetComponent <Toggle>();

        t.isOn = true;
    }
Beispiel #3
0
    public void UpdateView()
    {
        List <DateTime> dts = LoveDiaryModel.ToDays(_curDT);

        CurCalendarView.SetData(
            dts,
            GetData <LoveDiaryModel>().GetCalendarDatas(dts),
            GetData <LoveDiaryModel>().UnlockDt
            );
    }
Beispiel #4
0
    private void GetNewMonthData(MonthState state)
    {
        int addNum = state == MonthState.Previous ? -1 : 1;

        _curDT = _curDT.AddMonths(addNum);
        if (state == MonthState.Previous && !GetData <LoveDiaryModel>().CheckHasData(_curDT))
        {
            //没有数据需要拉去
            SendMyDiaryStateMsg(_curDT.AddMonths(-1));
            return;
        }
        List <DateTime> dts = LoveDiaryModel.ToDays(_curDT);

        CurCalendarView.SetData(
            dts,
            GetData <LoveDiaryModel>().GetCalendarDatas(dts),
            GetData <LoveDiaryModel>().UnlockDt
            );
    }
Beispiel #5
0
    private void UpdateView(List <DateTime> lst, List <CalendarVo> vos)
    {
        _dateTimes   = lst;
        _calendarVos = vos;
        DateTime curDt = lst[0];

        ShowTypes curShowType = curDt.Day < 8 && curDt.Day > 1 ? ShowTypes.Five : ShowTypes.Six;

        MonthState curState = curDt.Day < 8 && curDt.Day > 1 ? MonthState.Current : MonthState.Previous;

        if (curState == MonthState.Current)
        {
            SetYearAndMonth(curDt);
        }

        bool isNextFive = true;

        for (int i = 0; i < lst.Count; i++)
        {
            curDt = lst[i];

            if (curDt.Day == 1)//每月第一天
            {
                curState += 1;
                if (curState == MonthState.Current)
                {
                    SetYearAndMonth(curDt);
                }
                else if (curState == MonthState.Next)
                {
                    isNextFive = LoveDiaryModel.IsFiveLine(curDt);
                }
            }

            GameObject item = _scrollRect.content.GetChild(i).gameObject;

            if (curState == MonthState.Previous)
            {
                item.transform.Find("Contain").gameObject.Hide();
                item.GetComponent <Button>().interactable = false;
                item.transform.Find("Contain/NextMonth").gameObject.Hide();
            }
            else if (curState == MonthState.Current)
            {
                item.transform.Find("Contain").gameObject.Show();
                item.GetComponent <Button>().interactable = true;
                item.transform.Find("Contain/NextMonth").gameObject.Hide();
            }
            else if (curState == MonthState.Next)
            {
                if (isNextFive)
                {
                    item.transform.Find("Contain").gameObject.Hide();
                    item.GetComponent <Button>().interactable = false;
                    item.transform.Find("Contain/NextMonth").gameObject.Hide();
                }
                else
                {
                    item.transform.Find("Contain").gameObject.Show();
                    item.GetComponent <Button>().interactable = true;
                    item.transform.Find("Contain/NextMonth").gameObject.Show();
                }
            }
            //item.transform.Find("Contain").gameObject.Show();

            // item.GetComponent<Button>().interactable = curState == MonthState.Current;

            bool isShowHasImg = vos.Find(m => { return(m.Year == curDt.Year && m.Month == curDt.Month && m.Day == curDt.Day); }) == null;
            item.transform.Find("Contain/HasImg").gameObject.SetActive(!isShowHasImg);
            bool isToday = DateUtil.CheckIsToday(curDt) == 0;
            item.transform.Find("Contain/TodayBg").gameObject.SetActive(isToday);

            string numpath = "UIAtlas_LoveDiary_Calendar_Num" + curDt.Day.ToString();
            item.transform.Find("Contain/Num").GetComponent <Image>().sprite = AssetManager.Instance.GetSpriteAtlas(numpath);
        }
    }