/******************检测是否有未领取的每日月卡奖励****************************/ //需要监听事件,另外和时间也有关系 // GameEventDispatcher.Inst.addEventListener(GameEventID.UI_RefreshMonthCard, OnMonthCardDataChange); /// <summary> /// 检测是否有未领取的每日月卡奖励,该逻辑还应注意事件监听和时间,存在问题 /// </summary> /// <returns></returns> public bool CheckUnclaimedMonthCard() { bool _result = false; for (int i = 0; i < m_MonthCardList.Count; i++) { MonthcardTemplate _monthCardTemp = m_MonthCardList[i]; //获取月卡持续天数 int _duration = _monthCardTemp.getDuration(); var _cardData = m_ObjectSelf.GetMontCardInfoById(_monthCardTemp.GetID()); if (_duration < 0) //永久时间 { if (_cardData == null || _cardData.istodayget != 1) { _result = true; break; } } else//限时月卡 { if (_cardData != null) { DateTime _dt = TimeUtils.ConverMillionSecToDateTime(_cardData.overtime, m_ObjectSelf.ServerTimeZone); if (_cardData.istodayget != 1 && m_ObjectSelf.ServerDateTime < _dt)//未过期; { _result = true; break; } } } } return(_result); }
void RefreshUIById(int id) { for (int i = 0; i < mItemCount; i++) { if (items[i].GetTableId() == id) { Monthcard mc = ObjectSelf.GetInstance().GetMontCardInfoById(id); //第一个特殊处理; if (id == 1) { if (mc == null) { items[i].SetMonthcardGotType(Monthcard_GotType.HaveNotGot); } else { if (mc.istodayget == 1) { items[i].SetMonthcardGotType(Monthcard_GotType.HaveAndGot); } else { items[i].SetMonthcardGotType(Monthcard_GotType.HaveNotGot); } } } else { if (mc == null) { items[i].SetMonthcardGotType(Monthcard_GotType.NotHave); } else { //根据当前时间判断是否过期; DateTime dt = TimeUtils.ConverMillionSecToDateTime(mc.overtime, ObjectSelf.GetInstance().ServerTimeZone); if (ObjectSelf.GetInstance().ServerDateTime >= dt)//过期; { items[i].SetMonthcardGotType(Monthcard_GotType.NotHave); } else//没过期; { if (mc.istodayget == 1)//已经领取; { items[i].SetMonthcardGotType(Monthcard_GotType.HaveAndGot); } else { items[i].SetMonthcardGotType(Monthcard_GotType.HaveNotGot); } } } } } } }
public static TimeSpan GetMonthCardToEnd(int monthCardId) { Monthcard mc = ObjectSelf.GetInstance().GetMontCardInfoById(monthCardId); if (mc == null) { return(TimeSpan.Zero); } DateTime dt = TimeUtils.ConverMillionSecToDateTime(mc.overtime, ObjectSelf.GetInstance().ServerTimeZone); return(dt - ObjectSelf.GetInstance().ServerDateTime); }
public static TimeSpan GetTaskTimeToEnd(tanxianinit data) { DateTime endTime = TimeUtils.ConverMillionSecToDateTime(data.endtime, ObjectSelf.GetInstance().ServerTimeZone); return(TimeUtils.GetTimeSpan(endTime, ObjectSelf.GetInstance().ServerDateTime)); }
public void SetEmailDate(MailData mail) { m_Mail = mail; if (mail.m_isopen.ToString().Length == 1) { _isOpen = int.Parse(mail.m_isopen.ToString()); if (_isOpen == 0)//没有被查看 { ReceiveText.gameObject.SetActive(true); CloseImage.SetActive(true); OpenImage.SetActive(false); } else { CloseImage.SetActive(false); OpenImage.SetActive(true); ReceiveText.gameObject.SetActive(true); } } if (mail.m_isopen.ToString().Length >= 2) { _isOpen = int.Parse(mail.m_isopen.ToString().Substring(1, 1)); //是否打开过 0否 1是 _isReceive = int.Parse(mail.m_isopen.ToString().Substring(0, 1)); //是否领取 0否 1是 if (_isOpen == 0) //没有被查看 { CloseImage.SetActive(true); OpenImage.SetActive(false); } else { CloseImage.SetActive(false); OpenImage.SetActive(true); } if (_isReceive == 1) { ReceiveText.gameObject.SetActive(false); } else { ReceiveText.gameObject.SetActive(true); } } if (mail.m_title.Length > 12) { TitleText.text = GameUtils.getString(mail.m_title).Substring(0, 6) + "......"; } else { TitleText.text = GameUtils.getString(mail.m_title).ToString(); } if (mail.m_sender != null) { SenderText.text = GameUtils.getString(mail.m_sender); } DateTime dateTime = TimeUtils.ConverMillionSecToDateTime(mail.m_endtime, ObjectSelf.GetInstance().ServerTimeZone); TimeSpan ts = TimeUtils.GetTimeSpan(ObjectSelf.GetInstance().ServerDateTime, dateTime); if (ts.TotalSeconds < (double)60) { TimeText.text = GameUtils.getString("mail_content21").Replace("{0}", ""); } else if (ts.TotalSeconds > (double)60 && ts.TotalSeconds < (double)3600) { TimeText.text = Mathf.FloorToInt((float)ts.TotalSeconds / 60).ToString() + GameUtils.getString("mail_content20").Replace("{0}", ""); } else if (ts.TotalSeconds > (double)3600 && ts.TotalSeconds < (double)86400) { TimeText.text = Mathf.FloorToInt((float)ts.TotalSeconds / 3600).ToString() + GameUtils.getString("mail_content19").Replace("{0}", ""); } else if (ts.TotalSeconds > (double)86400 && ts.TotalSeconds < (double)604800) { TimeText.text = Mathf.FloorToInt((float)ts.TotalSeconds / 86400).ToString() + GameUtils.getString("mail_content18").Replace("{0}", ""); } }