From e0d64492ac942c794c006a12dedfc4142ac29731 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期三, 14 一月 2026 03:47:40 +0800
Subject: [PATCH] 287 【公会】BOSS讨伐

---
 Main/System/Guild/GuildBossWin.cs |  240 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 222 insertions(+), 18 deletions(-)

diff --git a/Main/System/Guild/GuildBossWin.cs b/Main/System/Guild/GuildBossWin.cs
index f51875b..979e6ec 100644
--- a/Main/System/Guild/GuildBossWin.cs
+++ b/Main/System/Guild/GuildBossWin.cs
@@ -1,3 +1,4 @@
+using System;
 using System.Collections;
 using System.Collections.Generic;
 using Cysharp.Threading.Tasks;
@@ -23,10 +24,10 @@
     //甯冮樀
     [SerializeField] Text bzAttrText;
     [SerializeField] UIEffectPlayer bzEffect1;
-    [SerializeField] Text bzLayerText;
+    [SerializeField] Text bzLayerText;  //鍏細甯冮樀灞傜骇
     [SerializeField] UIEffectPlayer bzEffect2;
     [SerializeField] Button bzBtn;
-    [SerializeField] Text bzTimesText;  //甯冮樀娆℃暟
+    [SerializeField] Text bzTimesText;  //涓汉甯冮樀娆℃暟
     [SerializeField] Button bzRecordBtn;
 
     //鎬掓皵鏉�
@@ -40,7 +41,6 @@
     [SerializeField] Text atkCDText; //鏀诲嚮cd
     [SerializeField] Transform addTimesRect;
     [SerializeField] Image addTimesItemImg;
-    [SerializeField] Text addTimesItemText;
 
     [SerializeField] ButtonEx closeBtn;
     [SerializeField] ButtonEx scoreBtn;
@@ -56,12 +56,29 @@
     [SerializeField] GuildBossOtherPlayer otherPlayer;  //鍒涘缓澶氫釜鐢�
     [SerializeField] GuildBossOtherPlayerAttack otherPlayerAttack;  //鍒涘缓澶氫釜鐢�
 
+    [SerializeField] Transform fakeRedBZ;
+    [SerializeField] Transform fakeRedAward;
 
+    bool isCD = false;
 
     int beforeLayerNum; //甯冮樀灞傜骇 瀵规瘮鍙樺寲灞曠ず鐗规晥
     protected override void InitComponent()
     {
         closeBtn.AddListener(CloseWindow);
+        bzBtn.AddListener(OnBzBtnClick);
+        bzRecordBtn.AddListener(() =>
+        {
+            UIManager.Instance.OpenWindow<GuildBossPowerUPWin>();
+        });
+        atkBtn.AddListener(OnAtkBtnClick);
+        scoreBtn.AddListener(() =>
+        {
+            UIManager.Instance.OpenWindow<GuildBossHurtRankWin>();
+        });
+        awardBtn.AddListener(() =>
+        {
+            UIManager.Instance.OpenWindow<GuildBossAwardWin>();
+        });
     }
 
 
@@ -69,7 +86,7 @@
     {
         GlobalTimeEvent.Instance.secondEvent += OnSecondEvent;
         PlayerDatas.Instance.playerDataRefreshEvent += OnPlayerDataRefresh;
-        // GuildManager.Instance.FamilyActionInfoEvent += OnFamilyActionInfoEvent;
+        GuildBossManager.Instance.BossHurtEvent += BossHurtEvent;
         Display();
     }
 
@@ -77,7 +94,7 @@
     {
         GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent;
         PlayerDatas.Instance.playerDataRefreshEvent -= OnPlayerDataRefresh;
-        // GuildManager.Instance.FamilyActionInfoEvent -= OnFamilyActionInfoEvent;
+        GuildBossManager.Instance.BossHurtEvent -= BossHurtEvent;
     }
 
 
@@ -85,10 +102,14 @@
     {
         endTimeText.text = Language.Get("Arena14", TimeUtility.SecondsToHMS((int)(TimeUtility.GetTodayEndTime() - TimeUtility.ServerNow).TotalSeconds));
         fightPowerText.text = PlayerDatas.Instance.baseData.FightPower.ToString();
+        headCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID,
+                                                        PlayerDatas.Instance.baseData.face,
+                                                        PlayerDatas.Instance.baseData.facePic));
 
-        var bossAction = GuildBossManager.Instance.GetGuildBossAction();
-        ShowBzInfo(bossAction);
-
+        nameText.text = PlayerDatas.Instance.baseData.PlayerName;
+        BossHurtEvent();
+        bossModel.Create(GuildBossManager.Instance.bossSkinID);
+        heroModel.Create(PhantasmPavilionManager.Instance.GetMyModelSkinID());
     }
 
     //鎴樺姏鍙樺寲
