少年修仙传客户端代码仓库
client_linchunjie
2018-09-13 0c0f5edbef8129a4a2917da0b33cd68c4ee28f5e
3442运营活动修改
3个文件已修改
14个文件已添加
1597 ■■■■ 已修改文件
System/OpenServerActivity/FlashSaleModel.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Welfare/GiftPackageClass.cs 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Welfare/GiftPackageClass.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Welfare/OperationBase.cs 201 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Welfare/OperationBase.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Welfare/OperationBossReborn.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Welfare/OperationBossReborn.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Welfare/OperationConsumeRebate.cs 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Welfare/OperationConsumeRebate.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Welfare/OperationFlashSale.cs 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Welfare/OperationFlashSale.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Welfare/OperationMultiExp.cs 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Welfare/OperationMultiExp.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Welfare/OperationMultipleRealmPoint.cs 126 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Welfare/OperationMultipleRealmPoint.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Welfare/OperationTimeHepler.cs 817 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI/Effect/TimeMgr.cs 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/FlashSaleModel.cs
@@ -79,16 +79,6 @@
            }
        }
        public bool InAdvanceOpen
        {
            get
            {
                OperationBase operationBase;
                OperationTimeHepler.Instance.TryGetOperationTime(Operation.FlashSale, out operationBase);
                return operationBase != null && operationBase.SatisfyOpenCondition() && operationBase.InAdvanceTime(TimeUtility.ServerNow);
            }
        }
        public bool priorityOpen
        {
            get
@@ -103,10 +93,6 @@
            if (OperationTimeHepler.Instance.TryGetOperationTime(Operation.FlashSale, out operationBase))
            {
                OperationFlashSale operation = operationBase as OperationFlashSale;
                if (operation.InAdvanceTime(TimeUtility.ServerNow))
                {
                    return;
                }
                if (!operation.InTime(TimeUtility.ServerNow))
                {
                    SysNotifyMgr.Instance.ShowTip("ActiveOutTime");
System/Welfare/GiftPackageClass.cs
New file
@@ -0,0 +1,88 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Snxxz.UI
{
    public class GiftPackageClass : OperationBase
    {
        public List<Gift_Package> giftpackage1 = new List<Gift_Package>();
        public int IndexOfFlashShop()
        {
            if (giftpackage1.Count == 1)
            {
                return 0;
            }
            var _timeIndex = IndexOfOpenTime(TimeUtility.ServerNow);
            if (_timeIndex == -1)
            {
                return -1;
            }
            return Mathf.Min(giftpackage1.Count - 1, allDay ? 0 : _timeIndex);
        }
        public GiftPackageGift GetFlashSaleGift(int _index, int _id)
        {
            if (_index < giftpackage1.Count)
            {
                for (int i = 0; i < giftpackage1[_index].gifts.Length; i++)
                {
                    if (giftpackage1[_index].gifts[i].id == _id)
                    {
                        return giftpackage1[_index].gifts[i];
                    }
                }
            }
            return default(GiftPackageGift);
        }
        public override bool SatisfyOpenCondition()
        {
            return PlayerDatas.Instance.baseData.LV >= limitLv;
        }
        public override void Reset()
        {
            base.Reset();
            giftpackage1.Clear();
        }
        public override string ToDisplayTime()
        {
            var textBuilder = OperationTimeHepler.textBuilder;
            textBuilder.Length = 0;
            textBuilder.Append(startDate.ToDisplay());
            if (startDate != endDate)
            {
                textBuilder.Append("—");
                textBuilder.Append(endDate.ToDisplay());
            }
            return textBuilder.ToString();
        }
        public struct Gift_Package
        {
            public GiftPackageGift[] gifts;
        }
        public struct GiftPackageGift
        {
            public int id;
            public int limitNum;//限购数
            public int rmb;//人民币
            public int rmbOriginal;//原价
            public string OrderInfo;//商品编号
            public int OrderInfoLength;//长度
            public GiftPackageItem[] items;
        }
        public struct GiftPackageItem
        {
            public int itemId;
            public int itemCount;
            public int isBind;
            public bool isMainItem;
        }
    }
}
System/Welfare/GiftPackageClass.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 5051eb1dd73718a418d483105847c859
timeCreated: 1536803961
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/Welfare/OperationBase.cs
New file
@@ -0,0 +1,201 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Snxxz.UI
{
    public class OperationBase
    {
        public OperationDate startDate;
        public OperationDate endDate;
        public List<OperationTime> times = new List<OperationTime>();
        OperationDateEnumerator m_DateEnumerator = null;
        public OperationDateEnumerator dateEnumerator
        {
            get
            {
                if (m_DateEnumerator == null)
                {
                    m_DateEnumerator = new OperationDateEnumerator(startDate, endDate);
                }
                return m_DateEnumerator;
            }
        }
        /// <summary>
        /// 是否每日重置
        /// </summary>
        public bool dayReset = false;
        /// <summary>
        /// 0-0点重置,1-5点重置
        /// </summary>
        public int resetType = 0;
        public const int DayResetHour = 5;
        public bool stepTimeNotify = false;
        public bool stepDateNotify = false;
        public bool inTimeNotify = false;
        public bool inDateNotify = false;
        public int limitLv;
        public bool allDay
        {
            get { return times.Count <= 0; }
        }
        public int totalDays
        {
            get { return endDate - startDate; }
        }
        public bool InTime(DateTime time)
        {
            if (!InDay(time))
            {
                return false;
            }
            if (allDay)
            {
                return InDayResetTime(time);
            }
            for (int i = 0; i < times.Count; i++)
            {
                if (times[i].InTime(time))
                {
                    return true;
                }
            }
            return false;
        }
        bool InDayResetTime(DateTime time)
        {
            if (!InDay(time))
            {
                return false;
            }
            switch (resetType)
            {
                case 0:
                    return true;
                case 1:
                    var indexOfDays = IndexOfDays(time);
                    if (indexOfDays == 0)
                    {
                        return time.Hour >= DayResetHour;
                    }
                    if (indexOfDays == totalDays)
                    {
                        return time.Hour < DayResetHour;
                    }
                    break;
            }
            return false;
        }
        public bool InDay(DateTime time)
        {
            OperationDate date = new OperationDate()
            {
                year = time.Year,
                month = time.Month,
                day = time.Day,
            };
            return date >= startDate && date <= endDate;
        }
        public int IndexOfDays(DateTime time)
        {
            if (!InDay(time))
            {
                return -1;
            }
            DateTime s = new DateTime(startDate.year, startDate.month, startDate.day);
            return (time - s).Days;
        }
        public int IndexOfOpenTime(DateTime time)
        {
            if (!InTime(time))
            {
                return -1;
            }
            if (allDay)
            {
                return 0;
            }
            for (int i = 0; i < times.Count; i++)
            {
                if (times[i].InTime(time))
                {
                    return i;
                }
            }
            return -1;
        }
        public int GetSurplusTime(DateTime time)
        {
            var seconds = 0;
            if (InTime(time))
            {
                if (allDay)
                {
                    seconds += GetSurplusDayResetTime(time);
                }
                else
                {
                    for (int i = 0; i < times.Count; i++)
                    {
                        if (times[i].InTime(time))
                        {
                            seconds += times[i] - time;
                            break;
                        }
                    }
                }
            }
            return seconds;
        }
        int GetSurplusDayResetTime(DateTime time)
        {
            switch (resetType)
            {
                case 0:
                    return (int)(endDate.AddSeconds(24 * 60 * 60) - time).TotalSeconds;
                case 1:
                    var endTime = new DateTime(endDate.year, endDate.month, endDate.day, DayResetHour, 0, 0);
                    return (int)(endTime - time).TotalSeconds;
            }
            return 0;
        }
        public virtual string ToDisplayTime()
        {
            return string.Empty;
        }
        public virtual void Reset()
        {
            stepTimeNotify = false;
            stepDateNotify = false;
            inTimeNotify = false;
            inDateNotify = false;
            dayReset = false;
            resetType = 0;
            limitLv = 0;
            times.Clear();
        }
        public virtual bool SatisfyOpenCondition()
        {
            return PlayerDatas.Instance.baseData.LV >= limitLv;
        }
    }
}
System/Welfare/OperationBase.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d7a32da08ee54c94aa3e7054a83a2446
timeCreated: 1536804239
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/Welfare/OperationBossReborn.cs
New file
@@ -0,0 +1,14 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Snxxz.UI
{
    public class OperationBossReborn : OperationBase
    {
        public override bool SatisfyOpenCondition()
        {
            return PlayerDatas.Instance.baseData.LV >= limitLv;
        }
    }
}
System/Welfare/OperationBossReborn.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 871a52c1c3a7e6140bb40344a7daa763
timeCreated: 1536803824
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/Welfare/OperationConsumeRebate.cs
New file
@@ -0,0 +1,68 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Snxxz.UI
{
    public class OperationConsumeRebate : OperationBase
    {
        public List<Rebate> rebates = new List<Rebate>();
        public override bool SatisfyOpenCondition()
        {
            return PlayerDatas.Instance.baseData.LV >= limitLv;
        }
        public override string ToDisplayTime()
        {
            var textBuilder = OperationTimeHepler.textBuilder;
            textBuilder.Length = 0;
            textBuilder.Append(startDate.ToDisplay());
            if (startDate != endDate)
            {
                textBuilder.Append("—");
                textBuilder.Append(endDate.ToDisplay());
            }
            return textBuilder.ToString();
        }
        public override void Reset()
        {
            base.Reset();
            rebates.Clear();
        }
        public Rebate GetRebate(DateTime time)
        {
            if (rebates.Count == 0)
            {
                return null;
            }
            var index = IndexOfDays(time);
            if (index != -1 && index < rebates.Count)
            {
                return rebates[index];
            }
            return rebates[rebates.Count - 1];
        }
        public class Rebate
        {
            public List<RebateGrade> rebateGrades = new List<RebateGrade>();
        }
        public class RebateGrade
        {
            public int needGold;
            public int index;//奖励索引
            public List<Item> items = new List<Item>();
        }
        public struct Item
        {
            public int itemId;
            public int count;
            public int isBind;
        }
    }
}
System/Welfare/OperationConsumeRebate.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 1bfa06ccdcd3afa4cafd3c186ce338e4
timeCreated: 1536803885
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/Welfare/OperationFlashSale.cs
New file
@@ -0,0 +1,112 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Snxxz.UI
{
    public class OperationFlashSale : OperationBase
    {
        public List<FlashSale> flashShops = new List<FlashSale>();
        public int IndexOfFlashShop()
        {
            if (flashShops.Count == 1)
            {
                return 0;
            }
            var _timeIndex = IndexOfOpenTime(TimeUtility.ServerNow);
            if (_timeIndex == -1)
            {
                return -1;
            }
            return Mathf.Min(flashShops.Count - 1, allDay ? 0 : _timeIndex);
        }
        public FlashSaleGift GetFlashSaleGift(int _index, int _id)
        {
            if (_index < flashShops.Count)
            {
                for (int i = 0; i < flashShops[_index].gifts.Length; i++)
                {
                    if (flashShops[_index].gifts[i].id == _id)
                    {
                        return flashShops[_index].gifts[i];
                    }
                }
            }
            return default(FlashSaleGift);
        }
        public override bool SatisfyOpenCondition()
        {
            return PlayerDatas.Instance.baseData.LV >= limitLv;
        }
        public override void Reset()
        {
            base.Reset();
            flashShops.Clear();
        }
        public override string ToDisplayTime()
        {
            var textBuilder = OperationTimeHepler.textBuilder;
            textBuilder.Length = 0;
            textBuilder.Append(startDate.ToDisplay());
            if (startDate != endDate)
            {
                textBuilder.Append("—");
                textBuilder.Append(endDate.ToDisplay());
            }
            return textBuilder.ToString();
        }
        public int GetSurplusTime(int index)
        {
            if (!InTime(TimeUtility.ServerNow))
            {
                return 0;
            }
            var seconds = 0;
            if (times.Count == 0)
            {
                DateTime endOperationTime = new DateTime(TimeUtility.Year, TimeUtility.Month,
                        TimeUtility.Day, 0, 0, 0);
                endOperationTime = endOperationTime.AddDays(1);
                seconds = (int)(endOperationTime - TimeUtility.ServerNow).TotalSeconds;
            }
            if (index >= 0 && index < times.Count)
            {
                var _endTime = times[index];
                DateTime endOperationTime = new DateTime(TimeUtility.Year, TimeUtility.Month,
                        TimeUtility.Day, _endTime.endHour, _endTime.endMinute, 0);
                seconds = (int)(endOperationTime - TimeUtility.ServerNow).TotalSeconds;
            }
            return seconds;
        }
        public struct FlashSale
        {
            public FlashSaleGift[] gifts;
        }
        public struct FlashSaleGift
        {
            public int id;
            public int limitNum;
            public int moneyType;
            public int moneyNumber;
            public int moneyOriginal;
            public FlashSaleItem[] items;
        }
        public struct FlashSaleItem
        {
            public int itemId;
            public int itemCount;
            public int isBind;
            public bool isMainItem;
        }
    }
}
System/Welfare/OperationFlashSale.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 72f839fb443541941a4b633bb0fbc1ce
timeCreated: 1536804031
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/Welfare/OperationMultiExp.cs
New file
@@ -0,0 +1,55 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Snxxz.UI
{
    public class OperationMultiExp : OperationBase
    {
        public int multiple;
        public override string ToDisplayTime()
        {
            var textBuilder = OperationTimeHepler.textBuilder;
            textBuilder.Length = 0;
            if (allDay)
            {
                textBuilder.Append(Language.Get("OpenAllDay"));
            }
            else
            {
                if (startDate != endDate)
                {
                    textBuilder.Append(Language.Get("EveryDay"));
                }
                for (int i = 0, n = times.Count; i < n; i++)
                {
                    textBuilder.Append(times[i].ToString());
                    if (i < n - 1)
                    {
                        textBuilder.Append("、");
                    }
                }
            }
            return textBuilder.ToString();
        }
        public override bool SatisfyOpenCondition()
        {
            return PlayerDatas.Instance.baseData.LV >= limitLv;
        }
        public string GetMultipleCHS()
        {
            if (multiple / 10000 == 2)
            {
                return Language.Get("Num_CHS_Double");
            }
            else
            {
                return Language.Get(StringUtility.Contact("Num_CHS_", multiple / 10000));
            }
        }
    }
}
System/Welfare/OperationMultiExp.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 7440669afa465c14dbc84fb90070c92a
timeCreated: 1536804176
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/Welfare/OperationMultipleRealmPoint.cs
New file
@@ -0,0 +1,126 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Snxxz.UI
{
    public class OperationMultipleRealmPoint : OperationBase
    {
        public int multiplePractice; //倍数
        public int startHour = 5;
        public int startMinute = 0;
        public int startSecond = 0;
        public override bool SatisfyOpenCondition()
        {
            return PlayerDatas.Instance.baseData.LV >= limitLv;
        }
        public bool InActiveTime(DateTime time)
        {
            if (time.Year != startDate.year && time.Year != endDate.year)
            {
                return false;
            }
            if (startDate.year != endDate.year)
            {
                if (time.Year == startDate.year)
                {
                    if (time.Month < startDate.month)
                    {
                        return false;
                    }
                    else if (time.Month == startDate.month && time.Day < startDate.day)
                    {
                        return false;
                    }
                    else if (time.Month == startDate.month
                        && time.Day == startDate.day
                        && time.Hour < startHour)
                    {
                        return false;
                    }
                    else if (time.Month == startDate.month
                       && time.Day == startDate.day
                       && time.Hour == startHour
                       && time.Minute < startMinute)
                    {
                        return false;
                    }
                    else if (time.Month == startDate.month
                      && time.Day == startDate.day
                      && time.Hour == startHour
                      && time.Minute == startMinute
                        && time.Second < startSecond)
                    {
                        return false;
                    }
                }
                else if (time.Year == endDate.year)
                {
                    if (time.Month > endDate.month)
                    {
                        return false;
                    }
                    else if (time.Month == endDate.month && time.Day > endDate.day)
                    {
                        return false;
                    }
                    else if (time.Month == endDate.month
                        && time.Day == endDate.day
                        && time.Hour > startHour)
                    {
                        return false;
                    }
                    else if (time.Month == endDate.month
                       && time.Day == endDate.day
                       && time.Hour == startHour
                       && time.Minute > startMinute)
                    {
                        return false;
                    }
                    else if (time.Month == endDate.month
                      && time.Day == endDate.day
                      && time.Hour == startHour
                      && time.Minute == startMinute
                        && time.Second > startSecond)
                    {
                        return false;
                    }
                }
            }
            else
            {
                if (time.Month < startDate.month
                    || (time.Month == startDate.month && time.Day < startDate.day)
                    || (time.Month == startDate.month && time.Day == startDate.day && time.Hour < startHour)
                    || (time.Month == startDate.month && time.Day == startDate.day && time.Hour == startHour && time.Minute < startMinute)
                    || (time.Month == startDate.month && time.Day == startDate.day && time.Hour == startHour && time.Minute == startMinute) && time.Second < startSecond)
                {
                    return false;
                }
                if (time.Month > endDate.month
                    || (time.Month == endDate.month && time.Day > endDate.day)
                    || (time.Month == endDate.month && time.Day == endDate.day && time.Hour > startHour)
                     || (time.Month == endDate.month && time.Day == endDate.day && time.Hour == startHour && time.Minute > startMinute)
                    || (time.Month == endDate.month && time.Day == endDate.day && time.Hour == startHour && time.Minute == startMinute) && time.Second > startSecond)
                {
                    return false;
                }
            }
            return true;
        }
        public int GetRemainTime(DateTime time)
        {
            var seconds = 0;
            if (InActiveTime(time))
            {
                DateTime endTime = new DateTime(endDate.year, endDate.month, endDate.day, startHour, 0, 0);
                seconds = (int)(endTime - time).TotalSeconds;
            }
            return seconds;
        }
    }
}
System/Welfare/OperationMultipleRealmPoint.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 7b9f0fb0bdae59749b657f227e556d59
timeCreated: 1536803704
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/Welfare/OperationTimeHepler.cs
@@ -15,11 +15,12 @@
        public event Action<Operation> operationServerCloseEvent;//特殊情况下触发
        public event Action<Operation, int> operationEndEvent;//活动结束时间触发  第二个参数0--过活动时间触发  1--过活动天触发
        public event Action<Operation, int> operationStartEvent;//活动开始时间并且满足开启条件触发 第二个参数0--活动时间触发  1--活动天触发
        public event Action<Operation> operationAdvanceEvent;//活动提前开放事件
        public event Action<int> dayResetEvent;//活动重置事件0-0点 1-5点
        public OperationTimeHepler()
        {
            DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerDataInitializeEvent;
            GlobalTimeEvent.Instance.secondEvent += SecondEvent;
            TimeMgr.Instance.OnHourEvent += HourEvent;
        }
        private void BeforePlayerDataInitializeEvent()
@@ -64,7 +65,6 @@
                    {
                        operation.inTimeNotify = true;
                        operation.stepTimeNotify = false;
                        operation.inAdvanceNotify = false;
                        DebugEx.LogFormat("{0}  活动时间开始", (Operation)i);
                        if (operationStartEvent != null)
                        {
@@ -81,16 +81,19 @@
                            operationEndEvent((Operation)i, 0);
                        }
                    }
                    if (!operation.inAdvanceNotify && operation.InAdvanceTime(TimeUtility.ServerNow))
                    {
                        operation.inAdvanceNotify = true;
                        if (operationAdvanceEvent != null)
                        {
                            operationAdvanceEvent((Operation)i);
                        }
                    }
                }
            }
        }
        private void HourEvent()
        {
            if (TimeUtility.Hour == 0 && dayResetEvent != null)
            {
                dayResetEvent(0);
            }
            if (TimeUtility.Hour == 5 && dayResetEvent != null)
            {
                dayResetEvent(1);
            }
        }
