少年修仙传客户端代码仓库
client_Zxw
2019-01-15 4c6d58af44cd4235501e15a78bf79674ba2fcc4a
System/OpenServerActivity/OpenServiceAchievementModel.cs
@@ -70,7 +70,11 @@
    public Redpoint redPointStre1 = new Redpoint(214, Redpoint_key1);
    private int _SelectedNow = 0;
    private int ResetType = 0;// 重置类型,0-0点重置;1-5点重置
    public event Action IsOpenEvent;
    private int AdvanceMinutes = 0;//提前显示分钟
    private bool isPreviewTime = false;
    private bool isOpenNow = false;
    public event Action IsOpenEvent;//功能是否开启
    public event Action IsPreviewTimeUpdate;//功能是否提前开启
    private int _JumpIndex = -1;//跳转选中值
    public int JumpIndex
    {
@@ -105,17 +109,36 @@
    public void OnBeforePlayerDataInitialize()
    {
        WeekPartyDayInfoDic.Clear();
        WeekPartyDayDic.Clear();
        WeekPartyActionDic.Clear();
        isOpenNow = false;
        isPreviewTime = false;
    }
    public void OnPlayerLoginOk()
    {
        GlobalTimeEvent.Instance.secondEvent -= secondEvent;
        GlobalTimeEvent.Instance.secondEvent += secondEvent;
        SetRedPoint();
    }
    private void secondEvent()
    {
        bool _bool = IsPreviewTime();
        if (_bool && !isPreviewTime)
        {
            isPreviewTime = true;
            _IsOpen = true;
            if (IsPreviewTimeUpdate != null)
            {
                IsPreviewTimeUpdate();
            }
        }
        GetIsOpen();//判断功能是否开启
        GetDayNow();
    }
    public override void UnInit()
@@ -132,22 +155,38 @@
            WeekPartyDayInfo.DayIndex = (int)DayInfo.DayIndex;
            WeekPartyDayInfo.Point = (int)DayInfo.Point;
            WeekPartyDayInfo.AwardRecord = (int)DayInfo.AwardRecord;
            WeekPartyDayInfo.ActionType = new ActionTypeClass[DayInfo.ACount];
            for (int k = 0; k < DayInfo.ACount; k++)
            {
                var Task = DayInfo.TaskList[k];
                ActionTypeClass ActionType = new ActionTypeClass();
                ActionType.TemplateID = Task.TemplateID;
                ActionType.CurTimes = Task.CurTimes;
                ActionType.GotTimes = Task.GotTimes;
                WeekPartyDayInfo.ActionType[k] = ActionType;
            }
            if (WeekPartyDayInfoDic.ContainsKey((int)DayInfo.DayIndex))
            {
                WeekPartyDayInfoDic[(int)DayInfo.DayIndex] = WeekPartyDayInfo;
                var dit = WeekPartyDayInfoDic[(int)DayInfo.DayIndex];
                dit.DayIndex= (int)DayInfo.DayIndex;
                dit.Point = (int)DayInfo.Point;
                dit.AwardRecord= (int)DayInfo.AwardRecord;
                for (int j = 0; j < dit.ActionType.Length; j++)
                {
                    if (dit.ActionType[j].TemplateID == DayInfo.TaskList[0].TemplateID)
                    {
                        ActionTypeClass ActionType = new ActionTypeClass();
                        ActionType.TemplateID = DayInfo.TaskList[0].TemplateID;
                        ActionType.CurTimes = DayInfo.TaskList[0].CurTimes;
                        ActionType.GotTimes = DayInfo.TaskList[0].GotTimes;
                        dit.ActionType[j] = ActionType;
                    }
                }
                WeekPartyDayInfoDic[(int)DayInfo.DayIndex] = dit;
            }
            else
            {
                WeekPartyDayInfo.ActionType = new ActionTypeClass[DayInfo.ACount];
                for (int k = 0; k < DayInfo.ACount; k++)
                {
                    var Task = DayInfo.TaskList[k];
                    ActionTypeClass ActionType = new ActionTypeClass();
                    ActionType.TemplateID = Task.TemplateID;
                    ActionType.CurTimes = Task.CurTimes;
                    ActionType.GotTimes = Task.GotTimes;
                    WeekPartyDayInfo.ActionType[k] = ActionType;
                }
                WeekPartyDayInfoDic.Add((int)DayInfo.DayIndex, WeekPartyDayInfo);
            }
        }
