Example #1
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();
        }
Example #2
0
 private bool IsDailyDataCouldPlay(LTDailyData data)
 {
     if ((data.OpenTimeValue != 0 && data.StopTimeValue != 0) && (data.OpenTimeValue > TimeNow || data.StopTimeValue < TimeNow))
     {
         return(false);
     }
     else if (GetActivityCount(data.ActivityData.id) <= 0)
     {
         return(false);
     }
     return(true);
 }
Example #3
0
        public void InitDaiylData()
        {
            mDailyData   = new List <LTDailyData>();
            vitDailyData = null;
            var datas = Hotfix_LT.Data.EventTemplateManager.Instance.GetAllSpecActData();

            for (int i = 0; i < datas.Count; i++)
            {
                mDailyData.Add(new LTDailyData());
                mDailyData[i].ActivityData = datas[i];
                SetDailyData(mDailyData[i]);
            }
        }
Example #4
0
        public void OnDailyItemClick(LTDailyCell cell)
        {
            if (curDailyCell != null)
            {
                if (curDailyCell == cell)
                {
                    return;
                }
                curDailyData.IsSelected = false;
                curDailyCell.SetSelectStatus(false);
            }
            curDailyCell            = cell;
            curDailyData            = cell.GetDailyData();
            curDailyData.IsSelected = true;
            curDailyCell.SetSelectStatus(true);

            curActData = curDailyData.ActivityData;
            InitBase();
        }
Example #5
0
        private void InitCurData()
        {
            if (curDailyType == EDailyType.Limit && mDailyLimitData.Count > 0)
            {
                curDailyData = mDailyLimitData[0];
                controller.GObjects["RightContent"].CustomSetActive(true);
            }
            else if (curDailyType == EDailyType.AllDay && mDailyAllDayData.Count > 0)
            {
                if (curFuncGuideId != 0)
                {
                    LTDailyData curData = mDailyAllDayData[0];
                    for (int i = 0; i < mDailyAllDayData.Count; i++)
                    {
                        if (mDailyAllDayData[i].ActivityData.id == curFuncGuideId)
                        {
                            curData = mDailyAllDayData[i];
                            break;
                        }
                    }
                    curDailyData = curData;
                    titleCon.SetTitleBtn(1);
                }
                else
                {
                    curDailyData = mDailyAllDayData[0];
                }
                controller.GObjects["RightContent"].CustomSetActive(true);
            }
            else
            {
                controller.GObjects["RightContent"].CustomSetActive(false);
                return;
            }

            curActData = curDailyData.ActivityData;
            curDailyData.IsSelected = true;
        }
Example #6
0
        public bool GetDailyShowIconData(out LTDailyData curdata)
        {
            bool hasCurdata = false;

            CurChoseData = null;

            List <LTDailyData> tempdata = GetDailyDataByDailyType(EDailyType.Limit);

            if (tempdata != null && tempdata.Count > 0)
            {
                if (IsDailyDataCouldPlay(tempdata[0]))
                {
                    CurChoseData = tempdata[0];
                    hasCurdata   = true;
                    curdata      = CurChoseData;
                }
            }
            tempdata = GetDailyDataByDailyType(EDailyType.AllDay);
            if (!hasCurdata)
            {
                if (tempdata.Count > 0 && IsDailyDataCouldPlay(tempdata[0]))
                {
                    CurChoseData = tempdata[0];
                    hasCurdata   = true;
                    curdata      = CurChoseData;
                    return(hasCurdata);
                }
                else
                {
                    curdata = null;
                    return(hasCurdata);
                }
            }
            curdata = CurChoseData;
            return(hasCurdata);
        }
Example #7
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);
        }
Example #8
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);
                });
            }
        }