@@ -131,17 +134,10 @@
                operation.endDate = ParseOperationDate(package.EndtDate);
                operation.limitLv = package.LimitLV;
                (operation as OperationMultiExp).multiple = (int)package.AddExpRate + 10000;
                if (package.ActivityTimeCount == 0)
                for (int i = 0; i < package.ActivityTimeCount; i++)
                {
                    operation.allDay = true;
                }
                else
                {
                    for (int i = 0; i < package.ActivityTimeCount; i++)
                    {
                        operation.times.Add(ParseOperationTime(package.ActivityTime[i].StartTime,
                            package.ActivityTime[i].EndtTime));
                    }
                    operation.times.Add(ParseOperationTime(package.ActivityTime[i].StartTime,
                        package.ActivityTime[i].EndtTime));
                }
                if (operationTimeUpdateEvent != null)
                {
@@ -186,7 +182,6 @@
                operation.limitLv = package.LimitLV;
                operation.startDate = ParseOperationDate(package.StartDate);
                operation.endDate = ParseOperationDate(package.EndtDate);
                operation.allDay = true;
                operation.dayReset = package.IsDayReset == 1;
                for (int i = 0; i < package.AwardDays; i++)
                {
@@ -253,21 +248,12 @@
                operation.limitLv = package.LimitLV;
                operation.startDate = ParseOperationDate(package.StartDate);
                operation.endDate = ParseOperationDate(package.EndtDate);
                operation.dateEnumerator = new OperationDateEnumerator(operation.startDate, operation.endDate);
                operation.dayReset = package.IsDayReset == 1;
                if (package.ActivityTimeCount == 0)
                for (int i = 0; i < package.ActivityTimeCount; i++)
                {
                    operation.allDay = true;
                    operation.times.Add(ParseOperationTime(package.ActivityTime[i].StartTime,
                        package.ActivityTime[i].EndtTime));
                }
                else
                {
                    for (int i = 0; i < package.ActivityTimeCount; i++)
                    {
                        operation.times.Add(ParseOperationTime(package.ActivityTime[i].StartTime,
                            package.ActivityTime[i].EndtTime));
                    }
                }
                for (int i = 0; i < package.ShopCount; i++)
                {
                    var flashShop = new OperationFlashSale.FlashSale();
@@ -341,17 +327,10 @@
                operation.startDate = ParseOperationDate(package.StartDate);
                operation.endDate = ParseOperationDate(package.EndtDate);
                operation.dayReset = package.IsDayReset == 1;
                if (package.ActivityTimeCount == 0)
                for (int i = 0; i < package.ActivityTimeCount; i++)
                {
                    operation.allDay = true;
                }
                else
                {
                    for (int i = 0; i < package.ActivityTimeCount; i++)
                    {
                        operation.times.Add(ParseOperationTime(package.ActivityTime[i].StartTime,
                            package.ActivityTime[i].EndtTime));
                    }
                    operation.times.Add(ParseOperationTime(package.ActivityTime[i].StartTime,
                        package.ActivityTime[i].EndtTime));
                }
                for (int i = 0; i < package.GiftbagTypeCount; i++)
                {
@@ -423,7 +402,6 @@
                operationBase.Reset();
                operationBase.limitLv = package.LimitLV;
                operationBase.allDay = true;
                operationBase.startDate = ParseOperationDate(package.StartDate);
                operationBase.endDate = ParseOperationDate(package.EndtDate);
@@ -467,7 +445,6 @@
                operation.startDate = ParseOperationDate(package.StartDate);
                operation.endDate = ParseOperationDate(package.EndtDate);
                operation.limitLv = package.LimitLV;
                operation.allDay = true;
                if (operationTimeUpdateEvent != null)
                {
                    operationTimeUpdateEvent(Operation.FairyCeremony);
@@ -511,7 +488,6 @@
                operation.startDate = ParseOperationDate(package.StartDate);
                operation.endDate = ParseOperationDate(package.EndtDate);
                operation.limitLv = package.LimitLV;
                operation.allDay = true;
                (operation as OperationMultipleRealmPoint).multiplePractice = package.Multiple;
                if (operationTimeUpdateEvent != null)
                {
@@ -541,17 +517,6 @@
            if (TryGetOperationTime(type, out operation))
            {
                return operation.InDay(TimeUtility.ServerNow);
            }
            return false;
        }
        public bool SideOfTime(Operation type, out int side)
        {
            side = 0;
            OperationBase operation;
            if (TryGetOperationTime(type, out operation))
            {
                return operation.SideOfTime(TimeUtility.ServerNow, out side);
            }
            return false;
        }
@@ -605,7 +570,7 @@
            OperationBase operation;
            if (TryGetOperationTime(type, out operation))
            {
                return operation.IndexOfOpenDay(TimeUtility.ServerNow);
                return operation.IndexOfDays(TimeUtility.ServerNow);
            }
            return -1;
        }
@@ -620,6 +585,24 @@
                    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)))
                {
                    DebugEx.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);
@@ -661,9 +644,7 @@
        {
            get
            {
                var date = start;
                date.day += index;
                return date;
                return start.AddDays(index);
            }
        }
@@ -705,10 +686,57 @@
            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.AddDays(_days);
            return new OperationDate()
            {
                year = d.Year,
                month = d.Month,
                day = d.Day,
            };
        }
        public string ToDisplay(bool showYear = true)
