Beispiel #1
0
 public Hotfix_LT.Data.ActivityTime GetActivityStopTimeByActivityID(int actID)
 {
     // 如果是全天的活动是没有结束时间的,这里返回的是null
     Hotfix_LT.Data.ActivityTime actTime = null;
     mActivityStopTime.TryGetValue(actID, out actTime);
     return(actTime);
 }
Beispiel #2
0
 public Hotfix_LT.Data.ActivityTime GetActivityOpenTimeByActivityID(int actID)
 {
     // 如果是全天的活动只有开始时间
     Hotfix_LT.Data.ActivityTime actTime = null;
     mActivityOpenTime.TryGetValue(actID, out actTime);
     return(actTime);
 }
Beispiel #3
0
        private void InitOtherData(Hotfix_LT.Data.ActivityTime openTime, Hotfix_LT.Data.ActivityTime stopTime, LTDailyData data)
        {
            int nowTimestamp = EB.Time.Now;
            int stopD        = Hotfix_LT.Data.ZoneTimeDiff.GetTime(stopTime);

            if (nowTimestamp > stopD)
            {
                string[] strHours     = openTime.hourStr.Split(',');
                string[] strHourStops = stopTime.hourStr.Split(',');
                if (strHours.Length < 2 || strHourStops.Length < 2)
                {
                    return;
                }
                openTime.hour = int.Parse(strHours[1]);
                stopTime.hour = int.Parse(strHourStops[1]);

                string[] strMinutes = openTime.minuteStr.Split(',');
                if (strMinutes.Length > 1)
                {
                    openTime.minute = int.Parse(strMinutes[1]);
                }

                string[] strMinuteStops = stopTime.minuteStr.Split(',');
                if (strMinuteStops.Length > 1)
                {
                    stopTime.minute = int.Parse(strMinuteStops[1]);
                }
            }
            else
            {
                ILRTimerManager.instance.AddTimer((stopD - TimeNow - 1) * 1000, 1, (int i) =>
                {
                    string[] strHours     = openTime.hourStr.Split(',');
                    string[] strHourStops = stopTime.hourStr.Split(',');
                    if (strHours.Length < 2 || strHourStops.Length < 2)
                    {
                        return;
                    }
                    openTime.hour = int.Parse(strHours[1]);
                    stopTime.hour = int.Parse(strHourStops[1]);

                    string[] strMinutes = openTime.minuteStr.Split(',');
                    if (strMinutes.Length > 1)
                    {
                        openTime.minute = int.Parse(strMinutes[1]);
                    }

                    string[] strMinuteStops = stopTime.minuteStr.Split(',');
                    if (strMinuteStops.Length > 1)
                    {
                        stopTime.minute = int.Parse(strMinuteStops[1]);
                    }

                    SetDailyData(data, false);
                });
            }
        }
Beispiel #4
0
        private void SetDailyData(LTDailyData data, bool isInitOther = true)
        {
            Hotfix_LT.Data.ActivityTime openTime = GetActivityOpenTimeByActivityID(data.ActivityData.id);
            Hotfix_LT.Data.ActivityTime stopTime = GetActivityStopTimeByActivityID(data.ActivityData.id);

            if (doubleTimeActIDList.Contains(data.ActivityData.id) && isInitOther)
            {
                //天梯数据需要特殊处理,因为有双时段
                InitOtherData(openTime, stopTime, data);
            }

            data.DailyType    = data.ActivityData.showType == 1 ? EDailyType.Limit : EDailyType.AllDay;
            data.OpenTimeWeek = openTime == null ? "*" : openTime.weekStr;
            System.DateTime startD = new System.DateTime();
            System.DateTime stopD  = new System.DateTime();

            if (openTime != null && stopTime != null && openTime.hour >= 0 && stopTime.hour >= 0)
            {
                startD             = Hotfix_LT.Data.ZoneTimeDiff.GetDateTime(openTime);
                data.OpenTimeValue = EB.Time.ToPosixTime(startD.ToUniversalTime());
                stopD = Hotfix_LT.Data.ZoneTimeDiff.GetDateTime(stopTime);
                data.StopTimeValue = EB.Time.ToPosixTime(stopD.ToUniversalTime());
            }

            StringBuilder str = new StringBuilder("");

            if (data.OpenTimeWeek.Contains("*"))
            {
                str.Append(EB.Localizer.GetString("ID_EVERYDAY"));
            }
            else if (!string.IsNullOrEmpty(data.OpenTimeWeek))
            {
                str = str.Append(EB.Localizer.GetString("ID_codefont_in_EventTemplateManager_43848") + " ");
                string[] strs = data.OpenTimeWeek.Split(',');
                for (int i = 0; i < strs.Length; i++)
                {
                    str.Append(EB.Localizer.GetString(Hotfix_LT.Data.EventTemplateManager.NumText[int.Parse(strs[i])]));
                    if (i < strs.Length - 1)
                    {
                        str.Append(",");
                    }
                }
            }

            if (stopTime == null || openTime == null || openTime.hour < 0 || stopTime.hour < 0)
            {
                str.Append(EB.Localizer.GetString("ID_codefont_in_LTDailyDataManager_6581"));
            }
            else
            {
                str.Append(string.Format(" {0:t}-{1:t}", startD, stopD));
            }

            data.OpenTimeStr = str.ToString();
        }