@@ -98,31 +119,137 @@
             fightPowerText.text = PlayerDatas.Instance.baseData.FightPower.ToString();
     }
 
-    void OnFamilyActionInfoEvent(int familyID, int actionType)
+
+    //鏄剧ず鍔ㄦ�乁I
+    void ShowDynamicUI()
     {
-        if (actionType == GuildManager.GuildBossActionType)
+        var bossAction = GuildBossManager.Instance.GetGuildBossAction();
+        ShowRank();
+        ShowBzInfo(bossAction);
+
+        todayHurtText.text = Language.Get("GuildBoss17") + UIHelper.ReplaceLargeNum(GuildBossManager.Instance.m_BoxHurt);
+        if (GuildBossManager.Instance.m_BoxHurt >= GuildBossManager.Instance.m_BoxHurtHis)
         {
-            var bossAction = GuildBossManager.Instance.GetGuildBossAction();
-            if (beforeLayerNum != bossAction.Value3)
+            newHighestHurtImg.SetActive(true);
+        }
+        else
+        {
+            newHighestHurtImg.SetActive(false);
+        }
+
+        bzTimesText.text = Language.Get("Guild_65") + (GuildBossManager.Instance.m_BuZhenState == 1 ? "0/1" : UIHelper.AppendColor(TextColType.Green, "1/1", false));
+
+        ShowProcess(GuildBossManager.Instance.m_Anger * 1.0f / GuildBossManager.Instance.maxAngerValue);
+
+        if (isCD)
+        {
+            angerAtk.SetActive(false);
+            normalAtk.SetActive(false);
+        }
+        else
+        {
+            atkCDText.text = "";
+            if (GuildBossManager.Instance.m_Anger >= GuildBossManager.Instance.maxAngerValue)
             {
-                bzEffect1.Play();
-                bzEffect2.Play();
-                ShowBzInfo(bossAction);
+                angerAtk.SetActive(true);
+                normalAtk.SetActive(false);
             }
+            else
+            {
+                angerAtk.SetActive(false);
+                normalAtk.SetActive(true);
+                int cnt = GuildBossManager.Instance.GetHasAtkCnt();
+                if (cnt > 0)
+                {
+                    atkEffect.Play();
+                }
+                else
+                {
+                    atkEffect.Stop();
+                }
+
+                normalAtkCntText.text = Language.Get("TianziBillborad07", cnt);
+            }
+        }
+        var hasCnt = GuildBossManager.Instance.GetHasAtkCnt();
+        if (hasCnt > 0)
+        {
+            addTimesRect.SetActive(false);
+        }
+        else
+        {
+            addTimesRect.SetActive(true);
+            addTimesItemImg.SetItemSprite(GuildBossManager.Instance.addAtkCntItemID);
+        }
+
+        if (GuildBossManager.Instance.m_BoxUnGetCount > 0)
+        {
+            awardCntRect.SetActive(true);
+            awardCntText.text = Language.Get("TianziBillborad07", GuildBossManager.Instance.m_BoxUnGetCount);
+        }
+        else
+        {
+            awardCntRect.SetActive(false);
+        }
+
+        fakeRedBZ.SetActive(GuildBossManager.Instance.m_BuZhenState != 1);
+        fakeRedAward.SetActive(GuildBossManager.Instance.m_BoxUnGetCount > 0);
+    }
+
+    void BossHurtEvent()
+    {
+        var bossAction = GuildBossManager.Instance.GetGuildBossAction();
+        var layer = bossAction == null ? 0 : bossAction.Value3;
+
+        if (beforeLayerNum != layer)
+        {
+            bzEffect1.Play();
+            bzEffect2.Play();
+            beforeLayerNum = (int)layer;
+        }
+        ShowDynamicUI();
+    }
+
+    void ShowRank()
+    {
+        int myRank = GuildBossManager.Instance.GetMyRank();
+        if (myRank > 0)
+        {
+            rankRect.SetActive(true);
+            noRankText.SetActive(false);
+            rankText.text = myRank.ToString();
+        }
+        else
+        {
+            rankRect.SetActive(false);
+            noRankText.SetActive(true);
         }
     }
 
