public override void OnMessage(Message message) { string name = message.Name; object[] body = message.Params; switch (name) { case MessageConst.CMD_LOVEDIARY_PREVIOUS_MONTH: Debug.Log("CMD_LOVEDIARY_PREVIOUS_MONTH"); GetNewMonthData(MonthState.Previous); break; case MessageConst.CMD_LOVEDIARY_NEXT_MONTH: Debug.Log("CMD_LOVEDIARY_NEXT_MONTH"); GetNewMonthData(MonthState.Next); break; case MessageConst.CMD_LOVEDIARY_CALENDAR_SELECT: Debug.Log("CMD_LOVEDIARY_CALENDAR_SELECT"); DateTime Dt = (DateTime)body[0]; if (DateUtil.CheckIsToday(Dt) == 1) { PopupManager.ShowAlertWindow(I18NManager.Get("LoveDiary_Hint8"), I18NManager.Get("Common_Hint"), I18NManager.Get("Common_Know")); return; } if (DateUtil.CompareToday(GetData <LoveDiaryModel>().UnlockDt, Dt) == 1) { PopupManager.ShowAlertWindow(I18NManager.Get("LoveDiary_Hint9"), I18NManager.Get("Common_Hint"), I18NManager.Get("Common_Know")); return; } SelctCalender(Dt); break; } }
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); } }