| using System;  | 
| using System.Collections;  | 
| using System.Collections.Generic;  | 
| using System.Text;  | 
| using UnityEngine;  | 
|   | 
| public class OperationTimeHepler : Singleton<OperationTimeHepler>  | 
| {  | 
|     public Dictionary<Operation, OperationBase> operationDict = new Dictionary<Operation, OperationBase>();  | 
|   | 
|     public static StringBuilder textBuilder = new StringBuilder();  | 
|   | 
|     public event Action<Operation> operationTimeUpdateEvent;  | 
|     public event Action<Operation> operationServerCloseEvent;//特殊情况下触发  | 
|     public event Action<Operation, int> operationEndEvent;//活动结束时间触发  第二个参数0--过活动时间触发  1--过活动天触发  | 
|     public event Action<Operation, int> operationStartEvent;//活动开始时间并且满足开启条件触发 第二个参数0--活动时间触发  1--活动天触发  | 
|     public event Action<int> dayResetEvent;//活动重置事件0-0点 1-5点  | 
|     public event Action<Operation> operationAdvanceEvent;//活动在提前开启的时间内  | 
|   | 
|     public OperationTimeHepler()  | 
|     {  | 
|         DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerDataInitializeEvent;  | 
|         GlobalTimeEvent.Instance.secondEvent += SecondEvent;  | 
|         TimeMgr.Instance.OnHourEvent += HourEvent;  | 
|     }  | 
|   | 
|     private void BeforePlayerDataInitializeEvent()  | 
|     {  | 
|         operationDict.Clear();  | 
|     }  | 
|   | 
|     private void SecondEvent()  | 
|     {  | 
|         if (!ConfigManager.Instance.isLoadFinished)  | 
|             return;  | 
|   | 
|         if (!DTC0403_tagPlayerLoginLoadOK.finishedLogin)  | 
|         {  | 
|             return;  | 
|         }  | 
|         for (int i = 0; i < (int)Operation.max; i++)  | 
|         {  | 
|             if (operationDict.ContainsKey((Operation)i))  | 
|             {  | 
|                 var operation = operationDict[(Operation)i];  | 
|                 if (!operation.inDateNotify && operation.SatisfyOpenCondition()  | 
|                     && operation.InDay(TimeUtility.ServerNow))  | 
|                 {  | 
|                     operation.inDateNotify = true;  | 
|                     operation.stepDateNotify = false;  | 
|                     Debug.LogFormat("{0}  活动天开始", (Operation)i);  | 
|                     if (operationStartEvent != null)  | 
|                     {  | 
|                         operationStartEvent((Operation)i, 1);  | 
|                     }  | 
|                 }  | 
|                 else if (!operation.stepDateNotify && !operation.InDay(TimeUtility.ServerNow))  | 
|                 {  | 
|                     operation.inDateNotify = false;  | 
|                     operation.stepDateNotify = true;  | 
|                     Debug.LogFormat("{0}  活动天结束", (Operation)i);  | 
|                     if (operationEndEvent != null)  | 
|                     {  | 
|                         operationEndEvent((Operation)i, 1);  | 
|                     }  | 
|                 }  | 
|                 if (!operation.inTimeNotify && operation.SatisfyOpenCondition()  | 
|                     && operation.InTime(TimeUtility.ServerNow))  | 
|                 {  | 
|                     operation.inTimeNotify = true;  | 
|                     operation.stepTimeNotify = false;  | 
|                     Debug.LogFormat("{0}  活动时间开始", (Operation)i);  | 
|                     if (operationStartEvent != null)  | 
|                     {  | 
|                         operationStartEvent((Operation)i, 0);  | 
|                     }  | 
|                 }  | 
|                 else if (!operation.stepTimeNotify && !operation.InTime(TimeUtility.ServerNow))  | 
|                 {  | 
|                     operation.inTimeNotify = false;  | 
|                     operation.stepTimeNotify = true;  | 
|                     operation.inAdvanceNotify = false;  | 
|                     Debug.LogFormat("{0}  活动时间结束", (Operation)i);  | 
|                     if (operationEndEvent != null)  | 
|                     {  | 
|                         operationEndEvent((Operation)i, 0);  | 
|                     }  | 
|                 }  | 
|   | 
|                 if (!operation.inAdvanceNotify && operation.SatisfyOpenCondition()  | 
|                     && operation.InAdvanceTime(TimeUtility.ServerNow))  | 
|                 {  | 
|                     operation.inAdvanceNotify = true;  | 
|                     Debug.LogFormat("{0}  活动提前开启", (Operation)i);  | 
|                     if (operationAdvanceEvent != null)  | 
|                     {  | 
|                         operationAdvanceEvent((Operation)i);  | 
|                     }  | 
|                 }  | 
|             }  | 
|         }  | 
|     }  | 
|   | 
|     private void HourEvent()  | 
|     {  | 
|         if (!DTC0403_tagPlayerLoginLoadOK.finishedLogin)  | 
|         {  | 
|             return;  | 
|         }  | 
|         if (TimeUtility.Hour == 0 && dayResetEvent != null)  | 
|         {  | 
|             dayResetEvent(0);  | 
|         }  | 
|         if (TimeUtility.Hour == 5 && dayResetEvent != null)  | 
|         {  | 
|             dayResetEvent(1);  | 
|         }  | 
|     }  | 
|   | 
|       | 
|   | 
|     // /// <summary>  | 
|     // /// 累计充值  | 
|     // /// </summary>  | 
|     // /// <param name="package"></param>  | 
|   | 
|     // public void UpdateAccumulateRecharge(HAA1D_tagMCActTotalRechargeInfo package)  | 
|     // {  | 
|     //     OperationBase operationBase = null;  | 
|   | 
|     //     Operation opreationType = Operation.AccumulateRecharge;  | 
|     //     if (package.ActNum == 10)  | 
|     //     {  | 
|     //         //精彩活动-单日累充  | 
|     //         opreationType = Operation.AccumulateRecharge;  | 
|     //     }  | 
|     //     else if (package.ActNum == 11)  | 
|     //     {  | 
|     //         //精彩活动-多日累充  | 
|     //         opreationType = Operation.DaysAccumulateRecharge;  | 
|     //     }  | 
|     //     else if (package.ActNum == 20)  | 
|     //     {  | 
|     //         //合服-福利(多日累充1档)  | 
|     //         opreationType = Operation.default8;  | 
|     //     }  | 
|     //     else if (package.ActNum == 30)  | 
|     //     {  | 
|     //         //节日-单日累充  | 
|     //         opreationType = Operation.HolidayAccumulateRecharge;  | 
|     //     }  | 
|     //     else if (package.ActNum == 31)  | 
|     //     {  | 
|     //         //节日-多日累充  | 
|     //         opreationType = Operation.HolidayMultiRecharge;  | 
|     //     }  | 
|     //     else if (package.ActNum == 34)  | 
|     //     {  | 
|     //         // 节日-指定1档充值  | 
|     //         opreationType = Operation.default20;  | 
|     //     }  | 
|     //     else if (package.ActNum == 35)  | 
|     //     {  | 
|     //         // 福缘- 长久累充(几个月或更长)  | 
|     //         opreationType = Operation.default32;  | 
|     //     }  | 
|   | 
|     //     operationDict.TryGetValue(opreationType, out operationBase);  | 
|     //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))  | 
|     //     {  | 
|     //         ForceStopOperation(opreationType);  | 
|     //     }  | 
|     //     else  | 
|     //     {  | 
|     //         if (operationBase == null)  | 
|     //         {  | 
|     //             operationBase = new OperationAccumulateRecharge();  | 
|     //             operationDict.Add(opreationType, operationBase);  | 
|     //         }  | 
|     //         OperationAccumulateRecharge operation = operationBase as OperationAccumulateRecharge;  | 
|     //         operation.Reset();  | 
|     //         operation.limitLv = package.LimitLV;  | 
|     //         operation.startDate = ParseOperationDate(package.StartDate);  | 
|     //         operation.endDate = ParseOperationDate(package.EndtDate);  | 
|     //         operation.dayReset = package.IsDayReset == 1;  | 
|     //         operation.ParseAccumulateRecharge(package);  | 
|     //         operation.ActNum = package.ActNum;  | 
|     //         if (operationTimeUpdateEvent != null)  | 
|     //         {  | 
|     //             operationTimeUpdateEvent(opreationType);  | 
|     //         }  | 
|     //     }  | 
|     // }  | 
|   | 
|       | 
|   | 
|     // public void UpdateCollectWordsPackage(HAA40_tagMCActCollectWordsInfo package)  | 
|     // {  | 
|     //     OperationBase operationBase = null;  | 
|   | 
|     //     var opreationType = Operation.CollectWords;  | 
|   | 
|     //     switch (package.ActNum)  | 
|     //     {  | 
|     //         case 10:  | 
|     //             opreationType = Operation.CollectWords;  | 
|     //             break;  | 
|     //         case 20:  | 
|     //             opreationType = Operation.default10;  | 
|     //             break;  | 
|     //         case 30:  | 
|     //             opreationType = Operation.HolidayCollectWords;  | 
|     //             break;  | 
|     //     }  | 
|   | 
|     //     operationDict.TryGetValue(opreationType, out operationBase);  | 
|     //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))  | 
|     //     {  | 
|     //         ForceStopOperation(opreationType);  | 
|     //     }  | 
|     //     else  | 
|     //     {  | 
|     //         if (operationBase == null)  | 
|     //         {  | 
|     //             operationBase = new OperationCollectWords();  | 
|     //             operationDict.Add(opreationType, operationBase);  | 
|     //         }  | 
|     //         OperationCollectWords operation = operationBase as OperationCollectWords;  | 
|     //         operation.Reset();  | 
|     //         operation.limitLv = package.LimitLV;  | 
|     //         operation.startDate = ParseOperationDate(package.StartDate);  | 
|     //         operation.endDate = ParseOperationDate(package.EndtDate);  | 
|     //         operation.ActNum = package.ActNum;  | 
|     //         operation.LastDayOnlyExchange = package.LastDayOnlyExchange;  | 
|     //         operation.ParseCollectWords(package);  | 
|     //         if (operationTimeUpdateEvent != null)  | 
|     //         {  | 
|     //             operationTimeUpdateEvent(opreationType);  | 
|     //         }  | 
|     //     }  | 
|     // }  | 
|   | 
|     // public void UpdateSingleRechargeInfo(HAA50_tagMCActSingleRechargeInfo package)  | 
|     // {  | 
|     //     OperationBase operationBase = null;  | 
|   | 
|     //     var opreationType = Operation.default28;  | 
|   | 
|     //     operationDict.TryGetValue(opreationType, out operationBase);  | 
|     //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))  | 
|     //     {  | 
|     //         ForceStopOperation(opreationType);  | 
|     //     }  | 
|     //     else  | 
|     //     {  | 
|     //         if (operationBase == null)  | 
|     //         {  | 
|     //             operationBase = new OperationSingleRecharge();  | 
|     //             operationDict.Add(opreationType, operationBase);  | 
|     //         }  | 
|     //         OperationSingleRecharge operation = operationBase as OperationSingleRecharge;  | 
|     //         operation.Reset();  | 
|     //         operation.limitLv = package.LimitLV;  | 
|     //         operation.startDate = ParseOperationDate(package.StartDate);  | 
|     //         operation.endDate = ParseOperationDate(package.EndtDate);  | 
|     //         operation.ActNum = package.ActNum;  | 
|     //         operation.dayReset = package.IsDayReset == 1;  | 
|     //         operation.ParseSingleRecharge(package);  | 
|     //         if (operationTimeUpdateEvent != null)  | 
|     //         {  | 
|     //             operationTimeUpdateEvent(opreationType);  | 
|     //         }  | 
|     //     }  | 
|     // }  | 
|   | 
|     // public void UpdateHolidayLogin(HAA42_tagMCFeastLoginInfo package)  | 
|     // {  | 
|     //     OperationBase operationBase = null;  | 
|     //     operationDict.TryGetValue(Operation.HolidayLogin, out operationBase);  | 
|     //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))  | 
|     //     {  | 
|     //         ForceStopOperation(Operation.HolidayLogin);  | 
|     //     }  | 
|     //     else  | 
|     //     {  | 
|     //         if (operationBase == null)  | 
|     //         {  | 
|     //             operationBase = new OperationHolidayLogin();  | 
|     //             operationDict.Add(Operation.HolidayLogin, operationBase);  | 
|     //         }  | 
|     //         var operation = operationBase as OperationHolidayLogin;  | 
|     //         operation.Reset();  | 
|     //         operation.startDate = ParseOperationDate(package.StartDate);  | 
|     //         operation.endDate = ParseOperationDate(package.EndtDate);  | 
|     //         operation.limitLv = package.LimitLV;  | 
|     //         operation.ParsePackage(package);  | 
|     //         if (operationTimeUpdateEvent != null)  | 
|     //         {  | 
|     //             operationTimeUpdateEvent(Operation.HolidayLogin);  | 
|     //         }  | 
|     //     }  | 
|     // }  | 
|   | 
|       | 
|   | 
|     // public void UpdateMultiRechargePackage(HAA27_tagMCActRechargePrizeInfo package)  | 
|     // {  | 
|     //     OperationBase operationBase = null;  | 
|     //     operationDict.TryGetValue(Operation.MultiRecharge, out operationBase);  | 
|     //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))  | 
|     //     {  | 
|     //         ForceStopOperation(Operation.MultiRecharge);  | 
|     //     }  | 
|     //     else  | 
|     //     {  | 
|     //         if (operationBase == null)  | 
|     //         {  | 
|     //             operationBase = new OperationMultiRecharge();  | 
|     //             operationDict.Add(Operation.MultiRecharge, operationBase);  | 
|     //         }  | 
|     //         OperationMultiRecharge operation = operationBase as OperationMultiRecharge;  | 
|     //         operation.Reset();  | 
|     //         operation.limitLv = package.LimitLV;  | 
|     //         operation.startDate = ParseOperationDate(package.StartDate);  | 
|     //         operation.endDate = ParseOperationDate(package.EndtDate);  | 
|     //         operation.dayReset = package.IsDayReset == 1;  | 
|     //         operation.ParseMultiRecharge(package);  | 
|     //         if (operationTimeUpdateEvent != null)  | 
|     //         {  | 
|     //             operationTimeUpdateEvent(Operation.MultiRecharge);  | 
|     //         }  | 
|     //     }  | 
|     // }  | 
|   | 
|     // /// <summary>  | 
|     // /// 限时礼包  | 
|     // /// </summary>  | 
|     // /// <param name="package"></param>  | 
|   | 
|     // public void UpdateGiftPackage(HAA12_tagMCFlashGiftbagInfo package)  | 
|     // {  | 
|     //     OperationBase operationBase = null;  | 
|     //     Operation operationType = Operation.GiftPackage;  | 
|   | 
|     //     switch (package.ActNum)  | 
|     //     {  | 
|     //         case 10:  | 
|     //             operationType = Operation.GiftPackage;  | 
|     //             break;  | 
|     //         case 20:  | 
|     //             operationType = Operation.default13;  | 
|     //             break;  | 
|     //         case 30:  | 
|     //             operationType = Operation.HolidayGiftPackage;  | 
|     //             break;  | 
|     //     }  | 
|   | 
|     //     operationDict.TryGetValue(operationType, out operationBase);  | 
|     //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))  | 
|     //     {  | 
|     //         ForceStopOperation(operationType);  | 
|     //     }  | 
|     //     else  | 
|     //     {  | 
|     //         if (operationBase == null)  | 
|     //         {  | 
|     //             operationBase = new GiftPackageClass();  | 
|     //             operationDict.Add(operationType, operationBase);  | 
|     //         }  | 
|     //         GiftPackageClass operation = operationBase as GiftPackageClass;  | 
|     //         operation.Reset();  | 
|     //         operation.limitLv = package.LimitLV;  | 
|     //         operation.startDate = ParseOperationDate(package.StartDate);  | 
|     //         operation.endDate = ParseOperationDate(package.EndtDate);  | 
|     //         operation.dayReset = package.IsDayReset == 1;  | 
|     //         operation.inAdvanceMinute = package.AdvanceMinutes;  | 
|     //         operation.ActNum = package.ActNum;  | 
|     //         for (int i = 0; i < package.ActivityTimeCount; i++)  | 
|     //         {  | 
|     //             operation.times.Add(ParseOperationTime(package.ActivityTime[i].StartTime,  | 
|     //                 package.ActivityTime[i].EndtTime));  | 
|     //         }  | 
|     //         operation.ParsePackage(package);  | 
|     //         if (operationTimeUpdateEvent != null)  | 
|     //         {  | 
|     //             operationTimeUpdateEvent(operationType);  | 
|     //         }  | 
|     //     }  | 
|     // }  | 
|   | 
|      | 
|     | 
|       | 
|   | 
|     // public void UpdateCrossActLianQiInfo(HAA90_tagMCCrossActLianqiInfo package)  | 
|     // {  | 
|     //     OperationBase operationBase = null;  | 
|     //     operationDict.TryGetValue(Operation.default51, out operationBase);  | 
|     //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))  | 
|     //     {  | 
|     //         ForceStopOperation(Operation.default51);  | 
|     //     }  | 
|     //     else  | 
|     //     {  | 
|     //         if (operationBase == null)  | 
|     //         {  | 
|     //             operationBase = new OperationLianQiCross();  | 
|     //             operationDict.Add(Operation.default51, operationBase);  | 
|     //         }  | 
|     //         OperationLianQiCross operation = operationBase as OperationLianQiCross;  | 
|     //         operation.Reset();  | 
|     //         operation.m_ServerListStr = UIHelper.GetServers(package.ServerIDRangeInfo);  | 
|     //         operation.m_GroupValue1 = package.GroupValue1;  | 
|     //         operation.startDate = ParseOperationDate(package.StartDate);  | 
|     //         operation.endDate = ParseOperationDate(package.EndtDate);  | 
|     //         operation.dayReset = true;  | 
|     //         operation.limitLv = package.LimitLV;  | 
|     //         operation.ParseJoinTime(package.JoinStartTime, package.JoinEndTime);  | 
|     //         operation.ParseCrossActHorsePetTrainInfo(package);  | 
|     //         //for (int i = 0; i < package.ActivityTimeCount; i++)  | 
|     //         //{  | 
|     //         //    operation.times.Add(ParseOperationTime(package.ActivityTime[i].StartTime,  | 
|     //         //        package.ActivityTime[i].EndtTime));  | 
|     //         //}  | 
|     //         if (operationTimeUpdateEvent != null)  | 
|     //         {  | 
|     //             operationTimeUpdateEvent(Operation.default51);  | 
|     //         }  | 
|     //     }  | 
|     // }  | 
|   | 
|     // public void UpdateActLunhuidianInfo(HAA88_tagMCActLunhuidianInfo package)  | 
|     // {  | 
|     //     OperationBase operationBase = null;  | 
|     //     operationDict.TryGetValue(Operation.default47, out operationBase);  | 
|     //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))  | 
|     //     {  | 
|     //         ForceStopOperation(Operation.default47);  | 
|     //     }  | 
|     //     else  | 
|     //     {  | 
|     //         if (operationBase == null)  | 
|     //         {  | 
|     //             operationBase = new OperationCycleHall();  | 
|     //             operationDict.Add(Operation.default47, operationBase);  | 
|     //         }  | 
|     //         OperationCycleHall operation = operationBase as OperationCycleHall;  | 
|     //         operation.Reset();  | 
|     //         operation.startDate = ParseOperationDate(package.StartDate);  | 
|     //         operation.endDate = ParseOperationDate(package.EndtDate);  | 
|     //         operation.resetType = package.ResetType;  | 
|     //         operation.limitLv = package.LimitLV;  | 
|     //         operation.ParseCycleHallInfo(package);  | 
|     //         if (operationTimeUpdateEvent != null)  | 
|     //         {  | 
|     //             operationTimeUpdateEvent(Operation.default47);  | 
|     //         }  | 
|     //     }  | 
|     // }  | 
|   | 
|     // public void UpdateActYunShiInfo(HAA87_tagMCActYunshiInfo package)  | 
|     // {  | 
|     //     Operation operationType = Operation.default48;  | 
|   | 
|     //     switch (package.ActNum)  | 
|     //     {  | 
|     //         case 10:  | 
|     //             operationType = Operation.default48;  | 
|     //             break;  | 
|     //     }  | 
|     //     OperationBase operationBase = null;  | 
|     //     operationDict.TryGetValue(operationType, out operationBase);  | 
|     //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))  | 
|     //     {  | 
|     //         ForceStopOperation(operationType);  | 
|     //     }  | 
|     //     else  | 
|     //     {  | 
|     //         if (operationBase == null)  | 
|     //         {  | 
|     //             operationBase = new OperationYunShi();  | 
|     //             operationDict.Add(operationType, operationBase);  | 
|     //         }  | 
|     //         OperationYunShi operation = operationBase as OperationYunShi;  | 
|     //         operation.Reset();  | 
|     //         operation.startDate = ParseOperationDate(package.StartDate);  | 
|     //         operation.endDate = ParseOperationDate(package.EndtDate);  | 
|     //         operation.resetType = package.ResetType;  | 
|     //         operation.limitLv = package.LimitLV;  | 
|     //         operation.treasureType = package.TreasureType;  | 
|     //         if (operationTimeUpdateEvent != null)  | 
|     //         {  | 
|     //             operationTimeUpdateEvent(operationType);  | 
|     //         }  | 
|     //     }  | 
|     // }  | 
|   | 
|       | 
|     // public void UpdateLoginAct(HAA69_tagMCActLoginNew package)  | 
|     // {  | 
|     //     OperationBase operationBase = null;  | 
|     //     Operation operationType = Operation.default29;  | 
|   | 
|     //     switch (package.ActNum)  | 
|     //     {  | 
|     //         case 11:  | 
|     //             operationType = Operation.default44;  | 
|     //             break;  | 
|     //         case 30:  | 
|     //             operationType = Operation.default29;  | 
|     //             break;  | 
|     //     }  | 
|   | 
|     //     operationDict.TryGetValue(operationType, out operationBase);  | 
|     //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))  | 
|     //     {  | 
|     //         ForceStopOperation(operationType);  | 
|     //     }  | 
|     //     else  | 
|     //     {  | 
|     //         if (operationBase == null)  | 
|     //         {  | 
|     //             operationBase = new OperationLoginAct();  | 
|     //             operationDict.Add(operationType, operationBase);  | 
|     //         }  | 
|     //         var operation = operationBase as OperationLoginAct;  | 
|     //         operation.Reset();  | 
|     //         operation.startDate = ParseOperationDate(package.StartDate);  | 
|     //         operation.endDate = ParseOperationDate(package.EndtDate);  | 
|     //         operation.limitLv = package.LimitLV;  | 
|     //         operation.ActNum = package.ActNum;  | 
|     //         operation.ParsePackage(package);  | 
|     //         if (operationTimeUpdateEvent != null)  | 
|     //         {  | 
|     //             operationTimeUpdateEvent(operationType);  | 
|     //         }  | 
|     //     }  | 
|     // }  | 
|   | 
|     // public void UpdateMissionAct(HAA71_tagMCActTaskInfo package)  | 
|     // {  | 
|     //     OperationBase operationBase = null;  | 
|   | 
|     //     var opreationType = Operation.default30;  | 
|     //     switch (package.ActNum)  | 
|     //     {  | 
|     //         case 11:  | 
|     //             opreationType = Operation.default45;  | 
|     //             break;  | 
|     //         case 12:  | 
|     //             opreationType = Operation.default49;  | 
|     //             break;  | 
|     //         case 30:  | 
|     //             opreationType = Operation.default30;  | 
|     //             break;  | 
|     //     }  | 
|     //     operationDict.TryGetValue(opreationType, out operationBase);  | 
|   | 
|     //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))  | 
|     //     {  | 
|     //         ForceStopOperation(opreationType);  | 
|     //     }  | 
|     //     else  | 
|     //     {  | 
|     //         if (operationBase == null)  | 
|     //         {  | 
|     //             operationBase = new OperationMissionAct();  | 
|     //             operationDict.Add(opreationType, operationBase);  | 
|     //         }  | 
|     //         var operation = operationBase as OperationMissionAct;  | 
|     //         operation.Reset();  | 
|     //         operation.startDate = ParseOperationDate(package.StartDate);  | 
|     //         operation.endDate = ParseOperationDate(package.EndtDate);  | 
|     //         operation.limitLv = package.LimitLV;  | 
|     //         operation.dayReset = package.IsDayReset == 1;  | 
|     //         operation.resetType = package.ResetType;  | 
|     //         operation.ActNum = package.ActNum;  | 
|     //         operation.ParsePackage(package);  | 
|     //         if (operationTimeUpdateEvent != null)  | 
|     //         {  | 
|     //             operationTimeUpdateEvent(Operation.default30);  | 
|     //         }  | 
|     //     }  | 
|     // }  | 
|   | 
|     // public void UpdateRechargeGiftAct(HAA74_tagMCActBuyCountGiftInfo package)  | 
|     // {  | 
|     //     OperationBase operationBase = null;  | 
|   | 
|     //     Operation operationType = Operation.default31;  | 
|   | 
|     //     switch (package.ActNum)  | 
|     //     {  | 
|     //         case 30:  | 
|     //             operationType = Operation.default31;  | 
|     //             break;  | 
|     //         case 10:  | 
|     //             operationType = Operation.default35;  | 
|     //             break;  | 
|     //         case 31:  | 
|     //             operationType = Operation.default38;  | 
|     //             break;  | 
|     //         case 11:  | 
|     //             operationType = Operation.default46;  | 
|     //             break;  | 
|     //         case 12:  | 
|     //             operationType = Operation.default50;  | 
|     //             break;  | 
|     //         case 13:  | 
|     //             operationType = Operation.default52;  | 
|     //             break;  | 
|     //         default:  | 
|     //             return;  | 
|     //     }  | 
|     //     operationDict.TryGetValue(operationType, out operationBase);  | 
|     //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))  | 
|     //     {  | 
|     //         ForceStopOperation(operationType);  | 
|     //     }  | 
|     //     else  | 
|     //     {  | 
|     //         if (operationBase == null)  | 
|     //         {  | 
|     //             operationBase = new OperationRechargeGiftAct();  | 
|     //             operationDict.Add(operationType, operationBase);  | 
|     //         }  | 
|     //         var operation = operationBase as OperationRechargeGiftAct;  | 
|     //         operation.Reset();  | 
|     //         operation.startDate = ParseOperationDate(package.StartDate);  | 
|     //         operation.endDate = ParseOperationDate(package.EndtDate);  | 
|     //         operation.limitLv = package.LimitLV;  | 
|     //         operation.dayReset = package.IsDayReset == 1;  | 
|     //         operation.resetType = package.ResetType;  | 
|     //         operation.ActNum = package.ActNum;  | 
|     //         operation.ParsePackage(package);  | 
|     //         if (operationTimeUpdateEvent != null)  | 
|     //         {  | 
|     //             operationTimeUpdateEvent(operationType);  | 
|     //         }  | 
|     //     }  | 
|     // }  | 
|   | 
|     // public void UpdateActFamilyCTGAssistInfo(HAA77_tagMCActFamilyCTGAssistInfo package)  | 
|     // {  | 
|     //     OperationBase operationBase = null;  | 
|   | 
|     //     Operation operationType = Operation.default34;  | 
|   | 
|     //     switch (package.ActNum)  | 
|     //     {  | 
|     //         case 30:  | 
|     //             operationType = Operation.default34;  | 
|     //             break;  | 
|     //         case 32:  | 
|     //             operationType = Operation.default54;  | 
|     //             break;  | 
|     //         default:  | 
|     //             return;  | 
|     //     }  | 
|     //     operationDict.TryGetValue(operationType, out operationBase);  | 
|     //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))  | 
|     //     {  | 
|     //         ForceStopOperation(operationType);  | 
|     //     }  | 
|     //     else  | 
|     //     {  | 
|     //         if (operationBase == null)  | 
|     //         {  | 
|     //             operationBase = new OperationFamilyRechargeConn();  | 
|     //             operationDict.Add(operationType, operationBase);  | 
|     //         }  | 
|     //         var operation = operationBase as OperationFamilyRechargeConn;  | 
|     //         operation.Reset();  | 
|     //         operation.startDate = ParseOperationDate(package.StartDate);  | 
|     //         operation.endDate = ParseOperationDate(package.EndtDate);  | 
|     //         operation.limitLv = package.LimitLV;  | 
|     //         operation.dayReset = package.IsDayReset == 1;  | 
|     //         operation.ActNum = package.ActNum;  | 
|     //         operation.ParseActFamilyCTGAssistInfo(package);  | 
|     //         if (operationTimeUpdateEvent != null)  | 
|     //         {  | 
|     //             operationTimeUpdateEvent(operationType);  | 
|     //         }  | 
|     //     }  | 
|     // }  | 
|   | 
|     public void ForceStopOperation(Operation operationType)  | 
|     {  | 
|         if (operationDict.ContainsKey(operationType))  | 
|         {  | 
|             operationDict.Remove(operationType);  | 
|         }  | 
|         if (operationServerCloseEvent != null)  | 
|         {  | 
|             operationServerCloseEvent(operationType);  | 
|         }  | 
|         if (operationEndEvent != null)  | 
|         {  | 
|             operationEndEvent(operationType, 0);  | 
|             operationEndEvent(operationType, 1);  | 
|         }  | 
|     }  | 
|   | 
|     public bool TryGetOperationTime(Operation type, out OperationBase operation)  | 
|     {  | 
|         return operationDict.TryGetValue(type, out operation);  | 
|     }  | 
|   | 
|     public bool TryGetOperation<T>(Operation type, out T operation) where T : OperationBase  | 
|     {  | 
|         operation = null;  | 
|         if (operationDict.ContainsKey(type))  | 
|         {  | 
|             operation = operationDict[type] as T;  | 
|             return operation is T;  | 
|         }  | 
|         return false;  | 
|     }  | 
|   | 
|     public bool InOperationTime(Operation type)  | 
|     {  | 
|         OperationBase operation;  | 
|         if (TryGetOperationTime(type, out operation))  | 
|         {  | 
|             return operation.InTime(TimeUtility.ServerNow);  | 
|         }  | 
|         return false;  | 
|     }  | 
|   | 
|     public bool InOperationTime(Operation type, DateTime time)  | 
|     {  | 
|         OperationBase operation;  | 
|         if (TryGetOperationTime(type, out operation))  | 
|         {  | 
|             return operation.InTime(time);  | 
|         }  | 
|         return false;  | 
|     }  | 
|   | 
|     public bool InOperationJoinTime(Operation type, DateTime time)  | 
|     {  | 
|         OperationBase operation;  | 
|         if (TryGetOperationTime(type, out operation))  | 
|         {  | 
|             return operation.InJoinTime(time);  | 
|         }  | 
|         return false;  | 
|     }  | 
|   | 
|     public bool InOperationDay(Operation type)  | 
|     {  | 
|         OperationBase operation;  | 
|         if (TryGetOperationTime(type, out operation))  | 
|         {  | 
|             return operation.InDay(TimeUtility.ServerNow);  | 
|         }  | 
|         return false;  | 
|     }  | 
|   | 
|     public int GetOperationSurplusTime(Operation type)  | 
|     {  | 
|         OperationBase operation;  | 
|         if (TryGetOperationTime(type, out operation))  | 
|         {  | 
|             return operation.GetSurplusTime(TimeUtility.ServerNow);  | 
|         }  | 
|         return 0;  | 
|     }  | 
|   | 
|     public bool InOperationAdvance(Operation type)  | 
|     {  | 
|         OperationBase operation;  | 
|         if (TryGetOperationTime(type, out operation))  | 
|         {  | 
|             return operation.InAdvanceTime(TimeUtility.ServerNow);  | 
|         }  | 
|         return false;  | 
|     }  | 
|   | 
|     public int GetOperationSecondsBeforeStart(Operation type)  | 
|     {  | 
|         OperationBase operation;  | 
|         if (TryGetOperationTime(type, out operation))  | 
|         {  | 
|             return operation.GetSecondsBeforeStart(TimeUtility.ServerNow);  | 
|         }  | 
|         return 0;  | 
|     }  | 
|   | 
|     public bool SatisfyOpenCondition(Operation type)  | 
|     {  | 
|         OperationBase operation;  | 
|         if (TryGetOperationTime(type, out operation))  | 
|         {  | 
|             return operation.SatisfyOpenCondition() && InOperationTime(type);  | 
|         }  | 
|         return false;  | 
|     }  | 
|   | 
|     public bool SatisfyOpenCondition(Operation type, DateTime time)  | 
|     {  | 
|         OperationBase operation;  | 
|         if (TryGetOperationTime(type, out operation))  | 
|         {  | 
|             return operation.SatisfyOpenCondition() && InOperationTime(type, time);  | 
|         }  | 
|         return false;  | 
|     }  | 
|   | 
|     //活动开启中,有参与进行时间段  | 
|     public bool SatisfyJoinCondition(Operation type, DateTime time)  | 
|     {  | 
|         OperationBase operation;  | 
|         if (TryGetOperationTime(type, out operation))  | 
|         {  | 
|             return InOperationJoinTime(type, time);  | 
|         }  | 
|         return false;  | 
|     }  | 
|   | 
|     public bool IsPrepareTime(Operation type, DateTime time)  | 
|     {  | 
|         OperationBase operation;  | 
|         if (TryGetOperationTime(type, out operation))  | 
|         {  | 
|             return operation.IsPrepareTime(time);  | 
|         }  | 
|         return false;  | 
|     }  | 
|   | 
|     public bool SatisfyAdvanceCondition(Operation type)  | 
|     {  | 
|         OperationBase operation;  | 
|         if (TryGetOperationTime(type, out operation))  | 
|         {  | 
|             return operation.SatisfyOpenCondition() && InOperationAdvance(type);  | 
|         }  | 
|         return false;  | 
|     }  | 
|   | 
|     public void ProcessConditionError(Operation type)  | 
|     {  | 
|         if (SatisfyOpenCondition(type))  | 
|         {  | 
|             return;  | 
|         }  | 
|         OperationBase operation;  | 
|         if (TryGetOperationTime(type, out operation))  | 
|         {  | 
|             if (!InOperationTime(type))  | 
|             {  | 
|                 SysNotifyMgr.Instance.ShowTip("InOperationTimeError");  | 
|             }  | 
|             else if (!operation.SatisfyOpenCondition())  | 
|             {  | 
|                 SysNotifyMgr.Instance.ShowTip(StringUtility.Contact("OperationLevelLimit_", type), operation.limitLv);  | 
|             }  | 
|         }  | 
|         else  | 
|         {  | 
|             SysNotifyMgr.Instance.ShowTip("InOperationTimeError");  | 
|         }  | 
|     }  | 
|   | 
|     public OperationDate ParseOperationDate(string date)  | 
|     {  | 
|         string[] dateArray = date.Split('-');  | 
|         if (dateArray != null && dateArray.Length == 3)  | 
|         {  | 
|             return new OperationDate()  | 
|             {  | 
|                 year = int.Parse(dateArray[0].Trim()),  | 
|                 month = int.Parse(dateArray[1].Trim()),  | 
|                 day = int.Parse(dateArray[2].Trim())  | 
|             };  | 
|         }  | 
|         //else if (dateArray != null && dateArray.Length == 1)  | 
|         //{  | 
|         //    var time = TimeUtility.openServerTime;  | 
|         //    if (time.Equals(default(DateTime)))  | 
|         //    {  | 
|         //        Debug.Log("服务期开服时间下发顺序有问题");  | 
|         //    }  | 
|         //    var days = 0;  | 
|         //    int.TryParse(date, out days);  | 
|         //    days = Mathf.Max(1, days);  | 
|         //    time = time.AddDays(days - 1);  | 
|         //    return new OperationDate()  | 
|         //    {  | 
|         //        year = time.Year,  | 
|         //        month = time.Month,  | 
|         //        day = time.Day,  | 
|         //    };  | 
|         //}  | 
|         return default(OperationDate);  | 
|     }  | 
|   | 
|     private OperationTime ParseOperationTime(string startTime, string endTime)  | 
|     {  | 
|         var startTimeArray = startTime.Split(':');  | 
|         var endTimeArray = endTime.Split(':');  | 
|         if (startTimeArray != null && startTimeArray.Length == 2  | 
|             && endTimeArray != null && endTimeArray.Length == 2)  | 
|         {  | 
|             return new OperationTime()  | 
|             {  | 
|                 startHour = int.Parse(startTimeArray[0].Trim()),  | 
|                 startMinute = int.Parse(startTimeArray[1].Trim()),  | 
|                 endHour = int.Parse(endTimeArray[0].Trim()),  | 
|                 endMinute = int.Parse(endTimeArray[1].Trim()),  | 
|             };  | 
|         }  | 
|         return default(OperationTime);  | 
|     }  | 
| }  | 
|   | 
| public struct OperationDate  | 
| {  | 
|     public int year;  | 
|     public int month;  | 
|     public int day;  | 
|   | 
|     public static bool operator ==(OperationDate x, OperationDate y)  | 
|     {  | 
|         return x.year == y.year && x.month == y.month && x.day == y.day;  | 
|     }  | 
|   | 
|     public static bool operator !=(OperationDate x, OperationDate y)  | 
|     {  | 
|         return !(x == y);  | 
|     }  | 
|   | 
|     public static bool operator >(OperationDate x, OperationDate y)  | 
|     {  | 
|         if (x.year > y.year)  | 
|         {  | 
|             return true;  | 
|         }  | 
|         if (x.year == y.year)  | 
|         {  | 
|             if (x.month > y.month)  | 
|             {  | 
|                 return true;  | 
|             }  | 
|             if (x.month == y.month)  | 
|             {  | 
|                 return x.day > y.day;  | 
|             }  | 
|         }  | 
|         return false;  | 
|     }  | 
|   | 
|     public static bool operator <(OperationDate x, OperationDate y)  | 
|     {  | 
|         return !(x > y) && x != y;  | 
|     }  | 
|   | 
|     public static bool operator >=(OperationDate x, OperationDate y)  | 
|     {  | 
|         return x > y || x == y;  | 
|     }  | 
|   | 
|     public static bool operator <=(OperationDate x, OperationDate y)  | 
|     {  | 
|         return x < y || x == y;  | 
|     }  | 
|   | 
|     public DateTime AddSeconds(int _seconds)  | 
|     {  | 
|         DateTime d = new DateTime(year, month, day);  | 
|         return d.AddTicks(_seconds * TimeSpan.TicksPerSecond);  | 
|     }  | 
|   | 
|     public OperationDate AddDays(int _days)  | 
|     {  | 
|         DateTime d = new DateTime(year, month, day);  | 
|         d = d.AddTicks(_days * TimeSpan.TicksPerDay);  | 
|         return new OperationDate()  | 
|         {  | 
|             year = d.Year,  | 
|             month = d.Month,  | 
|             day = d.Day,  | 
|         };  | 
|     }  | 
|   | 
|     public string ToDisplay(bool showYear = true)  | 
|     {  | 
|         if (showYear)  | 
|         {  | 
|             return StringUtility.Contact(year, "/", month, "/", day);  | 
|         }  | 
|   | 
|         return StringUtility.Contact(month, "/", day);  | 
|   | 
|         //var yearString = StringUtility.Contact(year, Language.Get("Year"));  | 
|         //return StringUtility.Contact(showYear ? yearString : string.Empty, month, Language.Get("Month"), day, Language.Get("Day"));  | 
|     }  | 
|   | 
|     public static int operator -(OperationDate x, OperationDate y)  | 
|     {  | 
|         DateTime _x = new DateTime(x.year, x.month, x.day);  | 
|         DateTime _y = new DateTime(y.year, y.month, y.day);  | 
|         return (int)(_x - _y).TotalDays;  | 
|     }  | 
| }  | 
|   | 
| public struct OperationTime  | 
| {  | 
|     public int startHour;  | 
|     public int startMinute;  | 
|   | 
|     public int endHour;  | 
|     public int endMinute;  | 
|   | 
|     public bool InTime(DateTime time)  | 
|     {  | 
|         return CompareTime(time) == 0;  | 
|     }  | 
|   | 
|     public int CompareTime(DateTime time)  | 
|     {  | 
|         if (time.Hour < startHour || (time.Hour == startHour && time.Minute < startMinute))  | 
|         {  | 
|             return -1;  | 
|         }  | 
|         if (time.Hour > endHour || (time.Hour == endHour && time.Minute >= endMinute))  | 
|         {  | 
|             return 1;  | 
|         }  | 
|         return 0;  | 
|     }  | 
|   | 
|     public override string ToString()  | 
|     {  | 
|         return StringUtility.Contact(startHour.ToString("D2"), ":", startMinute.ToString("D2"),  | 
|             "-", endHour.ToString("D2"), ":", endMinute.ToString("D2"));  | 
|     }  | 
|   | 
|     public static int operator -(OperationTime x, DateTime y)  | 
|     {  | 
|         DateTime d = new DateTime(y.Year, y.Month, y.Day, x.endHour, x.endMinute, 0);  | 
|         return Mathf.Max(0, (int)(d - y).TotalSeconds);  | 
|     }  | 
| }  | 
|   | 
| public enum Operation  | 
| {  | 
|     MultipleExp,  | 
|     ConsumeRebate,  | 
|     FlashSale,//限时特惠  | 
|     BossReborn,  | 
|     GiftPackage,  | 
|     FairyCeremony, //仙界盛典  | 
|     MultipRealmPoint, //N倍修行点  | 
|     FlashRushToBuy, //限时抢购  | 
|     WishingWellInfo, //许愿池  | 
|     AccumulateRecharge,//累计充值,单日  | 
|     LoginReward,//登录奖励  | 
|     FestivalRedpack,//节日红包  | 
|     NewYearFairyCeremony, //春节仙界盛典  | 
|     SpringFestival,//春节巡礼  | 
|     OpenServiceAchievement,//七日巡礼  | 
|     LuckyTreasure,//幸运鉴宝  | 
|     MultiRecharge, //仙玉充值返利 (首充双倍)  | 
|     CZBMGift,   // 成长必买礼包  | 
|     DaysAccumulateRecharge, //累计充值,多日  | 
|     CollectWords,   //收集文字  | 
|     HolidayLogin,   //节日登录  | 
|     HolidayWish,   //节日祝福灯笼  | 
|     HolidayMultiRecharge,//节日祝福的多日累计充值 包含任意充值界面和多日累充界面  | 
|     HolidayTravel,      //节日游历  | 
|     HolidayAccumulateRecharge, //节日-单日的累积充值  | 
|     HolidayCollectWords, //节日-集字  | 
|     HolidayGiftPackage, //节日祝福-限时礼包  | 
|     HolidayFlashRushToBuy, //节日-限时抢购  | 
|     HolidayFlashSale, //节日祝福-限时特惠  | 
|     HolidayConsumeRebate, //节日祝福-消费返利  | 
|   | 
|     //后续IL开发添加预设  | 
|     default1,   // 连续多日累充  | 
|     default2,  | 
|     default3,   // 节日-垃圾分类  | 
|     default4,   // 节日-翻牌  | 
|     default5,  | 
|     default6,  | 
|     default7,   // 精彩活动-跨服充值  | 
|     default8,   // 合服-福利(多日累充1档)  | 
|     default9,   // 合服-转盘  | 
|     default10,  // 合服-集字狂欢  | 
|     default11,  // 合服-坐骑盛宴  | 
|     default12,  // 合服-超值限购  | 
|     default13,  // 合服-限时礼包  | 
|     default14,  | 
|     default15,  | 
|     default16,  | 
|     default17,  | 
|     default18,  // 幸运云购  | 
|     default19,  | 
|     default20,  //节日指定累计充值额度,和节日任意充值独立两个界面  | 
|     default21,  | 
|     default22,  //天帝礼包  | 
|     default23,  | 
|     default24,  | 
|     default25,  //买1送5  | 
|     default26,  | 
|     default27,  //日期型活动- boss历练活动  | 
|     default28,  //精彩活动-单笔充值  | 
|     default29,  //日期型活动- 登录,可补签  | 
|     default30,  //日期型活动- 任务  | 
|     default31,  //日期型活动- 礼包,可累计购买次数领取  | 
|     default32,  //福缘- 长久累充(几个月或更长) 独立界面  | 
|     default33,  //日期型活动- boss 历练活动(跨服) 必须和活动default27一起使用  | 
|     default34,  //日期型活动- 仙盟充值互助,特殊:允许多个活动同时开启  | 
|     default35,  //自选礼包  | 
|     default36,  //日期型活动- 秘境寻宝(类仙匣) 主活动  | 
|     default37,  //日期型活动- 秘境寻宝(类仙匣) 跨服  | 
|     default38,  //日期型活动- 自选礼包 + 商店  | 
|     default39,  //日期型活动- 骑宠培养本服  | 
|     default40,  //日期型活动- 骑宠培养跨服  | 
|     default41,  //日期型活动- 古宝养成本服  | 
|     default42,  //日期型活动- 古宝养成跨服  | 
|     default43,  ////日期型活动- 任务环  | 
|     default44,  //日期型活动 - 仙缘登陆,可补签  | 
|     default45,  //日期型活动 - 仙缘任务  | 
|     default46,  //日期型活动 - 仙缘礼包  | 
|     default47,  //日期型活动 - 轮回殿  | 
|     default48,  //日期型活动 - 运势寻宝  | 
|     default49,  //日期型活动 - 运势任务  | 
|     default50,  //日期型活动 - 运势礼包  | 
|     default51,  //日期型活动 - 仙匠大会炼器  | 
|     default52,  //日期型活动 - 仙匠大会礼包  | 
|     default53,  //日期型活动 - 仙盟攻城战 跨服  | 
|     default54,  //日期型活动 - 仙盟攻城战仙盟协助和礼包  | 
|     max,  | 
| } |