Beispiel #5
0
        private Hotfix_LT.Data.ActivityTime GetActivityTime(Hashtable table)
        {
            Hotfix_LT.Data.ActivityTime actTime = new Hotfix_LT.Data.ActivityTime();
            actTime.monthStr  = EB.Dot.String("month", table, "");
            actTime.weekStr   = EB.Dot.String("dayOfWeek", table, "");
            actTime.dayStr    = EB.Dot.String("dayOfMonth", table, "");
            actTime.hourStr   = EB.Dot.String("hour", table, "");
            actTime.minuteStr = EB.Dot.String("minute", table, "");
            actTime.secondStr = EB.Dot.String("second", table, "");

            actTime.month  = GetIntValue(actTime.monthStr);
            actTime.day    = GetIntValue(actTime.dayStr);
            actTime.hour   = GetIntValue(actTime.hourStr);
            actTime.minute = GetIntValue(actTime.minuteStr);
            actTime.second = GetIntValue(actTime.secondStr);

            return(actTime);
        }
Beispiel #6
0
        /// <summary>
        /// 是否可以领取当前时段体力
        /// </summary>
        /// <returns></returns>
        public bool IsCouldReceiveVit(bool isRefreshPR = false)
        {
            if (mDailyData == null)
            {
                if (isRefreshPR)
                {
                    LTRedPointSystem.Instance.SetRedPointNodeNum(RedPointConst.limitact, 0);
                }
                return(false);
            }

            if (vitDailyData == null)
            {
                for (int i = 0; i < mDailyData.Count; i++)
                {
                    if (mDailyData[i].ActivityData != null && mDailyData[i].ActivityData.id == 9013)
                    {
                        vitDailyData = mDailyData[i];
                    }
                }
            }

            if (vitDailyData == null)
            {
                EB.Debug.LogError("LTDailyDataManager IsCouldReceiveVit vitDailyData is Null, Error!!!");
                if (isRefreshPR)
                {
                    LTRedPointSystem.Instance.SetRedPointNodeNum(RedPointConst.limitact, 0);
                }
                return(false);
            }

            Hotfix_LT.Data.ActivityTime openTime = GetActivityOpenTimeByActivityID(9013);

            if (openTime == null || openTime.hourStr.IndexOf(openTime.hour.ToString()) < 0)
            {
                if (isRefreshPR)
                {
                    LTRedPointSystem.Instance.SetRedPointNodeNum(RedPointConst.limitact, 0);
                }
                return(false);
            }

            bool isCouldGet = false;

            if (openTime.hourStr.IndexOf(openTime.hour.ToString()) == 0)
            {
                isCouldGet = false;
                DataLookupsCache.Instance.SearchDataByID("user_prize_data.daily_login.is_draw_daily_vigor1", out isCouldGet);
            }
            else
            {
                isCouldGet = false;
                DataLookupsCache.Instance.SearchDataByID("user_prize_data.daily_login.is_draw_daily_vigor2", out isCouldGet);
            }

            isCouldGet = !isCouldGet && (vitDailyData.OpenTimeValue <TimeNow && vitDailyData.StopTimeValue> TimeNow);
            if (isRefreshPR)
            {
                LTRedPointSystem.Instance.SetRedPointNodeNum(RedPointConst.limitact, isCouldGet ? 1 : 0);
            }
            return(isCouldGet);
        }