| | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | |
| | | //布阵 |
| | | [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; |
| | | |
| | | //怒气条 |
| | |
| | | [SerializeField] Text atkCDText; //攻击cd |
| | | [SerializeField] Transform addTimesRect; |
| | | [SerializeField] Image addTimesItemImg; |
| | | [SerializeField] Text addTimesItemText; |
| | | |
| | | [SerializeField] ButtonEx closeBtn; |
| | | [SerializeField] ButtonEx scoreBtn; |
| | |
| | | [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>(); |
| | | }); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | GlobalTimeEvent.Instance.secondEvent += OnSecondEvent; |
| | | PlayerDatas.Instance.playerDataRefreshEvent += OnPlayerDataRefresh; |
| | | // GuildManager.Instance.FamilyActionInfoEvent += OnFamilyActionInfoEvent; |
| | | GuildBossManager.Instance.BossHurtEvent += BossHurtEvent; |
| | | Display(); |
| | | } |
| | | |
| | |
| | | { |
| | | GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent; |
| | | PlayerDatas.Instance.playerDataRefreshEvent -= OnPlayerDataRefresh; |
| | | // GuildManager.Instance.FamilyActionInfoEvent -= OnFamilyActionInfoEvent; |
| | | GuildBossManager.Instance.BossHurtEvent -= BossHurtEvent; |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | 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()); |
| | | } |
| | | |
| | | //战力变化 |
| | |
| | | fightPowerText.text = PlayerDatas.Instance.baseData.FightPower.ToString(); |
| | | } |
| | | |
| | | void OnFamilyActionInfoEvent(int familyID, int actionType) |
| | | |
| | | //显示动态UI |
| | | 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]; |
| | | |
| | |
| | | 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) |
| | |
| | | } |
| | | } |
| | | |
| | | 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(); |
| | | } |
| | | |
| | | } |