From c411e57aee620de402f934587e34ee5f7320cf8a Mon Sep 17 00:00:00 2001 From: "DESKTOP-SAJ6RKV\\Administrator" Date: Wed, 4 Jun 2025 13:35:01 +0800 Subject: [PATCH] 1 --- .../GameLogic/Manager/DataGameSceneManager.cs | 130 +++++++++++++----- 1 file changed, 98 insertions(+), 32 deletions(-) diff --git a/UnityProject/Assets/GameScripts/HotFix/GameLogic/Manager/DataGameSceneManager.cs b/UnityProject/Assets/GameScripts/HotFix/GameLogic/Manager/DataGameSceneManager.cs index 29b534db..97b112fb 100644 --- a/UnityProject/Assets/GameScripts/HotFix/GameLogic/Manager/DataGameSceneManager.cs +++ b/UnityProject/Assets/GameScripts/HotFix/GameLogic/Manager/DataGameSceneManager.cs @@ -421,6 +421,19 @@ namespace GameLogic } } + // 排序 + m_TempList.Sort((a, b) => + { + if (a.GetAllPower() > b.GetAllPower()) + { + return -1; + } + else + { + return 1; + } + }); + // 随机取三个阵营,扔减速Buff,并且排除自己 for (int i = 0; i < 3; i++) { @@ -428,9 +441,7 @@ namespace GameLogic { break; } - int index = UnityEngine.Random.Range(0, m_TempList.Count); - var item = m_TempList[index]; - m_TempList.RemoveAt(index); + var item = m_TempList[i]; // 添加减速Buff Buff m_Buff1 = new Buff(); m_Buff1.OnInit(giftConfig.Id, giftConfig.AddPower * num, giftConfig.TimerLen, giftConfig.AddGiftScore, num); @@ -519,41 +530,96 @@ namespace GameLogic return; } - int count = 3; // 最多给的Buff数量 - // 生成台风 + + List m_TempList = new List(); + foreach (var item in m_DicTeamList) { - if (item.Value != actor && count > 0) + if (item.Value != actor) { - count--; - - // 添加减速Buff - Buff m_Buff1 = new Buff(); - m_Buff1.OnInit(giftConfig.Id, giftConfig.AddPower * num, giftConfig.TimerLen, giftConfig.AddGiftScore, num); - item.Value.AddBuff(m_Buff1, unitPlayerData, giftConfig); - - - for (int i = 0; i < 5; i++) - { - // 添加减速Buff给到 - var eGo = GameModule.Resource.LoadGameObject(giftConfig.EffectName); - eGo.transform.SetParent(item.Value.GetRect().transform); - //eGo.transform.position = actor.GetRect().transform.position; - eGo.transform.localPosition = new Vector3(1500, 0, 0); - eGo.transform.localScale = Vector3.one * 20; - m_Buff1.m_EffectGo = eGo; - - // 移动特效 - eGo.transform.DOLocalMoveX(-2000, 16f).OnComplete(async () => - { - GameObject.Destroy(eGo); - }); - - await UniTask.Delay(500); // 延时1秒 - } + m_TempList.Add(item.Value); } } + + // 排序 + m_TempList.Sort((a, b) => + { + if (a.GetAllPower() > b.GetAllPower()) + { + return -1; + } + else + { + return 1; + } + }); + + for (int i = 0; i < 3; i++) + { + + // 添加减速Buff + Buff m_Buff1 = new Buff(); + m_Buff1.OnInit(giftConfig.Id, giftConfig.AddPower * num, giftConfig.TimerLen, giftConfig.AddGiftScore, num); + m_TempList[i].AddBuff(m_Buff1, unitPlayerData, giftConfig); + + + for (int j = 0; j < 5; j++) + { + // 添加减速Buff给到 + var eGo = GameModule.Resource.LoadGameObject(giftConfig.EffectName); + eGo.transform.SetParent(m_TempList[i].GetRect().transform); + //eGo.transform.position = actor.GetRect().transform.position; + eGo.transform.localPosition = new Vector3(1500, 0, 0); + eGo.transform.localScale = Vector3.one * 20; + m_Buff1.m_EffectGo = eGo; + + // 移动特效 + eGo.transform.DOLocalMoveX(-2000, 16f).OnComplete(async () => + { + GameObject.Destroy(eGo); + }); + + await UniTask.Delay(500); // 延时1秒 + } + } + + + //int count = 3; // 最多给的Buff数量 + + //// 生成台风 + //foreach (var item in m_DicTeamList) + //{ + // if (item.Value != actor && count > 0) + // { + // count--; + + // // 添加减速Buff + // Buff m_Buff1 = new Buff(); + // m_Buff1.OnInit(giftConfig.Id, giftConfig.AddPower * num, giftConfig.TimerLen, giftConfig.AddGiftScore, num); + // item.Value.AddBuff(m_Buff1, unitPlayerData, giftConfig); + + + // for (int i = 0; i < 5; i++) + // { + // // 添加减速Buff给到 + // var eGo = GameModule.Resource.LoadGameObject(giftConfig.EffectName); + // eGo.transform.SetParent(item.Value.GetRect().transform); + // //eGo.transform.position = actor.GetRect().transform.position; + // eGo.transform.localPosition = new Vector3(1500, 0, 0); + // eGo.transform.localScale = Vector3.one * 20; + // m_Buff1.m_EffectGo = eGo; + + // // 移动特效 + // eGo.transform.DOLocalMoveX(-2000, 16f).OnComplete(async () => + // { + // GameObject.Destroy(eGo); + // }); + + // await UniTask.Delay(500); // 延时1秒 + // } + // } + //} } ///