-
+    //甯冮樀
     void ShowBzInfo(HA513_tagMCFamilyActionInfo.tagMCFamilyAction bossAction)
     {
         bzAttrText.text = GetAddAttrs(bossAction);
-        bzLayerText.text = $"{bossAction.Value3}/{GuildBossManager.Instance.bzMaxLevel}";
+        var layer = bossAction == null ? 0 : bossAction.Value3;
+        var bzTime = bossAction == null ? 0 : bossAction.Value2;
+        if (bzTime == 0)
+        {
+            bzLayerText.text = $"{layer}/{GuildBossManager.Instance.bzMaxLevel}";
+        }
+        else
+        {
+            int remainTime = (int)Math.Max(0, bzTime - TimeUtility.AllSeconds);
+            if (remainTime > 0)
+            {
+                bzLayerText.text = $"{layer}/{GuildBossManager.Instance.bzMaxLevel}" + Language.Get("GuildBoss28", TimeUtility.SecondsToHMS(remainTime));
+            }
+        }
     }
 
     //鑾峰彇甯冮樀灞炴��
     string GetAddAttrs(HA513_tagMCFamilyActionInfo.tagMCFamilyAction action)
     {
-        var layerNum = action.Value3;
+        var layerNum = action == null ? 0 : action.Value3;
         var superHitRate = GuildBossManager.Instance.initSuperHitRate + (int)layerNum * GuildBossManager.Instance.bzAddAttrs[0];
         var addHurtPer = (int)layerNum * GuildBossManager.Instance.bzAddAttrs[1];
 
@@ -136,6 +263,8 @@
     void OnSecondEvent()
     {
         endTimeText.text = Language.Get("Arena14", TimeUtility.SecondsToHMS((int)(TimeUtility.GetTodayEndTime() - TimeUtility.ServerNow).TotalSeconds));
+        var bossAction = GuildBossManager.Instance.GetGuildBossAction();
+        ShowBzInfo(bossAction);
     }
 
     void ShowProcess(float value)
@@ -166,5 +295,80 @@
         }
     }
 
+    void OnBzBtnClick()
+    {
+        int curLayer = 0;
+        var bossAction = GuildBossManager.Instance.GetGuildBossAction();
+        if (bossAction != null)
+        {
+            curLayer = (int)bossAction.Value3;
+        }
+
+        if (curLayer >= GuildBossManager.Instance.bzMaxLevel)
+        {
+            SysNotifyMgr.Instance.ShowTip("GuildBoss2");
+            return;
+        }
+        if (GuildBossManager.Instance.m_BuZhenState == 1)
+        {
+            SysNotifyMgr.Instance.ShowTip("GuildBoss1");
+            return;
+        }
+
+        GuildBossManager.Instance.TaofaBoss(1);
+    }
+
+    void OnAtkBtnClick()
+    {
+        if (isCD) return;
+        //鎬掓皵浼ゅ涓嶆秷鑰楁鏁�
+        //娆℃暟涓嶈冻 鎻愮ず浣跨敤閬撳叿锛岃嫢鐢ㄥ畬鎻愮ず鏈棩娆℃暟宸茬敤瀹�
+        if (GuildBossManager.Instance.m_Anger < GuildBossManager.Instance.maxAngerValue)
+        {
+            if (GuildBossManager.Instance.GetHasAtkCnt() <= 0)
+            {
+                var itemCfg = ItemConfig.Get(GuildBossManager.Instance.addAtkCntItemID);
+                var singleCnt = itemCfg.EffectValueA1;
+                var todayUseMaxCnt = itemCfg.MaxSkillCnt;
+                if (GuildBossManager.Instance.m_ItemAddCount / singleCnt >= todayUseMaxCnt)
+                {
+                    SysNotifyMgr.Instance.ShowTip("HeroWishFinish");
+                    return;
+                }
+
+                ConfirmCancel.ShowUseItemPopConfirm(Language.Get("GuildBoss24"), Language.Get("GuildBoss23",
+                itemCfg.IconKey, singleCnt, todayUseMaxCnt - GuildBossManager.Instance.m_ItemAddCount / singleCnt),
+                GuildBossManager.Instance.addAtkCntItemID, 1, (bool isOK) =>
+                {
+                    if (isOK)
+                    {
+                        ItemLogicUtility.Instance.UseItem(PackManager.Instance.GetItemGUIDByID(GuildBossManager.Instance.addAtkCntItemID));
+                    }
+                });
+                return;
+            }
+        }
+
+        GuildBossManager.Instance.TaofaBoss(0);
+        ShowAttackCD().Forget();
+    }
+
+    async UniTask ShowAttackCD()
+    {
+        angerAtk.SetActive(false);
+        normalAtk.SetActive(false);
+        isCD = true;
+        atkBtn.SetColorful(null, false);
+        atkCDText.text = "3";
+        await UniTask.Delay(1000);
+        atkCDText.text = "2";
+        await UniTask.Delay(1000);
+        atkCDText.text = "1";
+        await UniTask.Delay(1000);
+        atkBtn.SetColorful(null, true);
+
+        isCD = false;
+        ShowDynamicUI();
+    }
 
 }
\ No newline at end of file

--
Gitblit v1.8.0