@@ -183,7 +222,7 @@
            TimeDayBeginAndOver[1] = TimeDay;
        }
        LimitLV = info.LimitLV;
        AdvanceMinutes = info.AdvanceMinutes;
        for (int i = 0; i < info.DayCnt; i++)
        {
            int Index = i;
@@ -254,7 +293,7 @@
    }
    public int GetRewardNumber(int Day, int ID)//获取领奖次数
    {
        int Num = -1;
        int Num =0;
        if (WeekPartyDayInfoDic.ContainsKey(Day))
        {
            var WeekPartyDay = WeekPartyDayInfoDic[Day];
@@ -320,8 +359,20 @@
        DateTime time2 = new DateTime(TimeUtility.ServerNow.Year, TimeUtility.ServerNow.Month, TimeUtility.ServerNow.Day, TimeUtility.ServerNow.Hour, TimeUtility.ServerNow.Minute, TimeUtility.ServerNow.Second);
        TimeSpan ts = time2.Subtract(time1);
        Day = (int)ts.TotalDays;
        DebugEx.LogError("输出当前的天数" + Day);
        DayNow = Day;
        if (Day <= 0)
        {
            Day = 0;
        }
       // DebugEx.LogError("输出当前的天数" + Day);
        if (DayNow != Day && Day<7)
        {
            DayNow = Day;
            if (WeekPartyDayInfoUpdate != null)
            {
                WeekPartyDayInfoUpdate();
            }
        }
    }
    public void SendGetWeekParty(int day, int temdayplateID)//领取周狂欢活动奖励
@@ -411,7 +462,7 @@
            bool IsBool = IsDayReward(day, type);
            if (point >= item.NeedPoint && !IsBool)
            {
                return RedPointState.Simple;
                return RedPointState.GetReward;
            }
        }
        for (int i = 0; i < WeekPartyDay.TemplateList.Length; i++)
@@ -430,7 +481,7 @@
                }
                if (TaypeNumber > 0 && rewardNum< number)
                {
                    return RedPointState.Simple;
                    return RedPointState.GetReward;
                }
            }
        }
@@ -496,8 +547,9 @@
        DateTime timeEnd = new DateTime(time2.Year, time2.Month, time2.Day, hour, 0, 0);
        DateTime timeNow= new DateTime(TimeUtility.ServerNow.Year, TimeUtility.ServerNow.Month, TimeUtility.ServerNow.Day, TimeUtility.ServerNow.Hour, TimeUtility.ServerNow.Minute, TimeUtility.ServerNow.Second);
        int PlayerLv = PlayerDatas.Instance.baseData.LV;
        if (PlayerLv >= LimitLV && timeNow >= timeStar && timeNow < timeEnd && !_IsOpen)
        if (PlayerLv >= LimitLV && timeNow >= timeStar && timeNow < timeEnd && !isOpenNow)
        {
            isOpenNow = true;
            _IsOpen = true;
            if (IsOpenEvent != null)
            {
@@ -505,8 +557,9 @@
            }
        }
        if (timeNow > timeEnd && _IsOpen)
        if (timeNow > timeEnd && isOpenNow)
        {
            isOpenNow = false;
            _IsOpen = false;
            if (IsOpenEvent != null)
            {
@@ -537,6 +590,35 @@
        }
        return Isbool;
    }
    public bool IsPreviewTime()//是否再预览时间
    {
        bool _bool = false;
        var time1 = TimeDayBeginAndOver[0];
        var time2 = TimeDayBeginAndOver[1];
        if (TimeDayBeginAndOver.Length <= 0 || time1 == null || time2 == null)
        {
            return _bool;
        }
        int hour = 0;
        if (ResetType == 0)
        {
            hour = 0;
        }
        else
        {
            hour = 5;
        }
        DateTime timeStar = new DateTime(time1.Year, time1.Month, time1.Day, hour, 0, 0);
        var TimeStar2 = timeStar.AddMinutes(-AdvanceMinutes);
        DateTime timeNow = new DateTime(TimeUtility.ServerNow.Year, TimeUtility.ServerNow.Month, TimeUtility.ServerNow.Day, TimeUtility.ServerNow.Hour, TimeUtility.ServerNow.Minute, TimeUtility.ServerNow.Second);
        if (timeNow >= TimeStar2 && timeNow < timeStar)
        {
            _bool = true;
        }
        return _bool;
    }
}