From 07d1576a5e725429bd82edf13f79ca22a2dcdd64 Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期四, 13 九月 2018 15:17:41 +0800
Subject: [PATCH] 3442运营活动修改
---
System/Welfare/OperationTimeHepler.cs | 45 ++++++++++++++++++++++++++++++++++++++-------
1 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/System/Welfare/OperationTimeHepler.cs b/System/Welfare/OperationTimeHepler.cs
index b41536b..13de069 100644
--- a/System/Welfare/OperationTimeHepler.cs
+++ b/System/Welfare/OperationTimeHepler.cs
@@ -16,6 +16,7 @@
public event Action<Operation, int> operationEndEvent;//娲诲姩缁撴潫鏃堕棿瑙﹀彂 绗簩涓弬鏁�0--杩囨椿鍔ㄦ椂闂磋Е鍙� 1--杩囨椿鍔ㄥぉ瑙﹀彂
public event Action<Operation, int> operationStartEvent;//娲诲姩寮�濮嬫椂闂村苟涓旀弧瓒冲紑鍚潯浠惰Е鍙� 绗簩涓弬鏁�0--娲诲姩鏃堕棿瑙﹀彂 1--娲诲姩澶╄Е鍙�
public event Action<int> dayResetEvent;//娲诲姩閲嶇疆浜嬩欢0-0鐐� 1-5鐐�
+ public event Action<Operation> operationAdvanceEvent;//娲诲姩鍦ㄦ彁鍓嶅紑鍚殑鏃堕棿鍐�
public OperationTimeHepler()
{
DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerDataInitializeEvent;
@@ -39,8 +40,8 @@
if (operationDict.ContainsKey((Operation)i))
{
var operation = operationDict[(Operation)i];
- if (operation.InDay(TimeUtility.ServerNow) && operation.SatisfyOpenCondition()
- && !operation.inDateNotify)
+ if (!operation.inDateNotify && operation.SatisfyOpenCondition()
+ && operation.InDay(TimeUtility.ServerNow))
{
operation.inDateNotify = true;
operation.stepDateNotify = false;
@@ -50,7 +51,7 @@
operationStartEvent((Operation)i, 1);
}
}
- else if (!operation.InDay(TimeUtility.ServerNow) && !operation.stepDateNotify)
+ else if (!operation.stepDateNotify && !operation.InDay(TimeUtility.ServerNow))
{
operation.inDateNotify = false;
operation.stepDateNotify = true;
@@ -60,8 +61,8 @@
operationEndEvent((Operation)i, 1);
}
}
- if (operation.InTime(TimeUtility.ServerNow) && operation.SatisfyOpenCondition()
- && !operation.inTimeNotify)
+ if (!operation.inTimeNotify && operation.SatisfyOpenCondition()
+ && operation.InTime(TimeUtility.ServerNow))
{
operation.inTimeNotify = true;
operation.stepTimeNotify = false;
@@ -71,14 +72,25 @@
operationStartEvent((Operation)i, 0);
}
}
- else if (!operation.InTime(TimeUtility.ServerNow) && !operation.stepTimeNotify)
+ else if (!operation.stepTimeNotify && !operation.InTime(TimeUtility.ServerNow))
{
operation.inTimeNotify = false;
operation.stepTimeNotify = true;
+ operation.inAdvanceNotify = false;
DebugEx.LogFormat("{0} 娲诲姩鏃堕棿缁撴潫", (Operation)i);
if (operationEndEvent != null)
{
operationEndEvent((Operation)i, 0);
+ }
+ }
+
+ if (!operation.inAdvanceNotify && operation.InAdvanceTime(TimeUtility.ServerNow))
+ {
+ operation.inAdvanceNotify = true;
+ DebugEx.LogFormat("{0} 娲诲姩鎻愬墠寮�鍚�", (Operation)i);
+ if (operationAdvanceEvent != null)
+ {
+ operationAdvanceEvent((Operation)i);
}
}
}
@@ -381,6 +393,26 @@
return 0;
}
+ public bool InOperationAdvance(Operation type)
+ {
+ OperationBase operation;
+ if (TryGetOperationTime(type, out operation))
+ {
+ return operation.InAdvanceTime(TimeUtility.ServerNow);
+ }
+ return false;
+ }
+
+ public int GetOperationSecondsBeforeStart(Operation type)
+ {
+ OperationBase operation;
+ if (TryGetOperationTime(type, out operation))
+ {
+ return operation.GetSecondsBeforeStart(TimeUtility.ServerNow);
+ }
+ return 0;
+ }
+
public bool SatisfyOpenCondition(Operation type)
{
OperationBase operation;
@@ -639,7 +671,6 @@
return Mathf.Max(0, (int)(d - y).TotalSeconds);
}
}
-
public enum Operation
{
--
Gitblit v1.8.0