| System/OpenServerActivity/FlashRushToBuyCoolDown.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/OpenServerActivity/FlashRushToBuyModel.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/OpenServerActivity/FlashRushToBuyWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/OpenServerActivity/FlashSaleItemCell.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/OpenServerActivity/FlashSaleModel.cs | 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/OpenServerActivity/FlashSaleTimeCell.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/OpenServerActivity/OperationFlashRushToBuy.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| UI/Common/TimeDownMgr.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
System/OpenServerActivity/FlashRushToBuyCoolDown.cs
@@ -60,23 +60,23 @@ isStartReplace = true; if(!isReplace) { timeText.text = TimeUtility.SecondsToHMS(seconds); timeText.text = Language.Get("FlashRushToBuy106", TimeUtility.SecondsToHMS(seconds)); } else { timeText.text = operation.ToDisplayBuyTime(operationTime.startHour, operationTime.startMinute); timeText.text = Language.Get("FlashRushToBuy106", operation.ToDisplayBuyTime(operationTime.startHour, operationTime.startMinute)); } } else { timeText.text = operation.ToDisplayBuyTime(operationTime.startHour, operationTime.startMinute); timeText.text = Language.Get("FlashRushToBuy106", operation.ToDisplayBuyTime(operationTime.startHour, operationTime.startMinute)); } break; case FlashRushToBuyModel.FlashRushToBuySate.Begining: timeText.text = "秒杀中"; timeText.text = Language.Get("FlashRushToBuy107"); break; case FlashRushToBuyModel.FlashRushToBuySate.End: timeText.text = "活动已结束"; timeText.text = Language.Get("ActivityEnd"); break; } } System/OpenServerActivity/FlashRushToBuyModel.cs
@@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; namespace Snxxz.UI { @@ -9,7 +10,7 @@ { StoreModel storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } } HeavenBattleModel battleModel { get { return ModelCenter.Instance.GetModel<HeavenBattleModel>(); } } public string AlreadyOpenSaleTimeRecord = ""; public override void Init() { OperationTimeHepler.Instance.operationStartEvent += OperationStartEvent; @@ -20,11 +21,15 @@ public void OnBeforePlayerDataInitialize() { } public void OnPlayerLoginOk() { //UpdateRedpoint(); AlreadyOpenSaleTimeRecord = StringUtility.Contact("AlreadyOpenSaleTimeRecord",PlayerDatas.Instance.baseData.PlayerID); PlayerPrefs.DeleteKey(AlreadyOpenSaleTimeRecord); GetAlreadyOpenSaleTime(); UpdateRedpoint(); } public override void UnInit() @@ -51,7 +56,7 @@ { get { return flashSaleRedpoint.state == RedPointState.Simple; return flashRushToBuyRedpoint.state == RedPointState.Simple; } } @@ -66,32 +71,25 @@ public void SetDefaultSelectSaleTime() { OperationFlashRushToBuy operation = GetOperationFlashRushToBuy(); int seconds = 0; if (presentFlashShop != null) { int seconds = 0; int buyState = operation.GetBuyTimeState(TimeUtility.ServerNow,presentFlashShop.dayIndex,presentFlashShop.timeIndex, out seconds); if(buyState != 1) { return; } } for (int i = 0; i < operation.flashShops.Count; i++) OperationTime operationTime; OperationFlashRushToBuy.FlashSaleShop saleShop = null; var flashRushToBuySate = GetActivityState(out seconds, out operationTime, out saleShop); if(flashRushToBuySate != FlashRushToBuySate.End) { int days = operation.totalDays + 1; int dayIndex = i / (operation.flashShops.Count / days); int timeIndex = i % (operation.flashShops.Count / days); int seconds = 0; OperationTime operationTime = operation.times[timeIndex]; var date = operation.startDate; int buyState = operation.GetBuyTimeState(TimeUtility.ServerNow, dayIndex, timeIndex, out seconds); switch(buyState) { case -1: case 0: UpdateSelectFlashSaleTime(dayIndex,timeIndex); return; presentFlashShop = saleShop; } else { presentFlashShop = null; } } @@ -339,27 +337,65 @@ } } private void OnDayEvent() { UpdateRedpoint(); } public void SetDayRemind() { if (flashSaleRedpoint.state == RedPointState.Simple) if (flashRushToBuyRedpoint.state == RedPointState.Simple) { // DayRemind.Instance.SetDayRemind(DayRemind.FLASHSALE_REDPOINT, true); SetAlreadyOpenSaleTime(); UpdateRedpoint(); } } public Redpoint flashSaleRedpoint = new Redpoint(MainRedDot.REDPOINT_OPENSERVER, 20914); public Redpoint flashRushToBuyRedpoint = new Redpoint(MainRedDot.REDPOINT_OPENSERVER, 20914); public event Action<int> onStateUpate; public void SetAlreadyOpenSaleTime() { int seconds = 0; OperationTime operationTime; OperationFlashRushToBuy.FlashSaleShop saleShop = null; var buyState = GetActivityState(out seconds, out operationTime, out saleShop); if(buyState == FlashRushToBuySate.Begining) { int key = saleShop.dayIndex * 100 + saleShop.timeIndex; if (!flashSaleShops.Contains(key)) { flashSaleShops.Add(key); } } } public List<int> flashSaleShops = new List<int>(); public List<int> GetAlreadyOpenSaleTime() { int[] saveKeys = LocalSave.GetIntArray(AlreadyOpenSaleTimeRecord); flashSaleShops.Clear(); if(saveKeys != null) { for(int i = 0; i < saveKeys.Length; i++) { flashSaleShops.Add(saveKeys[i]); } } return flashSaleShops; } private void UpdateRedpoint() { flashSaleRedpoint.state = RedPointState.None; flashRushToBuyRedpoint.state = RedPointState.None; int seconds = 0; OperationTime operationTime; OperationFlashRushToBuy.FlashSaleShop saleShop = null; var buyState = GetActivityState(out seconds, out operationTime, out saleShop); if(buyState == FlashRushToBuySate.Begining) { int key = saleShop.dayIndex * 100 + saleShop.timeIndex; if(!flashSaleShops.Contains(key)) { flashRushToBuyRedpoint.state = RedPointState.Simple; } } } public enum FlashRushToBuySate System/OpenServerActivity/FlashRushToBuyWin.cs
@@ -11,6 +11,8 @@ [SerializeField] Text opreationTimeText; [SerializeField] Image moneyIcon; [SerializeField] Text moneyNumText; [SerializeField] GameObject activityOpenObj; [SerializeField] GameObject activityCloseObj; StoreModel storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } } FlashRushToBuyModel rushToBuyModel { get { return ModelCenter.Instance.GetModel<FlashRushToBuyModel>(); } } @@ -75,6 +77,8 @@ moneyIcon.SetIconWithMoneyType(moneyType); moneyNumText.text = UIHelper.GetMoneyCnt(moneyType).ToString(); } activityOpenObj.SetActive(true); activityCloseObj.SetActive(false); CreateOperationTimes(); CreateSaleItem(); } @@ -89,9 +93,20 @@ private void UpdatePresentFlashShopClose() { if(rushToBuyModel.presentFlashShop != null) { activityOpenObj.SetActive(true); activityCloseObj.SetActive(false); CreateOperationTimes(); CreateSaleItem(); } else { activityOpenObj.SetActive(false); activityCloseObj.SetActive(true); } } private void CreateOperationTimes() { System/OpenServerActivity/FlashSaleItemCell.cs
@@ -15,7 +15,9 @@ [SerializeField] Image presentMoneyIcon; [SerializeField] Image stateImg; [SerializeField] Button flashSaleBtn; [SerializeField] Image btnBgImg; [SerializeField] Text btnStateText; [SerializeField] Text cdText; [SerializeField] Text fullServerRemainNum; public const int RefreshFullServerBuyType = 8; @@ -27,6 +29,7 @@ OperationFlashRushToBuy.FlashSaleItem saleItem; int buyState = -1; float cdTime = 10; private void OnEnable() { battleModel.RefreshGameRecInfoAct += UpdateFullServerBuy; @@ -98,27 +101,62 @@ buyState = operation.GetBuyTimeState(TimeUtility.ServerNow,rushToBuyModel.presentFlashShop.dayIndex, rushToBuyModel.presentFlashShop.timeIndex,out seconds); btnBgImg.SetSprite("SecondBtn1"); btnStateText.gameObject.SetActive(true); cdText.gameObject.SetActive(false); switch(buyState) { case -1: if(saleItem.isAppointment == 0) { btnStateText.text = "预约"; cdTime = 10; btnStateText.text = Language.Get("FlashRushToBuy101"); flashSaleBtn.AddListener(() => { rushToBuyModel.SendFlashSaleAppointment(saleItem.shopGuid, 1); }); } else { btnStateText.text = "取消预约"; flashSaleBtn.AddListener(() => { rushToBuyModel.SendFlashSaleAppointment(saleItem.shopGuid, 0); }); btnStateText.gameObject.SetActive(false); cdText.gameObject.SetActive(true); btnBgImg.SetSprite("BlackBtn"); RefreshCD(cdTime); TimeDownMgr.Instance.Begin(TimeDownMgr.CoolTimeType.FlashRushToBuyAppointment,cdTime, RefreshCD); flashSaleBtn.AddListener(CancelAppointment); } break; case 0: btnStateText.text = "秒杀"; cdTime = 10; btnStateText.text = Language.Get("FlashRushToBuy102"); flashSaleBtn.AddListener(() => { storeModel.SendBuyShopItem(storeConfig,saleItem.itemCount); }); break; } } private void RefreshCD(float time) { cdTime = time; if (cdTime <= 0) { cdText.text = Language.Get("FlashRushToBuy103"); } else { cdText.text = Language.Get("FlashRushToBuy104",time); } } private void CancelAppointment() { if(cdTime == 0) { rushToBuyModel.SendFlashSaleAppointment(saleItem.shopGuid, 0); } else { MessageWin.Inst.ShowFixedTip("系统繁忙"); } } private void UpdateSaleItemSellState() { int fullSeverRemain = 0; System/OpenServerActivity/FlashSaleModel.cs
System/OpenServerActivity/FlashSaleTimeCell.cs
@@ -67,11 +67,11 @@ case -1: this.gameObject.SetActive(true); string timeStr = operation.ToDisplayBuyTime(date.month, dayIndex + date.day, operationTime.startHour, operationTime.startMinute); remainText.text = StringUtility.Contact(timeStr, "开抢"); remainText.text = Language.Get("FlashRushToBuy106", timeStr); break; case 0: this.gameObject.SetActive(true); remainText.text = StringUtility.Contact("秒杀进行中", TimeUtility.SecondsToHMS(seconds)); remainText.text = Language.Get("FlashRushToBuy105", TimeUtility.SecondsToHMS(seconds)); break; case 1: rushToBuyModel.PresentFlashShopActivityClose(); System/OpenServerActivity/OperationFlashRushToBuy.cs
@@ -58,7 +58,7 @@ int day = startDate.day + dayIndex; OperationTime operationTime = times[timeIndex]; var startTime = new DateTime(startDate.year, startDate.month,day, operationTime.startHour, operationTime.startMinute,0); var endTime = new DateTime(startDate.year, startDate.month,day, operationTime.endHour, operationTime.endHour, 0); var endTime = new DateTime(startDate.year, startDate.month,day, operationTime.endHour, operationTime.endMinute, 0); int advanceSec = Mathf.CeilToInt((float)(startTime - time).TotalSeconds); int endSec = Mathf.CeilToInt((float)(endTime - time).TotalSeconds); if (advanceSec > 0) UI/Common/TimeDownMgr.cs
@@ -24,6 +24,7 @@ HappyFreeBestXB = 14,//极品寻宝免费时间倒计时 HappyFreeRuneXB = 15, //符印寻宝免费时间倒计时 HappyXBWarehouse = 16, //寻宝仓库整理倒计时 FlashRushToBuyAppointment = 17, //限时抢购预约倒计时 } public void Begin(CoolTimeType type, float duration,Action<float> func,float tick=1.0f)