From 4c6d58af44cd4235501e15a78bf79674ba2fcc4a Mon Sep 17 00:00:00 2001
From: client_Zxw <826696702@qq.com>
Date: 星期二, 15 一月 2019 10:41:31 +0800
Subject: [PATCH] Merge branch 'master' into GrowthFund

---
 System/OpenServerActivity/OpenServiceAchievementModel.cs |  122 ++++++++++++++++++++++++++++++++++------
 1 files changed, 102 insertions(+), 20 deletions(-)

diff --git a/System/OpenServerActivity/OpenServiceAchievementModel.cs b/System/OpenServerActivity/OpenServiceAchievementModel.cs
index e74e491..d28b3b1 100644
--- a/System/OpenServerActivity/OpenServiceAchievementModel.cs
+++ b/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;
+    }
 }
 
 

--
Gitblit v1.8.0