From 9e89e605d5429babb4b33df2e47ea86dff9d2ba7 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期四, 20 十一月 2025 11:55:04 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts
---
Main/System/Battle/BattleManager.cs | 102 ++++++++++++++++++++++++++++++++++++++------------
1 files changed, 77 insertions(+), 25 deletions(-)
diff --git a/Main/System/Battle/BattleManager.cs b/Main/System/Battle/BattleManager.cs
index 906f27b..13c35bb 100644
--- a/Main/System/Battle/BattleManager.cs
+++ b/Main/System/Battle/BattleManager.cs
@@ -2,6 +2,7 @@
using UnityEngine;
using LitJson;
using System;
+using System.Linq;
public class BattleManager : GameSystemManager<BattleManager>
{
@@ -23,10 +24,13 @@
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 int[] challengeBossGuides;
public Action<string, BattleField> onBattleFieldCreate;
@@ -54,6 +58,10 @@
fightGuideID = int.Parse(config.Numerical1);
fightGuideMainLevelLimit = int.Parse(config.Numerical2);
fightGuideNoClickSeconds = int.Parse(config.Numerical3);
+ challengeBossGuides = JsonMapper.ToObject<int[]>(config.Numerical4);
+
+ config = FuncConfigConfig.Get("BattleButton");
+ passRound= int.Parse(config.Numerical1);
}
@@ -67,8 +75,8 @@
protected void OnPlayerLoginOk()
{
- long exAttr1 = PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.ExAttr1);
- long 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;
@@ -139,6 +147,7 @@
{
if (!allow)
{
+ _package.socketType = ServerType.MainFight;
packQueue.Enqueue(_package);
}
}
@@ -161,6 +170,7 @@
List<GameNetPackBasic> newPackList = ParseBattlePackList(string.Empty, packQueueSnapshot);
+#if UNITY_EDITOR
Action printNewPack = () =>
{
string temp = "After AnalysisPackQueueAndDistribute newPackList count: " + newPackList.Count + "\n";
@@ -183,7 +193,7 @@
};
printNewPack();
-
+#endif
// HashSet<int> skipIndexes = new HashSet<int>();
// // 杩欓噷宸茬粡鏄寜鐓equeue鐨勯『搴忎簡
@@ -269,11 +279,11 @@
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";
- }
+ // string str = "ParseBattlePackList \n";
+ // for (int i = 0; i < list.Count; i++)
+ // {
+ // str += " " + list[i].GetType().Name + "\n";
+ // }
// BattleDebug.LogError(str);
return list;
@@ -484,10 +494,17 @@
isCreate = false;
}
else
- {
+ {
BattleDebug.LogError("鎴樺満宸插瓨鍦� 鍏堣繘琛岄攢姣�");
battleField.Destroy();
}
+ }
+
+ var bf = GetBattleFieldByMapID(MapID);
+ if (bf != null && !string.IsNullOrEmpty(guid))
+ {
+ BattleDebug.LogError("鐩稿悓鍦板浘ID鐨勬垬鍦哄凡瀛樺湪 鍏堣繘琛岄攢姣�");
+ bf.Destroy();
}
if (isCreate)
@@ -586,24 +603,31 @@
return null;
}
- /// <summary>
- /// 妫�鏌ユ槸鍚︽湁闈炰富绾挎垬鏂楋紙濡傜珵鎶�鍦恒�佺櫧楠ㄧ瓑锛夋鍦ㄨ繘琛�
- /// </summary>
- /// <returns>濡傛灉鏈変换浣曢潪涓荤嚎鎴樻枟涓旀湭缁撴潫锛屽垯杩斿洖true</returns>
- public bool IsOtherBattleInProgress()
+ //鍙戣繘鍏ユ垬鏂楀寘
+ 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)
{
- foreach (var kvp in battleFields)
+ // 杩炵画棰戠箒鍙戝寘锛岃Е鍙戞彁绀�
+ float currentTime = Time.time;
+ if (currentTime - lastTime < turnCoolDown)
{
- BattleField battleField = kvp.Value;
- // 妫�鏌ユ垬鍦烘槸鍚︽湁鏁堜笖灏氭湭缁撴潫
- if (battleField == null || battleField.IsBattleFinish)
- continue;
- // MapID 1 (StoryBattleField) 鍜� 2 (StoryBossBattleField) 閮芥槸涓荤嚎
- if (battleField.MapID == 1 || battleField.MapID == 2)
- continue;
- return true;
+ SysNotifyMgr.Instance.ShowTip("BattleCoolDown");
+ return;
}
- return false;
+ 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湪鏄剧ず鐨勬垬鏂楀満鏅悕绉帮紝濡傛灉娌℃湁鍒欒繑鍥炵┖瀛楃涓�
@@ -622,4 +646,32 @@
}
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;
+ }
+
+ public void DestroyAllBattleField()
+ {
+ var battleFieldsList = battleFields.Values.ToList();
+ foreach (var battleField in battleFieldsList)
+ {
+ if (battleField == null)
+ continue;
+ battleField.Destroy();
+ }
+ }
+
}
\ No newline at end of file
--
Gitblit v1.8.0