From 7419fb5b162a0aeec17b520437aa3af8203639ca Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 15 一月 2026 02:08:23 +0800
Subject: [PATCH] 287 【公会】BOSS讨伐
---
Main/System/Guild/GuildBossOtherPlayer.cs | 42 ++++++
Main/System/Guild/GuildBossManager.cs | 37 ++++-
Main/System/Guild/GuildBossOtherPlayerAttack.cs | 18 ++
Main/System/Guild/GuildBossWin.cs | 211 +++++++++++++++++++++++++++++++++-
4 files changed, 280 insertions(+), 28 deletions(-)
diff --git a/Main/System/Guild/GuildBossManager.cs b/Main/System/Guild/GuildBossManager.cs
index 06b4aef..7ed0516 100644
--- a/Main/System/Guild/GuildBossManager.cs
+++ b/Main/System/Guild/GuildBossManager.cs
@@ -9,8 +9,9 @@
public Dictionary<int, HA513_tagMCFamilyActionInfo.tagMCFamilyAction> bossActions = new Dictionary<int, HA513_tagMCFamilyActionInfo.tagMCFamilyAction>();
// 鐜╁浼ゅ鎺掕
public List<HA513_tagMCFamilyActionInfo.tagMCFamilyAction> playerBossHurtRank = new List<HA513_tagMCFamilyActionInfo.tagMCFamilyAction>();
- //鏃堕棿鎴筹細璁ㄤ紣鏁版嵁
+ //鏃堕棿鎴筹細璁ㄤ紣鏁版嵁; 鐢ㄤ簬鎾斁姣忔鏀诲嚮
public Dictionary<int, TaofaAtkData> taofaAtkData = new Dictionary<int, TaofaAtkData>();
+ public int lastPlayTick = 0; //鎸夋椂闂撮『搴忔挱鏀撅紝褰撳墠鎾斁鐨則ick锛屽鏋滄壘涓嶅埌鍒欎粠绗竴涓紑濮�
//鐜╁ID锛氱帺瀹舵暟鎹� 锛堥��鍑哄叕浼氱殑鐜╁锛�
public Dictionary<int, MemberData> taofaPlayerData = new Dictionary<int, MemberData>();
public event Action BossHurtEvent;
@@ -37,9 +38,10 @@
public int[][] atkItemList;
public int maxAngerValue;
- public long[] bxCumulativeDamageList;
+ long[] bxCumulativeDamageList;
+ public List<long> allBXCumulativeDamageList = new List<long>();
public int bxDailyMax; //涓汉姣忔棩浜у嚭涓婇檺
- public int bxDailyAwardMax; //涓汉姣忔棩棰嗗彇濂栧姳涓婇檺
+ public long lastDmgAddValue; // 鏈�鍚庝竴妗d激瀹冲鍊煎惊鐜敤
public int addAtkCntItemID = 17; //澧炲姞璁ㄤ紣娆℃暟閬撳叿ID
public int bossSkinID = 7100300;
@@ -67,7 +69,20 @@
config = FuncConfigConfig.Get("FamilyTaofaBox");
bxCumulativeDamageList = JsonMapper.ToObject<long[]>(config.Numerical1);
bxDailyMax = int.Parse(config.Numerical2);
- bxDailyAwardMax = int.Parse(config.Numerical3);
+ lastDmgAddValue = bxCumulativeDamageList[bxCumulativeDamageList.Length - 1] - bxCumulativeDamageList[bxCumulativeDamageList.Length - 2];
+ //鏈�鍚庝竴妗e惊鐜�
+ for (int i = 0; i < bxDailyMax; i++)
+ {
+ if (i < bxCumulativeDamageList.Length)
+ {
+ allBXCumulativeDamageList.Add(bxCumulativeDamageList[i]);
+ }
+ else
+ {
+ allBXCumulativeDamageList.Add(allBXCumulativeDamageList[i - 1] + lastDmgAddValue);
+ }
+ }
+
}
public override void Init()
@@ -240,13 +255,15 @@
continue;
}
var arr = JsonMapper.ToObject<long[][]>(jsonData["atkList"].ToJson());
- taofaAtkData[(int)arr[0][0]] = new TaofaAtkData()
+ for (int i = 0; i < arr.Length; i++)
{
- playerID = (int)item.Value1,
- atkType = (int)arr[0][3],
- hurt = arr[0][2],
-
- };
+ taofaAtkData[(int)arr[i][0]] = new TaofaAtkData()
+ {
+ playerID = (int)item.Value1,
+ atkType = (int)arr[i][3],
+ hurt = arr[i][2],
+ };
+ }
if (jsonData.ContainsKey("info"))
{
diff --git a/Main/System/Guild/GuildBossOtherPlayer.cs b/Main/System/Guild/GuildBossOtherPlayer.cs
index 70e78f5..b41d4a3 100644
--- a/Main/System/Guild/GuildBossOtherPlayer.cs
+++ b/Main/System/Guild/GuildBossOtherPlayer.cs
@@ -1,4 +1,5 @@
-锘縰sing System.Collections.Generic;
+锘縰sing System;
+using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@@ -10,11 +11,44 @@
[SerializeField] Text hurtValueText;
[SerializeField] Image rankImg;
- public void Display()
+ [NonSerialized] public int moveState; // 0 缂撴參绉诲姩锛�1 蹇�熺獊杩沚oss
+ [NonSerialized] public int playerID;
+ [NonSerialized] public Vector3 startPos;
+ public void Display(HA513_tagMCFamilyActionInfo.tagMCFamilyAction data)
{
-
-
+ playerID = (int)data.Value1;
+ var playData = GuildBossManager.Instance.GetMemberData(playerID);
+ headCell.InitUI(AvatarHelper.GetAvatarModel(playerID, playData.Face, playData.FacePic));
+ nameText.text = playData.Name;
+ hurtValueText.text = UIHelper.ReplaceLargeNum(data.Value4 + data.Value5 * Constants.ExpPointValue);
+ var rank = GetRankIndex(playerID);
+ if (rank == 0)
+ {
+ rankImg.SetActive(false);
+ }
+ else
+ {
+ rankImg.SetActive(true);
+ rankImg.SetSprite("GuildBossRank" + rank);
+ }
}
+ int GetRankIndex(int playerID)
+ {
+ int rank = 0;
+ for (int i = 0; i < 3; i++)
+ {
+ if (GuildBossManager.Instance.playerBossHurtRank[i].Value1 == playerID)
+ {
+ rank = i + 1;
+ break;
+ }
+ }
+ return rank;
+ }
+ public void NotePos()
+ {
+ startPos = transform.localPosition;
+ }
}
diff --git a/Main/System/Guild/GuildBossOtherPlayerAttack.cs b/Main/System/Guild/GuildBossOtherPlayerAttack.cs
index 6cb245e..bed4d95 100644
--- a/Main/System/Guild/GuildBossOtherPlayerAttack.cs
+++ b/Main/System/Guild/GuildBossOtherPlayerAttack.cs
@@ -9,15 +9,25 @@
[SerializeField] Text hurtValueText;
[SerializeField] Text nameText;
[SerializeField] UIEffectPlayer atkEffect;
- [SerializeField] Transform atkValueRect;
+ // [SerializeField] Transform atkValueRect;
[SerializeField] ScaleTween scaleTween;
[SerializeField] UIAlphaTween uiAlphaTween;
- public void Display()
+ public void Display(TaofaAtkData taofaAtkData)
{
- scaleTween.SetStartState();
- uiAlphaTween.SetStartState();
+ angerAtkImg.SetActive(taofaAtkData.atkType == 1);
+ var data = GuildBossManager.Instance.GetMemberData(taofaAtkData.playerID);
+ nameText.text = data == null ? "" : data.Name;
+ hurtValueText.text = BattleUtility.DisplayDamageNum(taofaAtkData.hurt, 2);
+ atkEffect.Play();
+ scaleTween.Play();
+ uiAlphaTween.Play();
}
+ public void Hide()
+ {
+ uiAlphaTween.SetEndState();
+ }
+
}
diff --git a/Main/System/Guild/GuildBossWin.cs b/Main/System/Guild/GuildBossWin.cs
index ee91432..09fbbb1 100644
--- a/Main/System/Guild/GuildBossWin.cs
+++ b/Main/System/Guild/GuildBossWin.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using System.Linq;
using Cysharp.Threading.Tasks;
using DG.Tweening;
using UnityEngine;
@@ -49,12 +50,14 @@
[SerializeField] Text awardCntText;
//鏀诲嚮鍖�
[SerializeField] UIHeroController bossModel;
+
+ [SerializeField] Transform atkTargetPos;
[SerializeField] HorseController heroModel;
- [SerializeField] Transform attackArea1;
- [SerializeField] Transform attackArea2;
- [SerializeField] Transform attackArea3;
+ [SerializeField] Transform[] attackAreas;
+ [SerializeField] RectTransform attackAreaParent;
[SerializeField] GuildBossOtherPlayer otherPlayer; //鍒涘缓澶氫釜鐢�
- [SerializeField] GuildBossOtherPlayerAttack otherPlayerAttack; //鍒涘缓澶氫釜鐢�
+ List<GuildBossOtherPlayer> otherPlayers;
+ [SerializeField] GuildBossOtherPlayerAttack[] otherPlayerAttacks;
//鑷繁鐨勬敾鍑�
[SerializeField] UIEffectPlayer hurtEffect;
@@ -64,6 +67,9 @@
[SerializeField] Image[] awardIcons;
[SerializeField] Transform pos1;
[SerializeField] Transform pos2;
+ [SerializeField] Transform[] dropBoxes;
+ [SerializeField] Transform targetPos;
+
[SerializeField] Transform fakeRedBZ;
[SerializeField] Transform fakeRedAward;
@@ -229,6 +235,8 @@
beforeLayerNum = (int)layer;
}
ShowDynamicUI();
+ ShowDropBox();
+ ShowOtherAttacker();
}
void ShowRank()
@@ -286,6 +294,7 @@
endTimeText.text = Language.Get("Arena14", TimeUtility.SecondsToHMS((int)(TimeUtility.GetTodayEndTime() - TimeUtility.ServerNow).TotalSeconds));
var bossAction = GuildBossManager.Instance.GetGuildBossAction();
ShowBzInfo(bossAction);
+ OtherPlayerAnimation();
}
void ShowProcess(float value)
@@ -318,12 +327,12 @@
void OnBzBtnClick()
{
- int curLayer = 0;
- var bossAction = GuildBossManager.Instance.GetGuildBossAction();
- if (bossAction != null)
- {
- curLayer = (int)bossAction.Value3;
- }
+ // int curLayer = 0;
+ // var bossAction = GuildBossManager.Instance.GetGuildBossAction();
+ // if (bossAction != null)
+ // {
+ // curLayer = (int)bossAction.Value3;
+ // }
// if (curLayer >= GuildBossManager.Instance.bzMaxLevel)
// {
@@ -513,5 +522,187 @@
bossModel.onComplete = null;
};
bossModel.PlayAnimation("chuxian");
+ lastValueIndex = FindHurtIndex();
+
+ for (int i = 0; i < dropBoxes.Length; i++)
+ {
+ dropBoxes[i].transform.localScale = Vector3.zero;
+ }
+
+ for (int i = otherPlayers.Count - 1; i >= 0; i--)
+ {
+ otherPlayers[i].moveState = 0;
+ }
+ for (int i = 0; i < otherPlayerAttacks.Length; i++)
+ {
+ otherPlayerAttacks[i].Hide();
+ //缃簳
+ otherPlayerAttacks[i].transform.SetAsLastSibling();
+ }
+ }
+
+ int lastValueIndex = -1; // -1 鏈揪鏍�
+ void ShowDropBox()
+ {
+ int index = FindHurtIndex();
+ if (index > lastValueIndex)
+ {
+ var showBoxCnt = index - lastValueIndex;
+ lastValueIndex = index;
+ for (int i = 0; i < dropBoxes.Length; i++)
+ {
+ if (i < showBoxCnt)
+ {
+ dropBoxes[i].transform.localScale = Vector3.one*0.5f;
+
+ var startPos = new Vector3(UnityEngine.Random.Range(-80, 80), 30, 0);
+ //闅忔満鏂瑰悜杩斿洖1鎴栬��-1
+ int randDir = UnityEngine.Random.Range(0, 2) == 0 ? 1 : -1;
+
+ dropBoxes[i].localPosition = startPos;
+ int _index = i;
+ dropBoxes[i].DOLocalPath(new Vector3[] { startPos,
+ new Vector3(startPos.x + randDir * 10, startPos.y + 30f, 0),
+ new Vector3(startPos.x + randDir * 25, startPos.y - 60, 0) }, 0.5f, PathType.CatmullRom).SetEase(Ease.InOutSine).OnComplete(()=>
+ {
+ dropBoxes[_index].DOLocalMove(targetPos.localPosition, 0.3f).OnComplete(()=>
+ {
+ dropBoxes[_index].transform.localScale = Vector3.zero;
+ awardBtn.GetComponent<ScaleTween>().Play();
+ });
+ });
+ }
+ else
+ {
+ dropBoxes[i].transform.localScale = Vector3.zero;
+ }
+ }
+ }
+ }
+
+
+ int FindHurtIndex()
+ {
+ for (int i = 0; i < GuildBossManager.Instance.allBXCumulativeDamageList.Count; i++)
+ {
+ if (GuildBossManager.Instance.m_BoxHurt < GuildBossManager.Instance.allBXCumulativeDamageList[i])
+ {
+ return i - 1;
+ }
+ }
+ return GuildBossManager.Instance.allBXCumulativeDamageList.Count;
+ }
+
+ void ShowOtherAttacker()
+ {
+ CreateOtherAttacker();
+ var cnt = GuildBossManager.Instance.playerBossHurtRank.Count;
+ //浼ゅ楂樼殑鍦ㄤ笂闈紝閫嗗簭鏄剧ず
+ for (int i = otherPlayers.Count - 1; i >= 0; i--)
+ {
+ if (i < cnt)
+ {
+ otherPlayers[i].SetActive(true);
+ otherPlayers[i].Display(GuildBossManager.Instance.playerBossHurtRank[cnt - i - 1]);
+ }
+ else
+ {
+ otherPlayers[i].SetActive(false);
+ }
+
+ }
+ }
+
+ void CreateOtherAttacker()
+ {
+ if (otherPlayers.IsNullOrEmpty())
+ {
+ otherPlayers = new List<GuildBossOtherPlayer>();
+ }
+
+ int addCnt = GuildBossManager.Instance.playerBossHurtRank.Count - otherPlayers.Count;
+ for (int i = 0; i < addCnt; i++)
+ {
+ var inst = Instantiate(otherPlayer, attackAreaParent);
+ //鍧愭爣浠巃ttackAreas 闅忔満涓�涓粍浠讹紝鐒跺悗鍦ㄧ粍浠剁殑鑼冨洿鍐呴殢鏈猴紝鐖剁被涓篴ttackAreaParent
+ int pos = UnityEngine.Random.Range(0, attackAreas.Length);
+ var rect = attackAreas[pos] as RectTransform;
+ inst.transform.localPosition = attackAreas[pos].transform.localPosition +
+ new Vector3(UnityEngine.Random.Range(-rect.rect.width / 2, rect.rect.width / 2),
+ UnityEngine.Random.Range(-rect.rect.height / 2, rect.rect.height / 2), 0);
+ inst.NotePos();
+ otherPlayers.Add(inst);
+ }
+ }
+
+ void OtherPlayerAnimation()
+ {
+ if (GuildBossManager.Instance.taofaAtkData.Keys.Count == 0)
+ {
+ return;
+ }
+ var keys = GuildBossManager.Instance.taofaAtkData.Keys.ToList();
+ keys.Sort();
+ int index = keys.IndexOf(GuildBossManager.Instance.lastPlayTick) + 1;
+ if (index >= keys.Count)
+ {
+ index = 0;
+ }
+ GuildBossManager.Instance.lastPlayTick = keys[index];
+ var atkData = GuildBossManager.Instance.taofaAtkData[keys[index]];
+ var atkPlayerID = atkData.playerID;
+ for (int i = 0; i < otherPlayers.Count; i++)
+ {
+ if (!otherPlayers[i].isActiveAndEnabled)
+ {
+ continue;
+ }
+ if (otherPlayers[i].moveState != 0)
+ {
+ continue;
+ }
+ // 绐佽繘
+ if (otherPlayers[i].playerID == atkPlayerID)
+ {
+ if (otherPlayers[i].moveState != 1)
+ {
+ otherPlayers[i].moveState = 1;
+ //鍚戠洰鏍� atkTargetPos 绐佽繘80鍚庡洖鍘熶綅缃�
+ Vector3 currentPos = otherPlayers[i].transform.localPosition;
+ Vector3 targetPos = atkTargetPos.localPosition;
+
+ // 璁$畻浠庡綋鍓嶇偣鍒扮洰鏍囩偣鐨勬柟鍚戝悜閲�
+ Vector3 direction = (targetPos - currentPos).normalized;
+
+ // 鍚戠洰鏍囨柟鍚戠Щ鍔�80鐨勮窛绂�
+ Vector3 attackPos = currentPos + direction * 50f;
+
+ // 璁板綍鍘熶綅缃紝鐢ㄤ簬鍚庣画杩斿洖
+ Vector3 originalPos = currentPos;
+
+ // 鍏堢Щ鍔ㄥ埌鏀诲嚮浣嶇疆锛岀劧鍚庤繑鍥炲師浣嶇疆
+ // 鍏堝仠姝㈠師浣嶇疆鐨勭Щ鍔�
+ int _index = i;
+ int valueIndex = i % otherPlayerAttacks.Length;
+ otherPlayerAttacks[valueIndex].transform.localPosition = currentPos + direction * 160f;
+ otherPlayerAttacks[valueIndex].Display(atkData);
+
+ otherPlayers[i].transform.DOKill();
+ otherPlayers[i].transform.DOLocalMove(attackPos, 0.2f).SetEase(Ease.OutQuad)
+ .OnComplete(() =>
+ {
+ otherPlayers[_index].transform.DOLocalMove(originalPos, 0.2f).SetEase(Ease.InQuad);
+ otherPlayers[_index].moveState = 0;
+ });
+ }
+ continue;
+ }
+
+ otherPlayers[i].transform.DOKill();
+ //缂撴參绉诲姩
+ var randomPos = otherPlayers[i].startPos + new Vector3(UnityEngine.Random.Range(-50, 50), UnityEngine.Random.Range(-50, 50), 0);
+ otherPlayers[i].transform.DOLocalMove(randomPos, 2f).SetEase(Ease.InOutSine);
+
+ }
}
}
\ No newline at end of file
--
Gitblit v1.8.0