少年修仙传客户端代码仓库
Client_PangDeRong
2018-10-15 75fad082a71c09da282ae25df7d5ac5fd577c852
4074  【前端】限时抢购开发
9个文件已修改
8个文件已添加
586 ■■■■■ 已修改文件
Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA18_tagMCFlashSaleAppointmentInfo.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA18_tagMCFlashSaleAppointmentInfo.cs 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/GMCommand/GMInputWin.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/FlashRushToBuyCoolDown.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/FlashRushToBuyModel.cs 101 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/FlashRushToBuyNotify.cs 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/FlashRushToBuyNotify.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/FlashRushToBuyWin.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/FlashSaleItemCell.cs 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/OpenServerActivityNotifyBase.cs 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/OpenServerActivityNotifyBase.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/OpenServerActivityNotifyModel.cs 179 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/OpenServerActivityNotifyModel.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/OpenServerActivityNotifyWin.cs 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/OpenServerActivityNotifyWin.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/OperationFlashRushToBuy.cs 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/SystemSetting/ActivitiesPushMgr.cs 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA18_tagMCFlashSaleAppointmentInfo.cs
@@ -5,10 +5,12 @@
public class DTCAA18_tagMCFlashSaleAppointmentInfo : DtcBasic {
public class DTCAA18_tagMCFlashSaleAppointmentInfo : DtcBasic
{
    FlashRushToBuyModel rushToBuyModel { get { return ModelCenter.Instance.GetModel<FlashRushToBuyModel>(); } }
    public override void Done(GameNetPackBasic vNetPack) {
    public override void Done(GameNetPackBasic vNetPack)
    {
        base.Done(vNetPack);
Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA18_tagMCFlashSaleAppointmentInfo.cs
@@ -4,16 +4,28 @@
// AA 18 限时抢购活动玩家预约信息 #tagMCFlashSaleAppointmentInfo
public class HAA18_tagMCFlashSaleAppointmentInfo : GameNetPackBasic {
    public byte IsAll;    // 是否全部
    public ushort GoodsCount;    // 商品数
    public  uint[] GoodsList;    // 预约的商品
    public  tagMCFlashSaleAppointmentState[] GoodsList;    // 预约的商品
    public HAA18_tagMCFlashSaleAppointmentInfo () {
        _cmd = (ushort)0xAA18;
    }
    public override void ReadFromBytes (byte[] vBytes) {
        TransBytes (out IsAll, vBytes, NetDataType.BYTE);
        TransBytes (out GoodsCount, vBytes, NetDataType.WORD);
        TransBytes (out GoodsList, vBytes, NetDataType.DWORD, GoodsCount);
        GoodsList = new tagMCFlashSaleAppointmentState[GoodsCount];
        for (int i = 0; i < GoodsCount; i ++) {
            GoodsList[i] = new tagMCFlashSaleAppointmentState();
            TransBytes (out GoodsList[i].GoodsMark, vBytes, NetDataType.DWORD);
            TransBytes (out GoodsList[i].State, vBytes, NetDataType.BYTE);
        }
    }
    public struct tagMCFlashSaleAppointmentState {
        public uint GoodsMark;        // 商品标识
        public byte State;        // 是否预约
    }
}
System/GMCommand/GMInputWin.cs
@@ -87,18 +87,6 @@
            {
                OnClickSendBtn();
            }
            if (Input.GetKeyDown(KeyCode.J))
            {
               if(ModelCenter.Instance.GetModel<FlashRushToBuyModel>().IsOpen)
                {
                    if (!WindowCenter.Instance.IsOpen<FlashRushToBuyWin>())
                    {
                        WindowCenter.Instance.Open<FlashRushToBuyWin>();
                    }
                }
            }
        }
        private void CreateCmdCell()
System/OpenServerActivity/FlashRushToBuyCoolDown.cs
@@ -47,7 +47,8 @@
            if (operation == null) return;
            int seconds = 0;
            OperationTime operationTime;
            FlashRushToBuyModel.FlashRushToBuySate flashState = rushToBuyModel.GetActivityState(out seconds,out operationTime);
            OperationFlashRushToBuy.FlashSaleShop saleShop;
            FlashRushToBuyModel.FlashRushToBuySate flashState = rushToBuyModel.GetActivityState(out seconds,out operationTime,out saleShop);
            isStartReplace = false;
            switch (flashState)
            {
System/OpenServerActivity/FlashRushToBuyModel.cs
@@ -25,6 +25,10 @@
        public void OnPlayerLoginOk()
        {
            if(!WindowCenter.Instance.IsOpen<OpenServerActivityNotifyWin>())
            {
                WindowCenter.Instance.Open<OpenServerActivityNotifyWin>();
            }
            //UpdateRedpoint();
        }
@@ -68,7 +72,7 @@
        public void SetDefaultSelectSaleTime()
        {
            OperationFlashRushToBuy operation = GetOperationFlashRushToBuy();
            if (!presentFlashShop.Equals(default(OperationFlashRushToBuy.FlashSaleShop)))
            if (presentFlashShop != null)
            {
                int seconds = 0;
                int buyState = operation.GetBuyTimeState(TimeUtility.ServerNow,presentFlashShop.dayIndex,presentFlashShop.timeIndex, out seconds);
@@ -99,7 +103,7 @@
        public void ResetFlashShop()
        {
            presentFlashShop = default(OperationFlashRushToBuy.FlashSaleShop);
            presentFlashShop = null;
        }
        #region 本地数据处理
@@ -107,7 +111,7 @@
        public event Action UpdateSelectSaleTimeEvent;
        public void UpdateSelectFlashSaleTime(int dayIndex,int timeIndex)
        {
            presentFlashShop = default(OperationFlashRushToBuy.FlashSaleShop);
            presentFlashShop = null;
            OperationFlashRushToBuy operation = GetOperationFlashRushToBuy();
            if(operation != null)
            {
@@ -134,29 +138,55 @@
        #endregion
        #region 协议
        public event Action UpdateAppointmentEvent;
        public event Action UpdateAllAppointmentEvent;
        public event Action<int> UpdateAppointmentEvent;
        public void UpdateFlashSaleAppointmentInfo(HAA18_tagMCFlashSaleAppointmentInfo appointmentInfo)
        {
            var operation = GetOperationFlashRushToBuy();
            if (operation == null) return;
            for(int i = 0; i < appointmentInfo.GoodsCount; i++)
            if (appointmentInfo.IsAll == 1)
            {
               for(int j = 0; j < operation.flashShops.Count; j++)
                {
                    var saleItems = operation.flashShops[j].items;
                    for (int k = 0; k < saleItems.Length; k++)
                    {
                       if(saleItems[k].shopGuid == appointmentInfo.GoodsList[i])
                        saleItems[k].isAppointment = 0;
                    }
                }
            }
            for (int i = 0; i < appointmentInfo.GoodsCount; i++)
                        {
                            saleItems[k].isAppointment = 1;
                        }
                    }
                }
            }
                var saleItemInfo = appointmentInfo.GoodsList[i];
                for (int j = 0; j < operation.flashShops.Count; j++)
                {
                    var saleItems = operation.flashShops[j].items;
                    for (int k = 0; k < saleItems.Length; k++)
                    {
                       if (saleItems[k].shopGuid == saleItemInfo.GoodsMark)
                        {
                            if(saleItems[k].isAppointment != saleItemInfo.State)
                            {
                                saleItems[k].isAppointment = saleItemInfo.State;
            if(UpdateAppointmentEvent != null)
            {
                UpdateAppointmentEvent();
                                    UpdateAppointmentEvent((int)saleItemInfo.GoodsMark);
            }
                            }
                        }
                    }
                }
            }
            if(appointmentInfo.IsAll == 1)
            {
                if (UpdateAllAppointmentEvent != null)
                {
                    UpdateAllAppointmentEvent();
                }
            }
        }
        /// <summary>
        /// Value1  商品ID  Value2 全服购买次数
@@ -189,9 +219,10 @@
        /// </summary>
        /// <param name="seconds"></param>
        /// <returns></returns>
        public FlashRushToBuySate GetActivityState(out int seconds,out OperationTime operationTime)
        public FlashRushToBuySate GetActivityState(out int seconds,out OperationTime operationTime,out OperationFlashRushToBuy.FlashSaleShop saleShop)
        {
            seconds = 0;
            saleShop = null;
            operationTime = default(OperationTime);
            var operation = GetOperationFlashRushToBuy();
            if (!IsOpen || operation == null) return FlashRushToBuySate.NoOpen;
@@ -200,11 +231,19 @@
            int endState = 0;
            int openSeconds = 0;
            int endSeconds = 0;
            if(operation.flashShops.Count > 0)
            for(int i = 0; i < operation.flashShops.Count;i++)
            {
                OperationFlashRushToBuy.FlashSaleShop openSaleShop = operation.flashShops[0];
                OperationFlashRushToBuy.FlashSaleShop openSaleShop = operation.flashShops[i];
                operationTime = operation.times[openSaleShop.timeIndex];
                openState = operation.GetBuyTimeState(TimeUtility.ServerNow, openSaleShop.dayIndex, openSaleShop.timeIndex,out openSeconds);
                if(openState != 1)
                {
                    saleShop = openSaleShop;
                    break;
                }
            }
            if(operation.flashShops.Count > 0)
            {
                OperationFlashRushToBuy.FlashSaleShop endSaleShop = operation.flashShops[operation.flashShops.Count - 1];
                endState = operation.GetBuyTimeState(TimeUtility.ServerNow, endSaleShop.dayIndex, endSaleShop.timeIndex, out endSeconds);
            }
@@ -214,6 +253,8 @@
                case -1:
                    seconds = openSeconds;
                    return FlashRushToBuySate.InAdvance;
                case 0:
                    return FlashRushToBuySate.Begining;
            }
            switch(endState)
@@ -229,6 +270,36 @@
            }
        }
        public bool CheckIsPush(out OperationFlashRushToBuy.FlashSaleShop saleShop)
        {
            int seconds = 0;
            OperationTime operationTime;
            saleShop = null;
            var buyState = GetActivityState(out seconds,out operationTime,out saleShop);
            switch (buyState)
            {
                case FlashRushToBuySate.NoOpen:
                    break;
                case FlashRushToBuySate.InAdvance:
                    if(saleShop != null && seconds <= 180)
                    {
                       for(int i = 0; i < saleShop.items.Length; i++)
                        {
                            if(saleShop.items[i].isAppointment == 1)
                            {
                                return true;
                            }
                        }
                    }
                    break;
                case FlashRushToBuySate.Begining:
                    return true;
                case FlashRushToBuySate.End:
                    break;
            }
            return false;
        }
        private void OperationEndEvent(Operation type, int state)
        {
            if (type == Operation.FlashRushToBuy && state == 0)
System/OpenServerActivity/FlashRushToBuyNotify.cs
New file
@@ -0,0 +1,35 @@
namespace Snxxz.UI
{
    public class FlashRushToBuyNotify : OpenServerActivityNotifyBase
    {
        public FlashRushToBuyModel rushToBuyModel { get { return ModelCenter.Instance.GetModel<FlashRushToBuyModel>(); } }
        public const string iconKey = "TB_BGL_2";
        private void OnEnable()
        {
            Display();
        }
        private void OnDisable()
        {
        }
        protected override void Display()
        {
            base.Display();
            titleText.text = "限时抢购";
            activityIcon.SetSprite(iconKey);
        }
        protected override void ClickGotoBtn()
        {
            base.ClickGotoBtn();
            this.gameObject.SetActive(false);
            WindowCenter.Instance.Open<FlashRushToBuyWin>();
        }
        protected override void ClickCloseBtn()
        {
            base.ClickCloseBtn();
        }
    }
}
System/OpenServerActivity/FlashRushToBuyNotify.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f1b3cf08873bf564ea2ec5d7d71afd41
timeCreated: 1539423553
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/OpenServerActivity/FlashRushToBuyWin.cs
@@ -64,8 +64,7 @@
        private void Display()
        {
            if (rushToBuyModel.presentFlashShop.Equals(default(OperationFlashRushToBuy.FlashSaleShop))
                || operation == null) return;
            if (rushToBuyModel.presentFlashShop == null|| operation == null) return;
            opreationTimeText.text = StringUtility.Contact(Language.Get("ExpActivity_Text1"), operation.ToDisplayTime());
            if (rushToBuyModel.presentFlashShop.items.Length > 0)
System/OpenServerActivity/FlashSaleItemCell.cs
@@ -16,6 +16,7 @@
        [SerializeField] Image stateImg;
        [SerializeField] Button flashSaleBtn;
        [SerializeField] Text btnStateText;
        [SerializeField] Text fullServerRemainNum;
        public const int RefreshFullServerBuyType = 8;
@@ -30,6 +31,7 @@
        {
            battleModel.RefreshGameRecInfoAct += UpdateFullServerBuy;
            storeModel.RefreshBuyShopLimitEvent += RefreshBuyShopLimitEvent;
            rushToBuyModel.UpdateAllAppointmentEvent += UpdateAllAppointmentInfo;
            rushToBuyModel.UpdateAppointmentEvent += UpdateAppointmentInfo;
        }
@@ -37,12 +39,13 @@
        {
            storeModel.RefreshBuyShopLimitEvent -= RefreshBuyShopLimitEvent;
            battleModel.RefreshGameRecInfoAct -= UpdateFullServerBuy;
            rushToBuyModel.UpdateAllAppointmentEvent -= UpdateAllAppointmentInfo;
            rushToBuyModel.UpdateAppointmentEvent -= UpdateAppointmentInfo;
        }
        public override void Refresh(CellView cell)
        {
            if (rushToBuyModel.presentFlashShop.Equals(default(OperationFlashRushToBuy.FlashSaleShop))) return;
            if (rushToBuyModel.presentFlashShop == null) return;
            saleItem = rushToBuyModel.presentFlashShop.items[cell.index];
            ItemCellModel cellModel = new ItemCellModel(saleItem.itemId,true,(ulong)saleItem.itemCount,saleItem.isBind);
@@ -73,14 +76,20 @@
        }
        private void UpdateAppointmentInfo()
        private void UpdateAllAppointmentInfo()
        {
            UpdateSaleItem();
        }
        private void UpdateAppointmentInfo(int shopGuid)
        {
            if (saleItem == null || shopGuid != saleItem.shopGuid) return;
            UpdateSaleItem();
        }
        private void UpdateSaleItem()
        {
            if (rushToBuyModel.presentFlashShop.Equals(default(OperationFlashRushToBuy.FlashSaleShop))) return;
            if (rushToBuyModel.presentFlashShop == null) return;
            StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(saleItem.shopId);
            flashSaleBtn.RemoveAllListeners();
@@ -88,6 +97,7 @@
            int seconds = 0;
            int buyState = operation.GetBuyTimeState(TimeUtility.ServerNow,rushToBuyModel.presentFlashShop.dayIndex,
                rushToBuyModel.presentFlashShop.timeIndex,out seconds);
            switch(buyState)
            {
                case -1:
@@ -111,7 +121,9 @@
        private void UpdateSaleItemSellState()
        {
            int sellState = GetSellSate();
            int fullSeverRemain = 0;
            int sellState = GetSellSate(out fullSeverRemain);
            fullServerRemainNum.text = fullSeverRemain.ToString();
            switch (sellState)
            {
                case 0:
@@ -133,10 +145,20 @@
        /// 0 秒杀 1 已买到 2 已抢光
        /// </summary>
        /// <returns></returns>
        private int GetSellSate()
        private int GetSellSate(out int fullRemainNum)
        {
            var buyInfo = storeModel.GetBuyShopLimit((uint)saleItem.shopId);
            var buyCount = 0;
            var fullServerInfo = rushToBuyModel.GetFullServerInfo();
            fullRemainNum = 0;
            if (fullServerInfo != null && fullServerInfo.Value1 == saleItem.shopId)
            {
                fullRemainNum = saleItem.fullServerLimitNum - fullServerInfo.Value2;
            }
            else
            {
                fullRemainNum = saleItem.fullServerLimitNum;
            }
            if (buyInfo != null)
            {
                buyCount = buyInfo.BuyCnt;
@@ -146,9 +168,7 @@
                return 1;
            }
            var fullServerInfo = rushToBuyModel.GetFullServerInfo();
            if(fullServerInfo != null && fullServerInfo.Value1 == saleItem.shopId
                && fullServerInfo.Value2 >= saleItem.fullServerLimitNum)
            if (fullRemainNum <= 0)
            {
                return 2;
            }
System/OpenServerActivity/OpenServerActivityNotifyBase.cs
New file
@@ -0,0 +1,34 @@
using UnityEngine;
using UnityEngine.UI;
namespace Snxxz.UI
{
     public class OpenServerActivityNotifyBase : MonoBehaviour
    {
        [SerializeField] protected Text titleText;
        [SerializeField] protected Image activityIcon;
        [SerializeField] protected Button gotoBtn;
        [SerializeField] protected Button closeBtn;
        private void Awake()
        {
            gotoBtn.AddListener(ClickGotoBtn);
            closeBtn.AddListener(ClickCloseBtn);
        }
        protected virtual void Display()
        {
        }
        protected virtual void ClickGotoBtn()
        {
        }
        protected virtual void ClickCloseBtn()
        {
            this.gameObject.SetActive(false);
        }
    }
}
System/OpenServerActivity/OpenServerActivityNotifyBase.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 22be8e7eacfacb343b53b11b5d22aa29
timeCreated: 1539422752
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/OpenServerActivity/OpenServerActivityNotifyModel.cs
New file
@@ -0,0 +1,179 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Snxxz.UI
{
    public class OpenServerActivityNotifyModel : Model,IBeforePlayerDataInitialize,IPlayerLoginOk
    {
        public override void Init()
        {
        }
        public void OnBeforePlayerDataInitialize()
        {
            FlashRushToBuyActivityClose();
            GlobalTimeEvent.Instance.minuteEvent -= UpdateMinute;
            OperationTimeHepler.Instance.operationStartEvent -= OperationStartEvent;
            OperationTimeHepler.Instance.operationEndEvent -= OperationEndEvent;
            OperationTimeHepler.Instance.operationTimeUpdateEvent -= OperationTimeEvent;
            OperationTimeHepler.Instance.operationServerCloseEvent -= OperationServerCloseEvent;
        }
        public void OnPlayerLoginOk()
        {
            OperationTimeHepler.Instance.operationStartEvent += OperationStartEvent;
            OperationTimeHepler.Instance.operationEndEvent += OperationEndEvent;
            OperationTimeHepler.Instance.operationTimeUpdateEvent += OperationTimeEvent;
            OperationTimeHepler.Instance.operationServerCloseEvent += OperationServerCloseEvent;
            GlobalTimeEvent.Instance.minuteEvent += UpdateMinute;
            SetFlashRushToBuyNotify();
        }
        public override void UnInit()
        {
        }
        private void UpdateMinute()
        {
            SetFlashRushToBuyNotify();
        }
        private void OperationTimeEvent(Operation type)
        {
            switch (type)
            {
                case Operation.MultipleExp:
                    break;
                case Operation.ConsumeRebate:
                    break;
                case Operation.FlashSale:
                    break;
                case Operation.BossReborn:
                    break;
                case Operation.GiftPackage:
                    break;
                case Operation.FairyCeremony:
                    break;
                case Operation.MultipRealmPoint:
                    break;
                case Operation.FlashRushToBuy:
                    SetFlashRushToBuyNotify();
                    break;
                case Operation.max:
                    break;
            }
        }
        private void OperationStartEvent(Operation type, int state)
        {
            switch (type)
            {
                case Operation.MultipleExp:
                    break;
                case Operation.ConsumeRebate:
                    break;
                case Operation.FlashSale:
                    break;
                case Operation.BossReborn:
                    break;
                case Operation.GiftPackage:
                    break;
                case Operation.FairyCeremony:
                    break;
                case Operation.MultipRealmPoint:
                    break;
                case Operation.FlashRushToBuy:
                    SetFlashRushToBuyNotify();
                    break;
                case Operation.max:
                    break;
            }
        }
        private void OperationServerCloseEvent(Operation type)
        {
            switch (type)
            {
                case Operation.MultipleExp:
                    break;
                case Operation.ConsumeRebate:
                    break;
                case Operation.FlashSale:
                    break;
                case Operation.BossReborn:
                    break;
                case Operation.GiftPackage:
                    break;
                case Operation.FairyCeremony:
                    break;
                case Operation.MultipRealmPoint:
                    break;
                case Operation.FlashRushToBuy:
                    FlashRushToBuyActivityClose();
                    break;
                case Operation.max:
                    break;
            }
        }
        private void OperationEndEvent(Operation type, int state)
        {
            switch (type)
            {
                case Operation.MultipleExp:
                    break;
                case Operation.ConsumeRebate:
                    break;
                case Operation.FlashSale:
                    break;
                case Operation.BossReborn:
                    break;
                case Operation.GiftPackage:
                    break;
                case Operation.FairyCeremony:
                    break;
                case Operation.MultipRealmPoint:
                    break;
                case Operation.FlashRushToBuy:
                    FlashRushToBuyActivityClose();
                    break;
                case Operation.max:
                    break;
            }
        }
        #region 限时抢购
        public event Action UpdateFlashRushToBuyEvent;
        FlashRushToBuyModel rushToBuyModel { get { return ModelCenter.Instance.GetModel<FlashRushToBuyModel>(); } }
        public List<OperationFlashRushToBuy.FlashSaleShop> flashSaleShops = new List<OperationFlashRushToBuy.FlashSaleShop>();
        public void SetFlashRushToBuyNotify()
        {
            OperationFlashRushToBuy.FlashSaleShop saleShop = null;
            bool isPush = rushToBuyModel.CheckIsPush(out saleShop);
            if(isPush && !flashSaleShops.Contains(saleShop))
            {
                flashSaleShops.Add(saleShop);
                if(UpdateFlashRushToBuyEvent != null)
                {
                    UpdateFlashRushToBuyEvent();
                }
            }
        }
        public void FlashRushToBuyActivityClose()
        {
            flashSaleShops.Clear();
            if (UpdateFlashRushToBuyEvent != null)
            {
                UpdateFlashRushToBuyEvent();
            }
        }
        #endregion
    }
}
System/OpenServerActivity/OpenServerActivityNotifyModel.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 2a78df4065d071145b2e5877404cd6fd
timeCreated: 1539572551
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/OpenServerActivity/OpenServerActivityNotifyWin.cs
New file
@@ -0,0 +1,54 @@
using System;
using UnityEngine;
using UnityEngine.UI;
namespace Snxxz.UI
{
    public class OpenServerActivityNotifyWin : Window
    {
        [SerializeField] FlashRushToBuyNotify flashRushToBuyNotify;
        OpenServerActivityNotifyModel activityNotifyModel { get { return ModelCenter.Instance.GetModel<OpenServerActivityNotifyModel>(); } }
        protected override void BindController()
        {
        }
        protected override void AddListeners()
        {
        }
        protected override void OnPreOpen()
        {
            activityNotifyModel.UpdateFlashRushToBuyEvent += CheckFlashRushToBuy;
            CheckFlashRushToBuy();
        }
        protected override void OnAfterOpen()
        {
        }
        protected override void OnPreClose()
        {
            activityNotifyModel.UpdateFlashRushToBuyEvent -= CheckFlashRushToBuy;
        }
        protected override void OnAfterClose()
        {
        }
        private void CheckFlashRushToBuy()
        {
            if(activityNotifyModel.flashSaleShops.Count > 0)
            {
                flashRushToBuyNotify.gameObject.SetActive(true);
            }
            else
            {
                flashRushToBuyNotify.gameObject.SetActive(false);
            }
        }
    }
}
System/OpenServerActivity/OpenServerActivityNotifyWin.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: aa084ec4d5a2ea446b5ec00c0e1cc687
timeCreated: 1539422752
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/OpenServerActivity/OperationFlashRushToBuy.cs
@@ -10,7 +10,7 @@
        public bool TryGetFlashShop(int dayIndex,int timeIndex ,out FlashSaleShop flashSaleShop)
        {
           flashSaleShop = default(FlashSaleShop);
           flashSaleShop = null;
           for (int i = 0; i < flashShops.Count; i++)
            {
                var shop = flashShops[i];
@@ -21,6 +21,27 @@
                    return true;
                }
            }
            return false;
        }
        public bool TryGetFlashItem(int shopGuid,out FlashSaleShop flashSaleShop, out FlashSaleItem saleItem)
        {
            saleItem = null;
            flashSaleShop = null;
            for (int i = 0; i < flashShops.Count; i++)
            {
                var saleItems = flashShops[i].items;
                for (int j = 0; j < saleItems.Length; j++)
                {
                    if (saleItems[j].shopGuid == shopGuid)
                    {
                        flashSaleShop = flashShops[i];
                        saleItem = saleItems[j];
                        return true;
                    }
                }
            }
            return false;
        }
@@ -125,14 +146,14 @@
        }
     
        public struct FlashSaleShop
        public class FlashSaleShop
        {
            public int dayIndex; // 活动第几天
            public int timeIndex;//第几个时间段
            public FlashSaleItem[] items;
        }
        public struct FlashSaleItem
        public class FlashSaleItem
        {
            public int shopId;
            public int shopGuid;
System/SystemSetting/ActivitiesPushMgr.cs
@@ -31,6 +31,7 @@
        public void OnBeforePlayerDataInitialize()
        {
            rushToBuyModel.UpdateAllAppointmentEvent -= UpdateAllAppointment;
            rushToBuyModel.UpdateAppointmentEvent -= UpdateAppointment;
            GlobalTimeEvent.Instance.minuteEvent -= RefreshMinuteTime;
            OpenServerActivityCenter.Instance.openServerActivityStateChange -= RefreshOpenServerState;
@@ -48,6 +49,7 @@
            SetFlashRushToBuyAppointmentInfo();
            GlobalTimeEvent.Instance.minuteEvent += RefreshMinuteTime;
            OpenServerActivityCenter.Instance.openServerActivityStateChange += RefreshOpenServerState;
            rushToBuyModel.UpdateAllAppointmentEvent += UpdateAllAppointment;
            rushToBuyModel.UpdateAppointmentEvent += UpdateAppointment;
        }
@@ -191,11 +193,39 @@
        #endregion
        #region 限时抢购推送
        private void UpdateAppointment()
        private void UpdateAllAppointment()
        {
            SetFlashRushToBuyAppointmentInfo();
        }
        private void UpdateAppointment(int shopGuid)
        {
            if (!rushToBuyModel.IsOpen) return;
            var operation = rushToBuyModel.GetOperationFlashRushToBuy();
            int pushId = FlashRushToBuy * 10 + shopGuid;
            OperationFlashRushToBuy.FlashSaleItem saleItem;
            OperationFlashRushToBuy.FlashSaleShop saleShop;
            bool isSaleItem = operation.TryGetFlashItem(shopGuid,out saleShop,out saleItem);
            if(isSaleItem)
            {
                if(saleItem.isAppointment != 1)
                {
                    RemovePushInfo(pushId);
                }
                else
                {
                    int seconds = 0;
                    int buyState = operation.GetBuyTimeState(TimeUtility.ServerNow, saleShop.dayIndex, saleShop.timeIndex, out seconds);
                    if(seconds > 800)
                    {
                        int remainSecond = seconds - 600;
                        SendPushInfo(GetPushJsonData(pushId, remainSecond, "限时抢购", "亲爱的道友,您预约的限时抢购商品即将开抢,请尽快进入游戏秒杀!"));
                    }
                }
            }
        }
        private void SetFlashRushToBuyAppointmentInfo()
        {
            if (!rushToBuyModel.IsOpen) return;