Example #9
0
        public int GetActivityCount(int activityID)//仅用于活动是否需要提示以及日常界面显示,部分活动次数不准确
        {
            Hotfix_LT.Data.SpecialActivityTemplate curAct = Hotfix_LT.Data.EventTemplateManager.Instance.GetSpecialActivity(activityID);

            if (curAct == null)
            {
                return(0);
            }

            if (activityID == 9001 || activityID == 9002 || activityID == 9007)
            {
                //经验副本,金币副本,夺宝奇兵
                int    times = 0;
                string path  = string.Format("special_activity.{0}.c_times", activityID);
                DataLookupsCache.Instance.SearchDataByID(path, out times);
                return(curAct.times - times);
            }
            else if (activityID == 9003)
            {
                DataLookupsCache.Instance.SearchDataByID("world_boss.fightTimes", out int ChallengeTime);
                DataLookupsCache.Instance.SearchDataByID("world_boss.buyTimes", out int BuyTimes);
                int Maxtime = (int)Hotfix_LT.Data.NewGameConfigTemplateManager.Instance.GetGameConfigValue("worldBossChallengeMaxTimes");
                return(Maxtime + BuyTimes - ChallengeTime);
            }
            else if (activityID == 9004)
            {//军团战
                //EB.Debug.LogError("军团战数据获取");
                if (!LTLegionWarManager.Instance.IsOpenWarTime())
                {
                    return(0);
                }
                LegionWarTimeLine status = LTLegionWarManager.GetLegionWarStatus();
                if (status == LegionWarTimeLine.QualifyGame)
                {
                    if (!AllianceUtil.IsJoinedAlliance)
                    {
                        return(1);
                    }
                    int myScore = LTLegionWarManager.Instance.QualifyEnemyList.MyScore;
                    return(myScore >= LTLegionWarManager.Instance.MaxScore ? 0 : 1);
                }
                else if (status == LegionWarTimeLine.SemiFinal)
                {
                    return(1);
                }
                else if (status == LegionWarTimeLine.Final)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
            else if (activityID == 9005)
            {
                //军团护送
                if (AlliancesManager.Instance.Account.State != eAllianceState.Joined)
                {
                    return(curAct.times + GetVIPAdditionTimes(activityID));
                }
                return(AllianceEscortUtil.GetResidueTransferDartNum());
            }
            else if (activityID == 9006)
            {
                //军团拦截
                if (AlliancesManager.Instance.Account.State != eAllianceState.Joined)
                {
                    return(curAct.times + GetVIPAdditionTimes(activityID));
                }
                return(AllianceEscortUtil.GetResidueRobDartNum());
            }
            else if (activityID == 9009)
            {
                //极限试炼
                int dayDisCountTime = 0;
                int oldVigor        = 0;
                int NewVigor        = 0;
                int times           = LTUltimateTrialDataManager.Instance.GetCurrencyTimes();
                NewGameConfigTemplateManager.Instance.GetEnterVigor(eBattleType.InfiniteChallenge, out dayDisCountTime, out NewVigor, out oldVigor);
                int curDisCountTime = dayDisCountTime - times;
                return(Mathf.Max(0, curDisCountTime));
                //if (!DataLookupsCache.Instance.SearchIntByID("infiniteChallenge.info.challengeTimes", out times))
                //{
                //    times = curAct.times;
                //}
                //return Mathf.Max(0, times + GetVIPAdditionTimes(activityID));
            }
            else if (activityID == 9010)
            {//天梯
                LTDailyData tempdailydata = GetDailyDataByActivityID(9010);
                if (tempdailydata == null)
                {
                    return(0);
                }
                else
                {
                    return(tempdailydata.OpenTimeValue < LTDailyDataManager.TimeNow && tempdailydata.StopTimeValue > LTDailyDataManager.TimeNow ? 1 : 0);
                }
            }
            else if (activityID == 9011)
            {//英雄交锋
                //今天赢了或者达到最大胜场 0 就不显示红点
                return(LTNewHeroBattleManager.GetInstance().GetHeroBattleTipNum());
            }
            else if (activityID == 9013)
            {
                return(IsCouldReceiveVit()?1:0);
            }
            else if (activityID == 9014)
            {
                //幸运悬赏
                int times = LTBountyTaskHudController.CurHantTimes;
                return(times);
            }
            else if (activityID == 9015)
            {
                //角斗场
                int totalTimes = VIPTemplateManager.Instance.GetTotalNum(VIPPrivilegeKey.ArenaTimes) + ArenaManager.Instance.Info.buyTimes;
                int times      = Mathf.Max(0, totalTimes - ArenaManager.Instance.Info.usedTimes);
                return(times);
            }
            else if (activityID == 9016)
            {
                //荣耀角斗场
                int freetimes = HonorArenaManager.Instance.GetHonorArenaFreeTimes();
                int usetimes  = HonorArenaManager.Instance.Info.usedTimes;
                return(freetimes - usetimes);
            }
            return(0);
        }