From 3b2a6bb9047cfce9f501593b3669a9c1af6c5df4 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期三, 05 十一月 2025 17:40:23 +0800
Subject: [PATCH] 130 战斗修改回合样式
---
Main/System/Battle/BattleManager.cs | 475 +++++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 366 insertions(+), 109 deletions(-)
diff --git a/Main/System/Battle/BattleManager.cs b/Main/System/Battle/BattleManager.cs
index 3749ba5..f879dec 100644
--- a/Main/System/Battle/BattleManager.cs
+++ b/Main/System/Battle/BattleManager.cs
@@ -10,35 +10,80 @@
// 鍚屾椂鍙兘鏈変竴鍦烘垬鏂楀湪杩涜 guid, battlefield
protected Dictionary<string, BattleField> battleFields = new Dictionary<string, BattleField>();
- protected LogicUpdate logicUpdate = new LogicUpdate();
+ public float[] speedGear; //鎴樻枟鍊嶆暟瀵瑰簲鐨勫疄闄呴�熺巼
+ public int speedIndex
+ {
+ get
+ {
+ return QuickSetting.Instance.GetQuickSettingValue<int>(QuickSettingType.BattleSpeed, 0);
+ }
+ set
+ {
+ QuickSetting.Instance.SetQuickSetting(QuickSettingType.BattleSpeed, value);
+ QuickSetting.Instance.SendPackage();
+ }
+ }
+ public readonly int[] speedIndexfuncIdArr = new int[] { 34, 35, 36 }; // 鎴樻枟鍊嶆暟瀵瑰簲鐨勫姛鑳絀D
+ public readonly int passFuncId = 33; // 璺宠繃鎴樻枟瀵瑰簲鐨勫姛鑳絀D
+ public int passRound; // 瓒呰繃X鍥炲悎鍙烦杩�
+ public int fightGuideID;
+ public int fightGuideMainLevelLimit;
+ public int fightGuideNoClickSeconds;
public Action<string, BattleField> onBattleFieldCreate;
- public Action<string, BattleField> onBattleFieldDestroy;
+ public Action onBattleFieldDestroy;
+
+ public bool isWaitServerStory = false; //涓荤嚎绛夋湇鍔$鍥炴姤 0425
public override void Init()
{
base.Init();
- logicUpdate.Start(Run);
+
+ LogicEngine.Instance.OnUpdate += Run;
DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOk;
+ DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerInit;
+ ParseConfig();
+
}
+
+ void ParseConfig()
+ {
+ var config = FuncConfigConfig.Get("AutoGuaji");
+ speedGear = JsonMapper.ToObject<float[]>(config.Numerical4);
+
+ config = FuncConfigConfig.Get("FightGuide");
+ fightGuideID = int.Parse(config.Numerical1);
+ fightGuideMainLevelLimit = int.Parse(config.Numerical2);
+ fightGuideNoClickSeconds = int.Parse(config.Numerical3);
+
+ config = FuncConfigConfig.Get("BattleButton");
+ passRound= int.Parse(config.Numerical1);
+ }
+
public override void Release()
{
base.Release();
- logicUpdate.Destroy();
+ LogicEngine.Instance.OnUpdate -= Run;
DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= OnPlayerLoginOk;
+ DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= BeforePlayerInit;
}
protected void OnPlayerLoginOk()
{
- ulong exAttr1 = PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.ExAttr1);
- ulong exAttr2 = PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.ExAttr2);
+ long exAttr1 = PlayerDatas.Instance.baseData.ExAttr1;
+ long exAttr2 = PlayerDatas.Instance.baseData.ExAttr2;
int MapID = 1;
int FuncLineID = (int)exAttr2;
CreateStoryBattle(MapID, FuncLineID, null, null);
+ }
+
+ void BeforePlayerInit()
+ {
+ isWaitServerStory = false; //鍚庣画鑰冭檻鏂嚎閲嶈繛
}
// 涓婃父鎴忕殑鏃跺�� 绛夋垬鏂楅樀瀹规洿鏂板畬姣� 鍒涘缓涓荤嚎鍓湰 鏁屾柟鐨勬暟鎹彲浠ユ殏鏃朵笉鏄剧ず 宸辨柟琛ㄧ幇涓虹潯瑙�
@@ -53,7 +98,11 @@
redTeamList.Add(storyTeam);
- CreateBattleField(string.Empty, MapID, FuncLineID, extendData, redTeamList, blueTeamList);
+ HB424_tagSCTurnFightInit vNetData = new HB424_tagSCTurnFightInit();
+ vNetData.MapID = (uint)MapID;
+ vNetData.FuncLineID = (uint)FuncLineID;
+
+ CreateBattleField(string.Empty, vNetData, extendData, redTeamList, blueTeamList);
}
else
{
@@ -115,51 +164,76 @@
List<GameNetPackBasic> packQueueSnapshot = new List<GameNetPackBasic>(packQueue);
- List<GameNetPackBasic> newPackList = new List<GameNetPackBasic>();
- HashSet<int> skipIndexes = new HashSet<int>();
+ List<GameNetPackBasic> newPackList = ParseBattlePackList(string.Empty, packQueueSnapshot);
- // 杩欓噷宸茬粡鏄寜鐓equeue鐨勯『搴忎簡
- for (int i = 0; i < packQueueSnapshot.Count; i++)
+ Action printNewPack = () =>
{
- if (skipIndexes.Contains(i)) continue;
-
- GameNetPackBasic pack = packQueueSnapshot[i];
-
- // 纰板埌B421 鎴柇 寰�涓嬫敹闆哹421閲岀殑鍏ㄩ儴鍐呭
- if (pack is HB421_tagMCTurnFightObjAction)
+ string temp = "After AnalysisPackQueueAndDistribute newPackList count: " + newPackList.Count + "\n";
+ foreach (var pack in newPackList)
{
- HB421_tagMCTurnFightObjAction b421Pack = pack as HB421_tagMCTurnFightObjAction;
-
- List<GameNetPackBasic> b421PackList = new List<GameNetPackBasic>();
- i++; // 璺宠繃褰撳墠鐨凚421鍖�
-
- for (; i < packQueueSnapshot.Count; i++)
+ if (pack is CustomHB426CombinePack b426Pack)
{
- GameNetPackBasic nextPack = packQueueSnapshot[i];
- if (nextPack is HB421_tagMCTurnFightObjAction)
- {
- // 閬囧埌浜嗗叾浠朆421 鍚姩瑙掕壊鐨凙ction寮�濮嬶紝
- // B421鍚庡啀纰板埌B421涓�瀹氭槸鏈変竴涓汉鐨勮鍔ㄧ粨鏉熶簡 鍥為��涓�涓綅缃�
- i--;
- break;
- }
- else
- {
- b421PackList.Add(nextPack);
- skipIndexes.Add(i); // 鏍囪宸茶鍚堝寘
- }
+ temp += " pack type is " + pack.GetType().Name + " tag is " + (b426Pack.startTag != null ? b426Pack.startTag.Tag : "null") + "\n";
}
-
- // 鍙兘娌$敤浜� 涓昏灏辨槸鍒╃敤涓�涓媠kill鐨刢ombine 鏆傜暀 鐪嬩箣鍚庤繕鏈夋病鏈夊埆鐨勯渶姹�
- CustomB421ActionPack actionPack = CustomB421ActionPack.CreateB421ActionPack(GetGUID(b421Pack.packUID), b421PackList);
-
- newPackList.Add(actionPack);
+ else if (pack is CustomB421ActionPack b421Pack)
+ {
+ temp += " pack type is " + pack.GetType().Name + " guid is " + b421Pack.guid + "\n";
+ }
+ else
+ {
+ temp += " pack type is " + pack.GetType().Name + "\n";
+ }
}
- else
- {
- newPackList.Add(pack);
- }
- }
+ Debug.LogWarning(temp);
+ };
+
+ printNewPack();
+
+ // HashSet<int> skipIndexes = new HashSet<int>();
+
+ // // 杩欓噷宸茬粡鏄寜鐓equeue鐨勯『搴忎簡
+ // for (int i = 0; i < packQueueSnapshot.Count; i++)
+ // {
+ // if (skipIndexes.Contains(i)) continue;
+
+ // GameNetPackBasic pack = packQueueSnapshot[i];
+
+ // // 纰板埌B421 鎴柇 寰�涓嬫敹闆哹421閲岀殑鍏ㄩ儴鍐呭
+ // if (pack is HB421_tagMCTurnFightObjAction)
+ // {
+ // HB421_tagMCTurnFightObjAction b421Pack = pack as HB421_tagMCTurnFightObjAction;
+
+ // List<GameNetPackBasic> b421PackList = new List<GameNetPackBasic>();
+ // i++; // 璺宠繃褰撳墠鐨凚421鍖�
+
+ // // 鏀堕泦鎵�鏈夐潪B421鍖咃紝鐩村埌閬囧埌涓嬩竴涓狟421鎴栭槦鍒楃粨鏉�
+ // for (; i < packQueueSnapshot.Count; i++)
+ // {
+ // GameNetPackBasic nextPack = packQueueSnapshot[i];
+ // if (nextPack is HB421_tagMCTurnFightObjAction)
+ // {
+ // i--; // 鍥為��涓�涓綅缃紝鐣欑粰澶栧眰寰幆澶勭悊
+ // break;
+ // }
+ // else
+ // {
+ // b421PackList.Add(nextPack);
+ // skipIndexes.Add(i); // 鏍囪宸茶鍚堝寘
+ // }
+ // }
+
+
+
+ // // 鍚堝苟鎵�鏈夌浉鍏冲寘
+ // CustomB421ActionPack actionPack = CustomB421ActionPack.CreateB421ActionPack(GetGUID(b421Pack.packUID), b421PackList);
+
+ // newPackList.Add(actionPack);
+ // }
+ // else
+ // {
+ // newPackList.Add(pack);
+ // }
+ // }
// 闃茶寖鏈哄埗锛氳繛缁娆℃病鏈夋垬鏂楃墖娈靛皝鍖呮椂鑷姩鍥炲煄
if (newPackList.Count == 0)
@@ -168,7 +242,7 @@
Debug.LogWarning($"杩炵画绌烘垬鏂楃墖娈靛皝鍖呮鏁帮細{continousEmptyCount}");
if (continousEmptyCount >= MaxContinousEmptyCount)
{
- BattleDebug.LogError("杩炵画澶氭娌℃湁鎴樻枟鐗囨灏佸寘锛岃嚜鍔ㄥ洖鍩庝紤鎭紒");
+ Debug.LogError("杩炵画澶氭娌℃湁鎴樻枟鐗囨灏佸寘锛岃嚜鍔ㄥ洖鍩庝紤鎭紒");
MainFightRequest(0); // 0-鍋滄鎴樻枟鍥炲煄
continousEmptyCount = 0;
packQueue.Clear();
@@ -180,51 +254,88 @@
continousEmptyCount = 0; // 鏈夊寘灏遍噸缃�
}
+
// b421璺焍426鐨勫寘宸茬粡澶勭悊瀹屼簡
- packQueue = new Queue<GameNetPackBasic>(newPackList);
+ packQueue.Clear();
+ for (int i = 0; i < newPackList.Count; i++)
+ {
+ var pack = newPackList[i];
+
+ packQueue.Enqueue(pack);
+ }
+
+
+
+ // packQueue = new Queue<GameNetPackBasic>(newPackList);
DistributeNextPackage();
+ }
+
+ public static List<GameNetPackBasic> ParseBattlePackList(string guid, List<GameNetPackBasic> packQueueSnapshot)
+ {
+ var list = CustomHB426CombinePack.CombineToSkillPackFromList(guid, packQueueSnapshot);
+ string str = "ParseBattlePackList \n";
+ for (int i = 0; i < list.Count; i++)
+ {
+ str += " " + list[i].GetType().Name + "\n";
+ }
+ // BattleDebug.LogError(str);
+ return list;
+
}
// 涓撳睘浜庝富绾挎垬鏂楃殑娲惧彂
public bool DistributeNextPackage()
{
- if (packQueue.Count > 0)
+ if (packQueue == null)
{
- GameNetPackBasic pack = packQueue.Peek();
-
- bool dequeue = false;
-
- if (pack is CustomHB426CombinePack)
- {
- CustomHB426CombinePack combinePack = pack as CustomHB426CombinePack;
- packQueue.Dequeue();
- combinePack.Distribute();
- }
- else if (pack is CustomB421ActionPack)
- {
- CustomB421ActionPack actionPack = pack as CustomB421ActionPack;
-
- dequeue = !actionPack.Distribute();
- }
- else
- {
- BattleDebug.LogError("distribute pack " + pack.GetType().Name);
- packQueue.Dequeue();
- PackageRegedit.Distribute(pack);
- }
-
- if (dequeue && packQueue.Count > 0)
- {
- packQueue.Dequeue();
- }
-
- return true;
+ Debug.LogWarning("DistributeNextPackage: packQueue涓虹┖鎴栧凡澶勭悊瀹屾瘯");
+ return false;
}
- else
+
+ if (packQueue.Count <= 0)
{
return false;
}
+
+ GameNetPackBasic pack = null;
+ try
+ {
+ pack = packQueue.Dequeue();
+ }
+ catch (Exception ex)
+ {
+ Debug.LogError("DistributeNextPackage: Peek寮傚父 " + ex);
+ return false;
+ }
+
+ try
+ {
+ if (pack is CustomHB426CombinePack combinePack)
+ {
+ combinePack.Distribute();
+ }
+ else if (pack is CustomB421ActionPack actionPack)
+ {
+ actionPack.Distribute();
+ }
+ else
+ {
+ PackageRegedit.Distribute(pack);
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.LogError("DistributeNextPackage: 鍒嗗彂鍖呭紓甯� " + ex);
+ // 鍑洪敊鏃朵富鍔ㄧЩ闄ゅ綋鍓嶅寘锛岄槻姝㈡寰幆
+ if (packQueue.Count > 0)
+ {
+ packQueue.Dequeue();
+ }
+ return false;
+ }
+
+ return packQueue.Count > 0;
}
public void OnConnected()
@@ -254,6 +365,7 @@
if (!battleReportDict.TryGetValue(guid, out queue))
{
queue = new Queue<GameNetPackBasic>();
+ battleReportDict.Add(guid, queue);
}
queue.Enqueue(vNetPack);
@@ -263,14 +375,41 @@
if (!battlePackRelationList.TryGetValue(guid, out uidList))
{
uidList = new List<ulong>();
+ battlePackRelationList.Add(guid, uidList);
}
- uidList.Add(vNetPack.packUID);
+ if (!uidList.Contains(vNetPack.packUID))
+ {
+ uidList.Add(vNetPack.packUID);
+ }
+ }
+
+ public void PushPackUID(string guid, ulong packUID)
+ {
+ List<ulong> uidList = null;
+
+ if (!battlePackRelationList.TryGetValue(guid, out uidList))
+ {
+ uidList = new List<ulong>();
+ battlePackRelationList.Add(guid, uidList);
+ }
+
+ if (!uidList.Contains(packUID))
+ {
+ uidList.Add(packUID);
+ }
+
}
public BattleField GetBattleField(ulong packUID)
{
- return GetBattleField(GetGUID(packUID));
+ string guid = GetGUID(packUID);
+ BattleField battleField = GetBattleField(GetGUID(packUID));
+ if (battleField == null || battleField.rejectNewPackage)
+ {
+ return null;
+ }
+ return battleField;
}
public BattleField GetBattleField(string guid)
@@ -296,49 +435,81 @@
{
Queue<GameNetPackBasic> queue = null;
+
if (!battleReportDict.TryGetValue(guid, out queue))
{
BattleDebug.LogError("DistributeNextReportPackage could not find queue for guid : " + guid);
return;
}
- var pack = queue.Dequeue();
- BattleDebug.LogError("distribute pack " + pack.GetType().Name);
-
- PackageRegedit.Distribute(pack);
-
if (queue.Count <= 0)
{
- battleReportDict.Remove(guid);
- battlePackRelationList.Remove(guid);
+ return;
}
- BattleDebug.LogError("BattlePackage count is " + queue.Count);
+ var pack = queue.Dequeue();
+
+ // Debug.LogError("DistributeNextReportPackage for guid : " + guid + " pack type : " + pack.GetType());
+
+ try
+ {
+ if (pack is CustomHB426CombinePack combinePack)
+ {
+ combinePack.Distribute();
+ }
+ else if (pack is CustomB421ActionPack actionPack)
+ {
+ actionPack.Distribute();
+ }
+ else
+ {
+ PackageRegedit.Distribute(pack);
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.LogError("DistributeNextPackage: 鍒嗗彂鍖呭紓甯� " + ex);
+ }
}
#endregion
- public BattleField CreateBattleField(string guid, int MapID, int FuncLineID, JsonData extendData, List<TeamBase> redTeamList, List<TeamBase> blueTeamList)
+ public BattleField CreateBattleField(string guid, HB424_tagSCTurnFightInit vNetData, JsonData extendData, List<TeamBase> redTeamList, List<TeamBase> blueTeamList)
{
BattleField battleField = null;
+ int MapID = (int)vNetData.MapID;
+ int FuncLineID = (int)vNetData.FuncLineID;
+
+ bool isCreate = true;
if (battleFields.TryGetValue(guid, out battleField))
{
- BattleDebug.LogError("鎴樺満宸插瓨鍦� 鍏堣繘琛岄攢姣�");
- battleField.Destroy();
+ //涓荤嚎鎴樺満闇�涓�鐩村瓨鍦�
+ if (string.IsNullOrEmpty(guid))
+ {
+ isCreate = false;
+ }
+ else
+ {
+ BattleDebug.LogError("鎴樺満宸插瓨鍦� 鍏堣繘琛岄攢姣�");
+ battleField.Destroy();
+ }
}
- battleField = BattleFieldFactory.CreateBattleField(guid, MapID, FuncLineID, extendData, redTeamList, blueTeamList);
-
- onBattleFieldCreate?.Invoke(guid, battleField);
-
- if (string.IsNullOrEmpty(guid))
+ if (isCreate)
{
- storyBattleField = (StoryBattleField)battleField;
+ battleField = BattleFieldFactory.CreateBattleField(guid, MapID, FuncLineID, extendData, redTeamList, blueTeamList);
+
+ if (string.IsNullOrEmpty(guid))
+ {
+ storyBattleField = (StoryBattleField)battleField;
+ }
+ battleFields.Add(guid, battleField);
+ onBattleFieldCreate?.Invoke(guid, battleField);
}
- battleFields.Add(guid, battleField);
- battleField.Init(MapID, FuncLineID, extendData, redTeamList, blueTeamList);
+
+ battleField.Init(MapID, FuncLineID, extendData, redTeamList, blueTeamList, vNetData.TurnMax);
return battleField;
}
@@ -351,14 +522,13 @@
return;
}
- onBattleFieldDestroy?.Invoke(battleField.guid, battleField);
+ battleField.Release();
string guid = battleField.guid;
- if (battleFields.ContainsKey(guid))
- {
- battleFields.Remove(guid);
- }
+ battleFields.Remove(guid);
+ battleReportDict.Remove(guid);
+ battlePackRelationList.Remove(guid);
if (storyBattleField == battleField)
{
@@ -366,31 +536,118 @@
}
GameObject.DestroyImmediate(battleField.battleRootNode.gameObject);
+
+ onBattleFieldDestroy?.Invoke();
+
}
// 鐩墠鏀寔 BYTE ReqType; // 0-鍋滄鎴樻枟鍥炲煄锛�1-璁剧疆娑堣�楀�嶅�硷紱2-鎸戞垬鍏冲崱灏忔�紱3-鎸戞垬鍏冲崱boss锛�4-缁х画鎴樻枟锛�
// 0-鍋滄鎴樻枟鍥炲煄 - 鐜╁涓诲姩鐐瑰嚮鍥炲煄鏃跺彂閫�
- // 1-璁剧疆娑堣�楀�嶅�� - 鐜╁璁剧疆娑堣�楀�嶅�硷紝瀵瑰簲鍒扮帺瀹禙ightPoint鐨勫��
+ // 1-璁剧疆娑堣�楀�嶅�� - 鐜╁璁剧疆娑堣�楀�嶅�硷紝瀵瑰簲鍒扮帺瀹秛seHarmerCount鐨勫��
// 2-鎸戞垬鍏冲崱灏忔�� - 鐜╁鐐瑰嚮寮�濮嬫垬鏂楁椂鍙戦�侊紝浠呬粠浼戞伅鐘舵�佸埌寮�濮嬫垬鏂楁椂鍙戦�佸嵆鍙�
- // 3-鎸戞垬鍏冲崱boss - 鐜╁璇锋眰鎸戞垬璇ュ叧鍗oss鏃跺彂閫�
+ // 3-閲嶅畾涔夋殏鏈娇鐢�
// 4-缁х画鎴樻枟 - 鐜╁涓荤嚎鎴樻枟涓紙鍖呭惈涓荤嚎灏忔��佷富绾縝oss锛夛紝鍓嶇琛ㄧ幇瀹屽悗绔悓姝ョ殑鎴樻枟鐗囨鍚庯紝鍙啀鍥炲璇ュ�硷紝鍚庣浼氭牴鎹垬鏂楅�昏緫鍙婃祦绋嬭嚜鍔ㄥ洖澶嶄笅涓�娈电殑鎴樻枟鐗囨灏佸寘锛屼竴鐩村惊鐜�
public void MainFightRequest(byte reqType, uint reqValue = 0)
{
+ // Debug.LogError("MainFightRequest reqType " + reqType + " reqValue " + reqValue);
CB413_tagCSMainFightReq req = new CB413_tagCSMainFightReq();
req.ReqType = reqType;
req.ReqValue = reqValue;
GameNetSystem.Instance.SendInfo(req);
+ if (reqType >= 2)
+ isWaitServerStory = true;
}
public void Run()
{
- foreach (var battleField in battleFields)
+ try
{
- battleField.Value?.Run();
+ List<string> keys = new List<string>(battleFields.Keys);
+ for (int i = keys.Count - 1; i >= 0; i--)
+ {
+ var battleField = battleFields[keys[i]];
+ battleField?.Run();
+ }
+ }
+ catch (System.Exception ex)
+ {
+ Debug.LogError(ex);
}
}
+ public BattleField GetBattleFieldByMapID(int v)
+ {
+ foreach (var battleField in battleFields)
+ {
+ if (battleField.Value.MapID == v)
+ {
+ return battleField.Value;
+ }
+ }
+
+ return null;
+ }
+
+ //鍙戣繘鍏ユ垬鏂楀寘
+ private float lastTime = 0f;
+ private float turnCoolDown = 0.5f; // 鍐峰嵈鏃堕棿
+ public void SendTurnFight(uint mapID, uint funcLineID = 0, byte tagType = 0, uint tagID = 0, uint[] valueList = null)
+ {
+ // 杩炵画棰戠箒鍙戝寘锛岃Е鍙戞彁绀�
+ float currentTime = Time.time;
+ if (currentTime - lastTime < turnCoolDown)
+ {
+ SysNotifyMgr.Instance.ShowTip("BattleCoolDown");
+ return;
+ }
+ lastTime = currentTime;
+
+ CB410_tagCMTurnFight pack = new CB410_tagCMTurnFight();
+ pack.MapID = mapID;
+ pack.FuncLineID = funcLineID;
+ pack.TagType = tagType;
+ pack.TagID = tagID;
+ if (!valueList.IsNullOrEmpty())
+ {
+ pack.ValueList = valueList;
+ pack.ValueCount = (byte)valueList.Length;
+ }
+ GameNetSystem.Instance.SendInfo(pack);
+ }
+
+ // 鑾峰彇褰撳墠姝e湪鏄剧ず鐨勬垬鏂楀満鏅悕绉帮紝濡傛灉娌℃湁鍒欒繑鍥炵┖瀛楃涓�
+ public string GetActiveBattleName()
+ {
+ foreach (var kvp in battleFields)
+ {
+ BattleField battleField = kvp.Value;
+ if (battleField == null)
+ continue;
+
+ var battleName = battleField.ToString();
+ if (BattleConst.battleNameToWinName.ContainsKey(battleName)
+ && UIManager.Instance.IsOpened(BattleConst.battleNameToWinName[battleName]))
+ return battleName;
+ }
+ return "";
+ }
+
+ // 鑾峰彇褰撳墠姝e湪鏄剧ず鐨勬垬鏂楀満鏅�,濡傛灉娌℃湁鍒欒繑鍥瀗ull
+ public BattleField GetActiveBattleFieldByName(string battleName)
+ {
+ foreach (var kvp in battleFields)
+ {
+ BattleField battleField = kvp.Value;
+ if (battleField == null)
+ continue;
+
+ var name = battleField.ToString();
+ if (name == battleName)
+ return battleField;
+ }
+ return null;
+ }
}
\ No newline at end of file
--
Gitblit v1.8.0