From cf05425741e1f06fc5cee500706fb36e3db8a344 Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期一, 17 九月 2018 10:55:46 +0800
Subject: [PATCH] 3442运营活动修改
---
System/Welfare/GiftPackageClass.cs | 43 -------
System/OpenServerActivity/ImpactRankModel.cs | 11 +
System/Vip/OSTimeLimitGiftModel.cs | 8 +
System/Welfare/MultipleRealmPointModel.cs | 8 +
System/Welfare/ConsumeRebateModel.cs | 8 +
System/BossReborn/BossRebornModel.cs | 12 +
System/Welfare/OperationFlashSale.cs | 43 -------
System/OpenServerActivity/OSRedEnvelopeModel.cs | 8 +
System/Welfare/OperationTimeHepler.cs | 25 ++-
System/Welfare/MultipleExpModel.cs | 10 +
System/OpenServerActivity/FlashSaleModel.cs | 29 ++++
System/OpenServerActivity/OSGiftModel.cs | 9 +
System/Welfare/OperationConsumeRebate.cs | 43 -------
System/Vip/LimitedTimePackageModel.cs | 8 +
System/Welfare/OperationBase.cs | 38 ++++++
System/Vip/FairyJadeInvestmentModel.cs | 7 +
16 files changed, 166 insertions(+), 144 deletions(-)
diff --git a/System/BossReborn/BossRebornModel.cs b/System/BossReborn/BossRebornModel.cs
index 749f0ef..0e05b2a 100644
--- a/System/BossReborn/BossRebornModel.cs
+++ b/System/BossReborn/BossRebornModel.cs
@@ -101,8 +101,16 @@
get {
return OperationTimeHepler.Instance.SatisfyOpenCondition(Operation.BossReborn);
}
- }
-
+ }
+
+ public bool IsAdvance
+ {
+ get
+ {
+ return OperationTimeHepler.Instance.SatisfyAdvanceCondition(Operation.BossReborn);
+ }
+ }
+
public void UpdateTaskBaseInfos(HAB04_tagMCBossRebornInfo.tagMCBossRebornTaskInfo[] _tasks)
{
foreach (var task in _tasks)
diff --git a/System/OpenServerActivity/FlashSaleModel.cs b/System/OpenServerActivity/FlashSaleModel.cs
index 7d57ee1..207475f 100644
--- a/System/OpenServerActivity/FlashSaleModel.cs
+++ b/System/OpenServerActivity/FlashSaleModel.cs
@@ -11,6 +11,7 @@
{
OperationTimeHepler.Instance.operationStartEvent += OperationStartEvent;
OperationTimeHepler.Instance.operationEndEvent += OperationEndEvent;
+ OperationTimeHepler.Instance.operationAdvanceEvent += OperationAdvanceEvent;
TimeMgr.Instance.OnDayEvent += OnDayEvent;
OpenServerActivityCenter.Instance.Register(4, this);
}
@@ -28,6 +29,7 @@
{
OperationTimeHepler.Instance.operationStartEvent -= OperationStartEvent;
OperationTimeHepler.Instance.operationEndEvent -= OperationEndEvent;
+ OperationTimeHepler.Instance.operationAdvanceEvent -= OperationAdvanceEvent;
TimeMgr.Instance.OnDayEvent -= OnDayEvent;
}
@@ -36,6 +38,17 @@
if (type == Operation.FlashSale && state == 0)
{
UpdateRedpoint();
+ if (onStateUpate != null)
+ {
+ onStateUpate(4);
+ }
+ }
+ }
+
+ private void OperationAdvanceEvent(Operation type)
+ {
+ if (type == Operation.FlashSale)
+ {
if (onStateUpate != null)
{
onStateUpate(4);
@@ -73,9 +86,7 @@
{
get
{
- OperationBase operationBase;
- OperationTimeHepler.Instance.TryGetOperationTime(Operation.FlashSale, out operationBase);
- return operationBase != null && operationBase.SatisfyOpenCondition() && operationBase.InTime(TimeUtility.ServerNow);
+ return OperationTimeHepler.Instance.SatisfyOpenCondition(Operation.FlashSale);
}
}
@@ -87,12 +98,24 @@
}
}
+ public bool IsAdvance
+ {
+ get
+ {
+ return OperationTimeHepler.Instance.SatisfyAdvanceCondition(Operation.FlashSale);
+ }
+ }
+
public void SendBuyFlashSale(OperationFlashSale.FlashSaleGift gift)
{
OperationBase operationBase;
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");
diff --git a/System/OpenServerActivity/ImpactRankModel.cs b/System/OpenServerActivity/ImpactRankModel.cs
index 44886b9..6b853ef 100644
--- a/System/OpenServerActivity/ImpactRankModel.cs
+++ b/System/OpenServerActivity/ImpactRankModel.cs
@@ -670,6 +670,14 @@
return TimeUtility.OpenDay < openServerRankDays && FuncOpen.Instance.IsFuncOpen(125);
}
}
+
+ public bool IsAdvance
+ {
+ get
+ {
+ return false;
+ }
+ }
#endregion
}
@@ -729,7 +737,7 @@
{
if (openServerActivitys.ContainsKey(_funcOrder))
{
- return openServerActivitys[_funcOrder].IsOpen;
+ return openServerActivitys[_funcOrder].IsOpen || openServerActivitys[_funcOrder].IsAdvance;
}
return false;
}
@@ -765,6 +773,7 @@
public interface IOpenServerActivity
{
bool IsOpen { get; }
+ bool IsAdvance { get; }
bool priorityOpen { get; }
event Action<int> onStateUpate;
diff --git a/System/OpenServerActivity/OSGiftModel.cs b/System/OpenServerActivity/OSGiftModel.cs
index ad7557e..03adb7f 100644
--- a/System/OpenServerActivity/OSGiftModel.cs
+++ b/System/OpenServerActivity/OSGiftModel.cs
@@ -76,6 +76,15 @@
}
public int timeOverdueGiftId { get; private set; }
+
+ public bool IsAdvance
+ {
+ get
+ {
+ return false;
+ }
+ }
+
public DateTime overDueTime = DateTime.Now;
public void UpdateTime(HAA16_tagMCSuperGiftInfo package)
{
diff --git a/System/OpenServerActivity/OSRedEnvelopeModel.cs b/System/OpenServerActivity/OSRedEnvelopeModel.cs
index 11ae93c..7d3c748 100644
--- a/System/OpenServerActivity/OSRedEnvelopeModel.cs
+++ b/System/OpenServerActivity/OSRedEnvelopeModel.cs
@@ -429,6 +429,14 @@
}
}
+ public bool IsAdvance
+ {
+ get
+ {
+ return false;
+ }
+ }
+
public event Action OSRedEnvelopeInfoEnvent;
public event Action<int> onStateUpate;
diff --git a/System/Vip/FairyJadeInvestmentModel.cs b/System/Vip/FairyJadeInvestmentModel.cs
index a824fbd..0d41b22 100644
--- a/System/Vip/FairyJadeInvestmentModel.cs
+++ b/System/Vip/FairyJadeInvestmentModel.cs
@@ -47,6 +47,13 @@
}
}
+ public bool IsAdvance
+ {
+ get
+ {
+ return false;
+ }
+ }
private bool IsRedPoint()//绾㈢偣
{
diff --git a/System/Vip/LimitedTimePackageModel.cs b/System/Vip/LimitedTimePackageModel.cs
index 452d2cd..4fc80fc 100644
--- a/System/Vip/LimitedTimePackageModel.cs
+++ b/System/Vip/LimitedTimePackageModel.cs
@@ -42,6 +42,14 @@
}
}
+ public bool IsAdvance
+ {
+ get
+ {
+ return OperationTimeHepler.Instance.SatisfyAdvanceCondition(Operation.GiftPackage);
+ }
+ }
+
public void OnBeforePlayerDataInitialize()
{
IsShowPanel = false;
diff --git a/System/Vip/OSTimeLimitGiftModel.cs b/System/Vip/OSTimeLimitGiftModel.cs
index cc50378..cec1df8 100644
--- a/System/Vip/OSTimeLimitGiftModel.cs
+++ b/System/Vip/OSTimeLimitGiftModel.cs
@@ -51,6 +51,14 @@
}
}
+ public bool IsAdvance
+ {
+ get
+ {
+ return false;
+ }
+ }
+
public override void Init()
{
var _openDay = 0;
diff --git a/System/Welfare/ConsumeRebateModel.cs b/System/Welfare/ConsumeRebateModel.cs
index 7ce690a..93fd30b 100644
--- a/System/Welfare/ConsumeRebateModel.cs
+++ b/System/Welfare/ConsumeRebateModel.cs
@@ -60,6 +60,14 @@
}
}
+ public bool IsAdvance
+ {
+ get
+ {
+ return OperationTimeHepler.Instance.SatisfyAdvanceCondition(Operation.ConsumeRebate);
+ }
+ }
+
public bool IsRebateGot(int day, int _index)
{
OperationBase operationBase;
diff --git a/System/Welfare/GiftPackageClass.cs b/System/Welfare/GiftPackageClass.cs
index fd0a7dc..9e07476 100644
--- a/System/Welfare/GiftPackageClass.cs
+++ b/System/Welfare/GiftPackageClass.cs
@@ -11,54 +11,13 @@
public bool TryGetGift(DateTime time, out Gift_Package flashSale)
{
flashSale = default(Gift_Package);
- var index = IndexOfGift(time);
+ var index = IndexOfTime(time);
index = Mathf.Min(index, giftpackage1.Count - 1);
if (index >= 0)
{
flashSale = giftpackage1[index];
}
return index >= 0;
- }
-
- int IndexOfGift(DateTime time)
- {
- if (allDay)
- {
- if (!dayReset)
- {
- return 0;
- }
- var index = IndexOfDays(time);
- switch (resetType)
- {
- case 0:
- return index;
- case 1:
- if (time.Hour < DayResetHour)
- {
- return Mathf.Max(0, index - 1);
- }
- else
- {
- return index;
- }
- default:
- return index;
- }
- }
- else
- {
- var index = 0;
- for (int i = 0; i < times.Count; i++)
- {
- if (times[i].InTime(time))
- {
- index = i;
- break;
- }
- }
- return index;
- }
}
public override bool SatisfyOpenCondition()
diff --git a/System/Welfare/MultipleExpModel.cs b/System/Welfare/MultipleExpModel.cs
index e87989b..7d67a9c 100644
--- a/System/Welfare/MultipleExpModel.cs
+++ b/System/Welfare/MultipleExpModel.cs
@@ -45,7 +45,7 @@
{
for (int i = 0; i < operationBase.times.Count; i++)
{
- if (operationBase.times[i].SideOfTime(TimeUtility.ServerNow) == -1)
+ if (operationBase.times[i].CompareTime(TimeUtility.ServerNow) == -1)
{
SysNotifyMgr.Instance.ShowTip("ExpActivity_Ready",
operation.GetMultipleCHS(),
@@ -128,6 +128,14 @@
}
}
+ public bool IsAdvance
+ {
+ get
+ {
+ return OperationTimeHepler.Instance.SatisfyAdvanceCondition(Operation.MultipleExp);
+ }
+ }
+
public void SetDayRemind()
{
if (multipleExpRedpoint.state == RedPointState.Simple)
diff --git a/System/Welfare/MultipleRealmPointModel.cs b/System/Welfare/MultipleRealmPointModel.cs
index c1c4ed9..d6cec81 100644
--- a/System/Welfare/MultipleRealmPointModel.cs
+++ b/System/Welfare/MultipleRealmPointModel.cs
@@ -60,6 +60,14 @@
}
}
+ public bool IsAdvance
+ {
+ get
+ {
+ return OperationTimeHepler.Instance.SatisfyAdvanceCondition(Operation.MultipRealmPoint);
+ }
+ }
+
private void CheckReconnect()
{
if (!(StageManager.Instance.CurrentStage is DungeonStage))
diff --git a/System/Welfare/OperationBase.cs b/System/Welfare/OperationBase.cs
index 4d8a73f..f20a330 100644
--- a/System/Welfare/OperationBase.cs
+++ b/System/Welfare/OperationBase.cs
@@ -108,6 +108,44 @@
return (time - s).Days;
}
+ protected virtual int IndexOfTime(DateTime time, int compare = 0)
+ {
+ if (allDay)
+ {
+ if (!dayReset)
+ {
+ return 0;
+ }
+ var index = IndexOfDays(time);
+ switch (resetType)
+ {
+ case 0:
+ return index;
+ case 1:
+ return time.Hour < DayResetHour ? Mathf.Max(0, index - 1) : index;
+ default:
+ return index;
+ }
+ }
+ else
+ {
+ var index = 0;
+ for (int i = 0; i < times.Count; i++)
+ {
+ if (times[i].InTime(time))
+ {
+ index = i;
+ break;
+ }
+ if (times[i].CompareTime(TimeUtility.ServerNow) == compare)
+ {
+ index = i;
+ }
+ }
+ return index;
+ }
+ }
+
public int GetSurplusTime(DateTime time)
{
var seconds = 0;
diff --git a/System/Welfare/OperationConsumeRebate.cs b/System/Welfare/OperationConsumeRebate.cs
index c630ec1..3075844 100644
--- a/System/Welfare/OperationConsumeRebate.cs
+++ b/System/Welfare/OperationConsumeRebate.cs
@@ -64,49 +64,8 @@
{
return null;
}
- var index = Mathf.Min(rebates.Count - 1, IndexOfRebates(time));
+ var index = Mathf.Min(rebates.Count - 1, IndexOfTime(time));
return rebates[index];
- }
-
- public int IndexOfRebates(DateTime time)
- {
- if (allDay)
- {
- if (!dayReset)
- {
- return 0;
- }
- var index = IndexOfDays(time);
- switch (resetType)
- {
- case 0:
- return index;
- case 1:
- if (time.Hour < DayResetHour)
- {
- return Mathf.Max(0, index - 1);
- }
- else
- {
- return index;
- }
- default:
- return index;
- }
- }
- else
- {
- var index = 0;
- for (int i = 0; i < times.Count; i++)
- {
- if (times[i].InTime(time))
- {
- index = i;
- break;
- }
- }
- return index;
- }
}
public class Rebate
diff --git a/System/Welfare/OperationFlashSale.cs b/System/Welfare/OperationFlashSale.cs
index e8c3bf6..909f950 100644
--- a/System/Welfare/OperationFlashSale.cs
+++ b/System/Welfare/OperationFlashSale.cs
@@ -11,54 +11,13 @@
public bool TryGetFlashSale(DateTime time, out FlashSale flashSale)
{
flashSale = default(FlashSale);
- var index = IndexOfFlashSale(time);
+ var index = IndexOfTime(time, inAdvanceMinute > 0 ? -1 : 0);
index = Mathf.Min(index, flashShops.Count - 1);
if (index >= 0)
{
flashSale = flashShops[index];
}
return index >= 0;
- }
-
- int IndexOfFlashSale(DateTime time)
- {
- if (allDay)
- {
- if (!dayReset)
- {
- return 0;
- }
- var index = IndexOfDays(time);
- switch (resetType)
- {
- case 0:
- return index;
- case 1:
- if (time.Hour < DayResetHour)
- {
- return Mathf.Max(0, index - 1);
- }
- else
- {
- return index;
- }
- default:
- return index;
- }
- }
- else
- {
- var index = 0;
- for (int i = 0; i < times.Count; i++)
- {
- if (times[i].InTime(time))
- {
- index = i;
- break;
- }
- }
- return index;
- }
}
public override bool SatisfyOpenCondition()
diff --git a/System/Welfare/OperationTimeHepler.cs b/System/Welfare/OperationTimeHepler.cs
index c1edbaa..6ca98dd 100644
--- a/System/Welfare/OperationTimeHepler.cs
+++ b/System/Welfare/OperationTimeHepler.cs
@@ -84,7 +84,8 @@
}
}
- if (!operation.inAdvanceNotify && operation.InAdvanceTime(TimeUtility.ServerNow))
+ if (!operation.inAdvanceNotify && operation.SatisfyOpenCondition()
+ && operation.InAdvanceTime(TimeUtility.ServerNow))
{
operation.inAdvanceNotify = true;
DebugEx.LogFormat("{0} 娲诲姩鎻愬墠寮�鍚�", (Operation)i);
@@ -427,6 +428,16 @@
return false;
}
+ public bool SatisfyAdvanceCondition(Operation type)
+ {
+ OperationBase operation;
+ if (TryGetOperationTime(type, out operation))
+ {
+ return operation.SatisfyOpenCondition() && InOperationAdvance(type);
+ }
+ return false;
+ }
+
public void ProcessConditionError(Operation type)
{
if (SatisfyOpenCondition(type))
@@ -596,18 +607,10 @@
public bool InTime(DateTime time)
{
- if (time.Hour < startHour || (time.Hour == startHour && time.Minute < startMinute))
- {
- return false;
- }
- if (time.Hour > endHour || (time.Hour == endHour && time.Minute >= endMinute))
- {
- return false;
- }
- return true;
+ return CompareTime(time) == 0;
}
- public int SideOfTime(DateTime time)
+ public int CompareTime(DateTime time)
{
if (time.Hour < startHour || (time.Hour == startHour && time.Minute < startMinute))
{
--
Gitblit v1.8.0