@@ -771,670 +799,7 @@
            return Mathf.Max(0, (int)(d - y).TotalSeconds);
        }
    }
    public class OperationBase
    {
        public OperationDate startDate;
        public OperationDate endDate;
        public List<OperationTime> times = new List<OperationTime>();
        public OperationDateEnumerator dateEnumerator;
        public bool allDay = false;
        public bool stepTimeNotify = false;
        public bool stepDateNotify = false;
        public bool inTimeNotify = false;
        public bool inDateNotify = false;
        public bool inAdvanceNotify = false;
        public int inAdvanceSeconds = 0;
        public int limitLv;
        public bool InTime(DateTime time)
        {
            if (!InDay(time))
            {
                return false;
            }
            if (allDay)
            {
                return true;
            }
            for (int i = 0; i < times.Count; i++)
            {
                if (times[i].InTime(time))
                {
                    return true;
                }
            }
            return false;
        }
        public bool SideOfTime(DateTime time, out int side)
        {
            side = 0;
            if (!InDay(time))
            {
                return false;
            }
            if (allDay)
            {
                side = 0;
                return true;
            }
            for (int i = 0; i < times.Count; i++)
            {
                side = times[i].SideOfTime(time);
            }
            return true;
        }
        public bool InDay(DateTime time)
        {
            if (time.Year != startDate.year && time.Year != endDate.year)
            {
                return false;
            }
            if (startDate.year != endDate.year)
            {
                if (time.Year == startDate.year)
                {
                    if (time.Month < startDate.month)
                    {
                        return false;
                    }
                    else if (time.Month == startDate.month && time.Day < startDate.day)
                    {
                        return false;
                    }
                }
                else if (time.Year == endDate.year)
                {
                    if (time.Month > endDate.month)
                    {
                        return false;
                    }
                    else if (time.Month == endDate.month && time.Day > endDate.day)
                    {
                        return false;
                    }
                }
            }
            else
            {
                if (time.Month < startDate.month || (time.Month == startDate.month && time.Day < startDate.day))
                {
                    return false;
                }
                if (time.Month > endDate.month || (time.Month == endDate.month && time.Day > endDate.day))
                {
                    return false;
                }
            }
            return true;
        }
        public int IndexOfOpenDay(DateTime time)
        {
            if (!InDay(time))
            {
                return -1;
            }
            DateTime s = new DateTime(startDate.year, startDate.month, startDate.day);
            return (time - s).Days;
        }
        public int IndexOfOpenTime(DateTime time)
        {
            if (!InTime(time))
            {
                return -1;
            }
            if (allDay)
            {
                return 0;
            }
            for (int i = 0; i < times.Count; i++)
            {
                if (times[i].InTime(time))
                {
                    return i;
                }
            }
            return -1;
        }
        public bool InAdvanceTime(DateTime time)
        {
            if (InTime(time) || inAdvanceSeconds <= 0)
            {
                return false;
            }
            var seconds = 0;
            if (TryGetInAdvanceSurplusSecond(time, out seconds))
            {
                return seconds < inAdvanceSeconds;
            }
            return false;
        }
        public bool TryGetInAdvanceSurplusSecond(DateTime time, out int seconds)
        {
            seconds = 0;
            if (InTime(time))
            {
                return false;
            }
            if (allDay)
            {
                var startTime = new DateTime(startDate.year, startDate.month, startDate.day);
                seconds = (int)(startTime - time).TotalSeconds;
            }
            else
            {
                if (dateEnumerator != null)
                {
                    foreach (OperationDate date in dateEnumerator)
                    {
                        for (int i = 0; i < times.Count; i++)
                        {
                            var startTime = new DateTime(date.year, date.month, date.day, times[i].startHour, times[i].startMinute, 0);
                            seconds = (int)(startTime - time).TotalSeconds;
                            if (seconds > 0)
                            {
                                break;
                            }
                        }
                        if (seconds > 0)
                        {
                            dateEnumerator.Reset();
                            break;
                        }
                    }
                }
            }
            return seconds > 0;
        }
        public int GetSurplusTime(DateTime time)
        {
            var seconds = 0;
            if (InTime(time))
            {
                if (allDay)
                {
                    seconds += (int)(endDate.AddSeconds(24 * 60 * 60) - time).TotalSeconds;
                }
                else
                {
                    for (int i = 0; i < times.Count; i++)
                    {
                        if (times[i].InTime(time))
                        {
                            seconds += times[i] - time;
                            break;
                        }
                    }
                }
            }
            return seconds;
        }
        public virtual string ToDisplayTime()
        {
            return string.Empty;
        }
        public virtual void Reset()
        {
            stepTimeNotify = false;
            stepDateNotify = false;
            inTimeNotify = false;
            inDateNotify = false;
            inAdvanceNotify = false;
            allDay = false;
            inAdvanceSeconds = 0;
            limitLv = 0;
            times.Clear();
        }
        public virtual bool SatisfyOpenCondition()
        {
            return PlayerDatas.Instance.baseData.LV >= limitLv;
        }
    }
    public class OperationMultiExp : OperationBase
    {
        public int multiple;
        public override string ToDisplayTime()
        {
            var textBuilder = OperationTimeHepler.textBuilder;
            textBuilder.Length = 0;
            if (allDay)
            {
                textBuilder.Append(Language.Get("OpenAllDay"));
            }
            else
            {
                if (startDate != endDate)
                {
                    textBuilder.Append(Language.Get("EveryDay"));
                }
                for (int i = 0, n = times.Count; i < n; i++)
                {
                    textBuilder.Append(times[i].ToString());
                    if (i < n - 1)
                    {
                        textBuilder.Append("、");
                    }
                }
            }
            return textBuilder.ToString();
        }
        public override bool SatisfyOpenCondition()
        {
            return PlayerDatas.Instance.baseData.LV >= limitLv;
        }
        public string GetMultipleCHS()
        {
            if (multiple / 10000 == 2)
            {
                return Language.Get("Num_CHS_Double");
            }
            else
            {
                return Language.Get(StringUtility.Contact("Num_CHS_", multiple / 10000));
            }
        }
    }
    public class OperationFlashSale : OperationBase
    {
        public bool dayReset = false;
        public List<FlashSale> flashShops = new List<FlashSale>();
        public int IndexOfFlashShop()
        {
            if (flashShops.Count == 1)
            {
                return 0;
            }
            var _timeIndex = IndexOfOpenTime(TimeUtility.ServerNow);
            if (_timeIndex == -1)
            {
                return -1;
            }
            return Mathf.Min(flashShops.Count - 1, allDay ? 0 : _timeIndex);
        }
        public FlashSaleGift GetFlashSaleGift(int _index, int _id)
        {
            if (_index < flashShops.Count)
            {
                for (int i = 0; i < flashShops[_index].gifts.Length; i++)
                {
                    if (flashShops[_index].gifts[i].id == _id)
                    {
                        return flashShops[_index].gifts[i];
                    }
                }
            }
            return default(FlashSaleGift);
        }
        public override bool SatisfyOpenCondition()
        {
            return PlayerDatas.Instance.baseData.LV >= limitLv;
        }
        public override void Reset()
        {
            base.Reset();
            flashShops.Clear();
        }
        public override string ToDisplayTime()
        {
            var textBuilder = OperationTimeHepler.textBuilder;
            textBuilder.Length = 0;
            textBuilder.Append(startDate.ToDisplay());
            if (startDate != endDate)
            {
                textBuilder.Append("—");
                textBuilder.Append(endDate.ToDisplay());
            }
            return textBuilder.ToString();
        }
        public int GetSurplusTime(int index)
        {
            if (!InTime(TimeUtility.ServerNow))
            {
                return 0;
            }
            var seconds = 0;
            if (times.Count == 0)
            {
                DateTime endOperationTime = new DateTime(TimeUtility.Year, TimeUtility.Month,
                        TimeUtility.Day, 0, 0, 0);
                endOperationTime = endOperationTime.AddDays(1);
                seconds = (int)(endOperationTime - TimeUtility.ServerNow).TotalSeconds;
            }
            if (index >= 0 && index < times.Count)
            {
                var _endTime = times[index];
                DateTime endOperationTime = new DateTime(TimeUtility.Year, TimeUtility.Month,
                        TimeUtility.Day, _endTime.endHour, _endTime.endMinute, 0);
                seconds = (int)(endOperationTime - TimeUtility.ServerNow).TotalSeconds;
            }
            return seconds;
        }
        public struct FlashSale
        {
            public FlashSaleGift[] gifts;
        }
        public struct FlashSaleGift
        {
            public int id;
            public int limitNum;
            public int moneyType;
            public int moneyNumber;
            public int moneyOriginal;
            public FlashSaleItem[] items;
        }
        public struct FlashSaleItem
        {
            public int itemId;
            public int itemCount;
            public int isBind;
            public bool isMainItem;
        }
    }
    public class GiftPackageClass : OperationBase
    {
        public bool dayReset = false;
        public List<Gift_Package> giftpackage1 = new List<Gift_Package>();
        public int IndexOfFlashShop()
        {
            if (giftpackage1.Count == 1)
            {
                return 0;
            }
            var _timeIndex = IndexOfOpenTime(TimeUtility.ServerNow);
            if (_timeIndex == -1)
            {
                return -1;
            }
            return Mathf.Min(giftpackage1.Count - 1, allDay ? 0 : _timeIndex);
        }
        public GiftPackageGift GetFlashSaleGift(int _index, int _id)
        {
            if (_index < giftpackage1.Count)
            {
                for (int i = 0; i < giftpackage1[_index].gifts.Length; i++)
                {
                    if (giftpackage1[_index].gifts[i].id == _id)
                    {
                        return giftpackage1[_index].gifts[i];
                    }
                }
            }
            return default(GiftPackageGift);
        }
        public override bool SatisfyOpenCondition()
        {
            return PlayerDatas.Instance.baseData.LV >= limitLv;
        }
        public override void Reset()
        {
            base.Reset();
            giftpackage1.Clear();
        }
        public override string ToDisplayTime()
        {
            var textBuilder = OperationTimeHepler.textBuilder;
            textBuilder.Length = 0;
            textBuilder.Append(startDate.ToDisplay());
            if (startDate != endDate)
            {
                textBuilder.Append("—");
                textBuilder.Append(endDate.ToDisplay());
            }
            return textBuilder.ToString();
        }
        public struct Gift_Package
        {
            public GiftPackageGift[] gifts;
        }
        public struct GiftPackageGift
        {
            public int id;
            public int limitNum;//限购数
            public int rmb;//人民币
            public int rmbOriginal;//原价
            public string OrderInfo;//商品编号
            public int OrderInfoLength;//长度
            public GiftPackageItem[] items;
        }
        public struct GiftPackageItem
        {
            public int itemId;
            public int itemCount;
            public int isBind;
            public bool isMainItem;
        }
    }
    public class OperationConsumeRebate : OperationBase
    {
        public bool dayReset = false;
        public List<Rebate> rebates = new List<Rebate>();
        public override bool SatisfyOpenCondition()
        {
            return PlayerDatas.Instance.baseData.LV >= limitLv;
        }
        public override string ToDisplayTime()
        {
            var textBuilder = OperationTimeHepler.textBuilder;
            textBuilder.Length = 0;
            textBuilder.Append(startDate.ToDisplay());
            if (startDate != endDate)
            {
                textBuilder.Append("—");
                textBuilder.Append(endDate.ToDisplay());
            }
            return textBuilder.ToString();
        }
        public override void Reset()
        {
            base.Reset();
            rebates.Clear();
        }
        public Rebate GetRebate(DateTime time)
        {
            if (rebates.Count == 0)
            {
                return null;
            }
            var index = IndexOfOpenDay(time);
            if (index != -1 && index < rebates.Count)
            {
                return rebates[index];
            }
            return rebates[rebates.Count - 1];
        }
        public class Rebate
        {
            public List<RebateGrade> rebateGrades = new List<RebateGrade>();
        }
        public class RebateGrade
        {
            public int needGold;
            public int index;//奖励索引
            public List<Item> items = new List<Item>();
        }
        public struct Item
        {
            public int itemId;
            public int count;
            public int isBind;
        }
    }
    public class OperationBossReborn : OperationBase
    {
        public override bool SatisfyOpenCondition()
        {
            return PlayerDatas.Instance.baseData.LV >= limitLv;
        }
    }
    public class OperationMultipleRealmPoint : OperationBase
    {
        public int multiplePractice; //倍数
        public int startHour = 5;
        public int startMinute = 0;
        public int startSecond = 0;
        public override bool SatisfyOpenCondition()
        {
            return PlayerDatas.Instance.baseData.LV >= limitLv;
        }
        public  bool InActiveTime(DateTime time)
        {
            if (time.Year != startDate.year && time.Year != endDate.year)
            {
                return false;
            }
            if (startDate.year != endDate.year)
            {
                if (time.Year == startDate.year)
                {
                    if (time.Month < startDate.month)
                    {
                        return false;
                    }
                    else if (time.Month == startDate.month && time.Day < startDate.day)
                    {
                        return false;
                    }
                    else if(time.Month == startDate.month
                        && time.Day == startDate.day
                        && time.Hour < startHour)
                    {
                        return false;
                    }
                    else if (time.Month == startDate.month
                       && time.Day == startDate.day
                       && time.Hour == startHour
                       && time.Minute < startMinute)
                    {
                        return false;
                    }
                    else if (time.Month == startDate.month
                      && time.Day == startDate.day
                      && time.Hour == startHour
                      && time.Minute == startMinute
                        && time.Second < startSecond)
                    {
                        return false;
                    }
                }
                else if (time.Year == endDate.year)
                {
                    if (time.Month > endDate.month)
                    {
                        return false;
                    }
                    else if (time.Month == endDate.month && time.Day > endDate.day)
                    {
                        return false;
                    }
                    else if(time.Month == endDate.month
                        && time.Day == endDate.day
                        && time.Hour > startHour)
                    {
                        return false;
                    }
                    else if (time.Month == endDate.month
                       && time.Day == endDate.day
                       && time.Hour == startHour
                       && time.Minute > startMinute)
                    {
                        return false;
                    }
                    else if (time.Month == endDate.month
                      && time.Day == endDate.day
                      && time.Hour == startHour
                      && time.Minute == startMinute
                        && time.Second > startSecond)
                    {
                        return false;
                    }
                }
            }
            else
            {
                if (time.Month < startDate.month
                    || (time.Month == startDate.month && time.Day < startDate.day)
                    || (time.Month == startDate.month && time.Day == startDate.day && time.Hour < startHour)
                    || (time.Month == startDate.month && time.Day == startDate.day && time.Hour == startHour && time.Minute < startMinute)
                    || (time.Month == startDate.month && time.Day == startDate.day && time.Hour == startHour && time.Minute == startMinute) && time.Second < startSecond)
                {
                    return false;
                }
                if (time.Month > endDate.month
                    || (time.Month == endDate.month && time.Day > endDate.day)
                    || (time.Month == endDate.month && time.Day == endDate.day && time.Hour > startHour)
                     || (time.Month == endDate.month && time.Day == endDate.day && time.Hour == startHour && time.Minute > startMinute)
                    || (time.Month == endDate.month && time.Day == endDate.day && time.Hour == startHour && time.Minute == startMinute) && time.Second > startSecond)
                {
                    return false;
                }
            }
            return true;
        }
        public int GetRemainTime(DateTime time)
        {
            var seconds = 0;
            if (InActiveTime(time))
            {
                DateTime endTime = new DateTime(endDate.year, endDate.month, endDate.day, startHour, 0, 0);
                seconds = (int)(endTime - time).TotalSeconds;
            }
            return seconds;
        }
    }
    public enum Operation
    {
UI/Effect/TimeMgr.cs
@@ -7,9 +7,9 @@
{
    private Dictionary<Component, TimeItem> timeItems = new Dictionary<Component, TimeItem>();
    private List<TimeItem> timeItemList = new List<TimeItem>();
    private int m_LastRecordHour = -1;
    private int m_LastRecordMinute = -1;
    public int m_LastRecordDay = -1;
    private int hourBuff = -1;
    private int minuteBuff = -1;
    public int dayBuff = -1;
    public event Action OnDayEvent;
    public event Action OnHourEvent;
    public event Action OnMinuteEvent;
@@ -18,29 +18,29 @@
    {
        try
        {
            if (m_LastRecordDay != TimeUtility.ServerNow.Day)
            if (dayBuff != TimeUtility.ServerNow.Day)
            {
                if (OnDayEvent != null)
                {
                    OnDayEvent();
                }
                m_LastRecordDay = TimeUtility.ServerNow.Day;
                dayBuff = TimeUtility.ServerNow.Day;
            }
            if (m_LastRecordHour != TimeUtility.ServerNow.Hour)
            if (hourBuff != TimeUtility.ServerNow.Hour)
            {
                if (OnHourEvent != null)
                {
                    OnHourEvent();
                }
                m_LastRecordHour = TimeUtility.ServerNow.Hour;
                hourBuff = TimeUtility.ServerNow.Hour;
            }
            if (m_LastRecordMinute != TimeUtility.ServerNow.Minute)
            if (minuteBuff != TimeUtility.ServerNow.Minute)
            {
                if (OnMinuteEvent != null)
                {
                    OnMinuteEvent();
                }
                m_LastRecordMinute = TimeUtility.ServerNow.Minute;
                minuteBuff = TimeUtility.ServerNow.Minute;
            }
        }
        catch (Exception e)