From b82d1347f6b6e44b9824f0b4d456a9245d07af5a Mon Sep 17 00:00:00 2001
From: client_Zxw <826696702@qq.com>
Date: 星期一, 12 十一月 2018 21:07:10 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
---
System/Dungeon/DungeonEnterInfo.cs | 27 ++++----
Core/NetworkPackage/DTCFile/ServerPack/HA7_Interaction/DTCA703_tagMCFBEnterTickList.cs | 2
System/Dungeon/DungeonModel.cs | 90 ++++++++++++++++--------------
System/Dungeon/DungeonData.cs | 23 ++++---
System/DailyQuest/DailyQuestBehaviour.cs | 8 +-
System/Dungeon/NormalDungeonEntranceWin.cs | 25 ++++----
6 files changed, 93 insertions(+), 82 deletions(-)
diff --git a/Core/NetworkPackage/DTCFile/ServerPack/HA7_Interaction/DTCA703_tagMCFBEnterTickList.cs b/Core/NetworkPackage/DTCFile/ServerPack/HA7_Interaction/DTCA703_tagMCFBEnterTickList.cs
index 38f4a65..66a4096 100644
--- a/Core/NetworkPackage/DTCFile/ServerPack/HA7_Interaction/DTCA703_tagMCFBEnterTickList.cs
+++ b/Core/NetworkPackage/DTCFile/ServerPack/HA7_Interaction/DTCA703_tagMCFBEnterTickList.cs
@@ -19,7 +19,7 @@
HA703_tagMCFBEnterTickList vNetData = vNetPack as HA703_tagMCFBEnterTickList;
if (vNetData.Cnt > 0) {
- model.UpdateEnterCD(vNetData.EnterTickList);
+ model.UpdateEnterCoolDown(vNetData.EnterTickList);
}
}
diff --git a/System/DailyQuest/DailyQuestBehaviour.cs b/System/DailyQuest/DailyQuestBehaviour.cs
index 6262cdd..15f9778 100644
--- a/System/DailyQuest/DailyQuestBehaviour.cs
+++ b/System/DailyQuest/DailyQuestBehaviour.cs
@@ -379,16 +379,16 @@
{
if (dailyQuestConfig.RelatedType == 2 && state == DailyQuestModel.DailyQuestState.Normal)
{
- var cd = dungeonModel.GetEnterCD(dailyQuestConfig.RelatedID);
- if (cd != null && cd.overdueTime > DateTime.Now)
+ var cd = dungeonModel.GetEnterCoolDown(dailyQuestConfig.RelatedID);
+ if (cd != null && dungeonModel.IsEnterCountDown(dailyQuestConfig.RelatedID))
{
- UpdateGotoTitle((int)(cd.overdueTime - DateTime.Now).TotalSeconds);
+ UpdateGotoTitle((int)(cd.endCoolDownTime - TimeUtility.ServerNow).TotalSeconds);
secondTimer += Time.deltaTime;
if (secondTimer > 1f)
{
secondTimer = 0f;
- UpdateGotoTitle((int)(cd.overdueTime - DateTime.Now).TotalSeconds);
+ UpdateGotoTitle((int)(cd.endCoolDownTime - TimeUtility.ServerNow).TotalSeconds);
}
}
else
diff --git a/System/Dungeon/DungeonData.cs b/System/Dungeon/DungeonData.cs
index 0e2b787..4ad6a95 100644
--- a/System/Dungeon/DungeonData.cs
+++ b/System/Dungeon/DungeonData.cs
@@ -227,23 +227,26 @@
}
- public class DungeonEnterCD
+ public class DungeonEnterCoolDown
{
public int mapId;
- public uint dungeonSurplusTime;
- public uint enterCd;
- public uint clearCdCost;
- public DateTime overdueTime;
+ public int level;
+ public int duration;
+ public int clearCoolDownCost;
+ public DateTime endCoolDownTime;
- public void SetEnterTime(uint _enterTime)
+ public void SetEnterTime(uint tick)
{
- dungeonSurplusTime = _enterTime;
- overdueTime = DateTime.Now.AddSeconds(dungeonSurplusTime);
+ endCoolDownTime = TimeUtility.GetTime(tick);
+ endCoolDownTime = endCoolDownTime.AddTicks(duration * TimeSpan.TicksPerSecond);
}
- public void SetCost(uint _cost)
+ public int suplursSeconds
{
- clearCdCost = _cost;
+ get
+ {
+ return Mathf.Max(0, (int)(endCoolDownTime - TimeUtility.ServerNow).TotalSeconds);
+ }
}
}
diff --git a/System/Dungeon/DungeonEnterInfo.cs b/System/Dungeon/DungeonEnterInfo.cs
index f58247a..65a1ff9 100644
--- a/System/Dungeon/DungeonEnterInfo.cs
+++ b/System/Dungeon/DungeonEnterInfo.cs
@@ -25,9 +25,9 @@
}
}
- DungeonEnterCD dungeonEnter;
+ DungeonEnterCoolDown dungeonEnter;
- public event Action OnCdComplete;
+ public event Action OnCoolDowndComplete;
private void Awake()
{
@@ -39,11 +39,11 @@
private void OnClearBtn()
{
- ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), UIHelper.ReplaceNewLine(Language.Get("FairyLand_Func11", dungeonEnter.clearCdCost)), (bool isOk) =>
+ ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), UIHelper.ReplaceNewLine(Language.Get("FairyLand_Func11", dungeonEnter.clearCoolDownCost)), (bool isOk) =>
{
if (isOk)
{
- if (PlayerDatas.Instance.baseData.GoldPaper + PlayerDatas.Instance.baseData.Gold >= dungeonEnter.clearCdCost)
+ if (PlayerDatas.Instance.baseData.GoldPaper + PlayerDatas.Instance.baseData.Gold >= dungeonEnter.clearCoolDownCost)
{
model.RequestClearEnterCD(dungeonEnter.mapId);
}
@@ -64,14 +64,14 @@
{
var dungeonId = model.GetDungeonId(model.currentDungeon);
var dungeonConfig = Config.Instance.Get<DungeonConfig>(dungeonId);
- dungeonEnter = model.GetEnterCD(dungeonConfig.DataMapID);
+ dungeonEnter = model.GetEnterCoolDown(dungeonConfig.DataMapID);
- model.updateDungeonEnterCD += UpdateDungeonEnterCD;
+ model.dungeonEnterCoolDownUpdate += UpdateDungeonEnterCD;
}
private void UpdateDungeonEnterCD()
{
- if (dungeonEnter.dungeonSurplusTime == 0)
+ if (dungeonEnter != null && dungeonEnter.suplursSeconds == 0)
{
gameObject.SetActive(false);
}
@@ -79,19 +79,20 @@
private void OnDisable()
{
- model.updateDungeonEnterCD -= UpdateDungeonEnterCD;
+ model.dungeonEnterCoolDownUpdate -= UpdateDungeonEnterCD;
}
private void LateUpdate()
{
- TimeSpan t = dungeonEnter.overdueTime - DateTime.Now;
- surplusTimeText.text = StringUtility.Contact(Language.Get("FairyLand_Func12"), t.Minutes.ToString("D2"), ":", Mathf.Max(0, t.Seconds).ToString("D2"));
- if (t.Minutes <= 0 && t.Seconds <= 0)
+ TimeSpan timeSpan = dungeonEnter.endCoolDownTime - TimeUtility.ServerNow;
+ surplusTimeText.text = StringUtility.Contact(Language.Get("FairyLand_Func12"), timeSpan.Minutes.ToString("D2"), ":",
+ Mathf.Max(0, timeSpan.Seconds).ToString("D2"));
+ if (timeSpan.Minutes <= 0 && timeSpan.Seconds <= 0)
{
gameObject.SetActive(false);
- if (OnCdComplete != null)
+ if (OnCoolDowndComplete != null)
{
- OnCdComplete();
+ OnCoolDowndComplete();
}
}
}
diff --git a/System/Dungeon/DungeonModel.cs b/System/Dungeon/DungeonModel.cs
index 7df7e0a..32ed825 100644
--- a/System/Dungeon/DungeonModel.cs
+++ b/System/Dungeon/DungeonModel.cs
@@ -17,7 +17,7 @@
Dictionary<int, DungeonRecord> dungeonRecords = new Dictionary<int, DungeonRecord>();
Dictionary<int, DailyQuestOpenTime> dungeonOpenTimes = new Dictionary<int, DailyQuestOpenTime>();
Dictionary<int, int[]> dungeonGradeRewardRate = new Dictionary<int, int[]>();
- Dictionary<int, DungeonEnterCD> dungeonEnterDic = new Dictionary<int, DungeonEnterCD>();
+ Dictionary<int, DungeonEnterCoolDown> dungeonEnterDict = new Dictionary<int, DungeonEnterCoolDown>();
Dictionary<int, string> dungeonBuyCntFormulaDic = new Dictionary<int, string>();
Dictionary<int, int> mapIdToDataMapId = new Dictionary<int, int>();
Dictionary<int, DateTime> dungeonCountRemainTimes = new Dictionary<int, DateTime>();
@@ -29,7 +29,7 @@
public event Action updateMissionEvent;
public event Action<int> dungeonStageChangeEvent;
public event Action getDungeonResultEvent;
- public event Action updateDungeonEnterCD;
+ public event Action dungeonEnterCoolDownUpdate;
public event Action updateDungeonBuyCnt;
public event Action dungeonFairyLandChangeEvent;
public event Action dungeonInspireLvEvent;
@@ -319,7 +319,7 @@
var dungeonId = GetDungeonId(_dungeon);
var dungeonConfig = Config.Instance.Get<DungeonConfig>(dungeonId);
- if (IsEnterCountDowning(_dungeon.mapId))
+ if (IsEnterCountDown(_dungeon.mapId))
{
_error = 1;
return false;
@@ -654,50 +654,51 @@
}
}
- public DungeonEnterCD GetEnterCD(int _mapID)
+ public DungeonEnterCoolDown GetEnterCoolDown(int _mapID)
{
- if (dungeonEnterDic.ContainsKey(_mapID))
+ if (dungeonEnterDict.ContainsKey(_mapID))
{
- return dungeonEnterDic[_mapID];
+ return dungeonEnterDict[_mapID];
}
return null;
}
- public bool HasEnterCD(int _mapID)
+ public bool ContainsDungeonEnter(int _mapID)
{
- return dungeonEnterDic.ContainsKey(_mapID);
+ return dungeonEnterDict.ContainsKey(_mapID);
}
- public bool IsEnterCountDowning(int _mapID)
+ public bool IsEnterCountDown(int _mapID)
{
- var cd = GetEnterCD(_mapID);
- if (cd == null)
+ var dungeonEnterInfo = GetEnterCoolDown(_mapID);
+ if (dungeonEnterInfo == null)
{
return false;
}
- if (cd.dungeonSurplusTime == 0)
+ if (dungeonEnterInfo.level != 0
+ && PlayerDatas.Instance.baseData.LV >= dungeonEnterInfo.level)
{
return false;
}
- return (cd.overdueTime - DateTime.Now).TotalSeconds > 0;
+ return (dungeonEnterInfo.endCoolDownTime - TimeUtility.ServerNow).TotalSeconds > 0;
}
- public void UpdateEnterCD(HA703_tagMCFBEnterTickList.tagMCFBEnterTick[] vNetDatas)
+ public void UpdateEnterCoolDown(HA703_tagMCFBEnterTickList.tagMCFBEnterTick[] vNetDatas)
{
for (int i = 0; i < vNetDatas.Length; i++)
{
var data = vNetDatas[i];
- if (dungeonEnterDic.ContainsKey((int)data.MapID))
+ if (dungeonEnterDict.ContainsKey((int)data.MapID))
{
- dungeonEnterDic[(int)data.MapID].SetEnterTime(data.LastEnterTick);
+ dungeonEnterDict[(int)data.MapID].SetEnterTime(data.LastEnterTick);
}
}
- if (updateDungeonEnterCD != null)
+ if (dungeonEnterCoolDownUpdate != null)
{
- updateDungeonEnterCD();
+ dungeonEnterCoolDownUpdate();
}
}
@@ -1350,45 +1351,50 @@
}
}
- FuncConfigConfig funcCfg = Config.Instance.Get<FuncConfigConfig>("FBEnterCD");
- if (funcCfg != null)
+ var funcConfig = Config.Instance.Get<FuncConfigConfig>("FBEnterCD");
+ if (funcConfig != null)
{
- Dictionary<int, uint> dic = ConfigParse.GetDic<int, uint>(funcCfg.Numerical1);
- foreach (var key in dic.Keys)
+ Dictionary<int, int> dict = ConfigParse.GetDic<int, int>(funcConfig.Numerical1);
+ foreach (var key in dict.Keys)
{
- DungeonEnterCD data = new DungeonEnterCD();
+ DungeonEnterCoolDown data = new DungeonEnterCoolDown();
data.mapId = key;
- data.enterCd = dic[key];
- dungeonEnterDic.Add(key, data);
+ data.duration = dict[key];
+ dungeonEnterDict.Add(key, data);
}
- dic = ConfigParse.GetDic<int, uint>(funcCfg.Numerical2);
- foreach (var key in dic.Keys)
+ dict = ConfigParse.GetDic<int, int>(funcConfig.Numerical2);
+ foreach (var key in dict.Keys)
{
- dungeonEnterDic[key].SetCost(dic[key]);
+ dungeonEnterDict[key].clearCoolDownCost = dict[key];
+ }
+ dict = ConfigParse.GetDic<int, int>(funcConfig.Numerical3);
+ foreach (var key in dict.Keys)
+ {
+ dungeonEnterDict[key].level = dict[key];
}
}
- funcCfg = Config.Instance.Get<FuncConfigConfig>("BuyFBCntCost");
- if (funcCfg != null)
+ funcConfig = Config.Instance.Get<FuncConfigConfig>("BuyFBCntCost");
+ if (funcConfig != null)
{
- JsonData jsonData = JsonMapper.ToObject(funcCfg.Numerical1);
+ JsonData jsonData = JsonMapper.ToObject(funcConfig.Numerical1);
foreach (var key in jsonData.Keys)
{
int _mapId = int.Parse(key);
dungeonBuyCntFormulaDic.Add(_mapId, jsonData[key].ToString());
}
}
- funcCfg = Config.Instance.Get<FuncConfigConfig>("MunekadoMapID");
- if (funcCfg != null)
+ funcConfig = Config.Instance.Get<FuncConfigConfig>("MunekadoMapID");
+ if (funcConfig != null)
{
- trialDungeonMapList.AddRange(ConfigParse.GetMultipleStr<int>(funcCfg.Numerical1));
+ trialDungeonMapList.AddRange(ConfigParse.GetMultipleStr<int>(funcConfig.Numerical1));
}
- funcCfg = Config.Instance.Get<FuncConfigConfig>("FBEncourageBuff");
- if (funcCfg != null)
+ funcConfig = Config.Instance.Get<FuncConfigConfig>("FBEncourageBuff");
+ if (funcConfig != null)
{
- dungeonMaxInspireCountDict = ConfigParse.GetDic<int, int>(funcCfg.Numerical2);
- dungeonInspireUpperDict = ConfigParse.GetDic<int, int>(funcCfg.Numerical3);
+ dungeonMaxInspireCountDict = ConfigParse.GetDic<int, int>(funcConfig.Numerical2);
+ dungeonInspireUpperDict = ConfigParse.GetDic<int, int>(funcConfig.Numerical3);
}
foreach (var _cfg in Config.Instance.GetAllValues<DungeonInspireConfig>())
@@ -1402,11 +1408,11 @@
_list.Add(_cfg);
}
- funcCfg = Config.Instance.Get<FuncConfigConfig>("FamilyInvadeCfg");
- if (funcCfg != null)
+ funcConfig = Config.Instance.Get<FuncConfigConfig>("FamilyInvadeCfg");
+ if (funcConfig != null)
{
- guardSkyBuffIds = JsonMapper.ToObject<int[]>(funcCfg.Numerical4);
- guardSkyGuardNpcs = JsonMapper.ToObject<int[]>(funcCfg.Numerical5);
+ guardSkyBuffIds = JsonMapper.ToObject<int[]>(funcConfig.Numerical4);
+ guardSkyGuardNpcs = JsonMapper.ToObject<int[]>(funcConfig.Numerical5);
}
}
diff --git a/System/Dungeon/NormalDungeonEntranceWin.cs b/System/Dungeon/NormalDungeonEntranceWin.cs
index 539a9c7..3d55409 100644
--- a/System/Dungeon/NormalDungeonEntranceWin.cs
+++ b/System/Dungeon/NormalDungeonEntranceWin.cs
@@ -85,8 +85,8 @@
protected override void OnAfterOpen()
{
playerPack.RefreshItemCountAct += OnPackageItemChange;
- model.updateDungeonEnterCD += UpdateDungeonEnterCD;
- m_EnterCdContainer.OnCdComplete += UpdateDungeonEnterCD;
+ model.dungeonEnterCoolDownUpdate += DungeonEnterCoolDownUpdate;
+ m_EnterCdContainer.OnCoolDowndComplete += DungeonEnterCoolDownUpdate;
PlayerDatas.Instance.PlayerDataRefreshInfoEvent += PlayerDataRefreshInfoEvent;
PlayerDatas.Instance.OnRoleAttrRefresh += OnWorldLevelRefresh;
FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent;
@@ -95,8 +95,8 @@
protected override void OnPreClose()
{
playerPack.RefreshItemCountAct -= OnPackageItemChange;
- model.updateDungeonEnterCD -= UpdateDungeonEnterCD;
- m_EnterCdContainer.OnCdComplete -= UpdateDungeonEnterCD;
+ model.dungeonEnterCoolDownUpdate -= DungeonEnterCoolDownUpdate;
+ m_EnterCdContainer.OnCoolDowndComplete -= DungeonEnterCoolDownUpdate;
PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= PlayerDataRefreshInfoEvent;
PlayerDatas.Instance.OnRoleAttrRefresh -= OnWorldLevelRefresh;
FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent;
@@ -119,13 +119,13 @@
m_ContainerGroup.gameObject.SetActive(!openGroup);
}
- private void UpdateDungeonEnterCD()
+ private void DungeonEnterCoolDownUpdate()
{
var dungeonId = model.GetDungeonId(model.currentDungeon);
var dungeonConfig = Config.Instance.Get<DungeonConfig>(dungeonId);
- bool _cd = model.HasEnterCD(dungeonConfig.DataMapID) && model.IsEnterCountDowning(dungeonConfig.DataMapID);
- m_EnterCdContainer.gameObject.SetActive(_cd);
- m_ContainerBtns.gameObject.SetActive(!_cd);
+ bool inCoolDown = model.ContainsDungeonEnter(dungeonConfig.DataMapID) && model.IsEnterCountDown(dungeonConfig.DataMapID);
+ m_EnterCdContainer.gameObject.SetActive(inCoolDown);
+ m_ContainerBtns.gameObject.SetActive(!inCoolDown);
DisplayFairyLandTip();
}
@@ -146,7 +146,7 @@
m_DungeonTitle.text = dungeonConfig.FBName;
- UpdateDungeonEnterCD();
+ DungeonEnterCoolDownUpdate();
m_BossPortrayal.gameObject.SetActive(true);
if (dungeonConfig.BossActorID != null && dungeonConfig.BossActorID.Length > 0)
@@ -378,7 +378,7 @@
return false;
}
- if (model.IsEnterCountDowning(model.currentDungeon.mapId))
+ if (model.IsEnterCountDown(model.currentDungeon.mapId))
{
_error = 4;
return false;
@@ -438,6 +438,7 @@
if (refreshType == PlayerDataRefresh.LV)
{
DisplayFairyLandTip();
+ DungeonEnterCoolDownUpdate();
}
}
@@ -458,9 +459,9 @@
{
var dungeonId = model.GetDungeonId(model.currentDungeon);
var dungeonConfig = Config.Instance.Get<DungeonConfig>(dungeonId);
- bool cd = model.HasEnterCD(dungeonConfig.DataMapID) && model.IsEnterCountDowning(dungeonConfig.DataMapID);
+ bool inCoolDown = model.ContainsDungeonEnter(dungeonConfig.DataMapID) && model.IsEnterCountDown(dungeonConfig.DataMapID);
var satisfy = (PlayerDatas.Instance.baseData.LV + GeneralDefine.fairyLandBuffCondition) <= PlayerDatas.Instance.worldLv
- && dungeonConfig.DataMapID == 31080 && !cd && FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.WorldLv);
+ && dungeonConfig.DataMapID == 31080 && !inCoolDown && FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.WorldLv);
m_FairyLandTipBehaviour.gameObject.SetActive(satisfy);
var config = Config.Instance.Get<SkillConfig>(GeneralDefine.fairyLandBuffId);
if (config != null)
--
Gitblit v1.8.0