From 3b2a6bb9047cfce9f501593b3669a9c1af6c5df4 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期三, 05 十一月 2025 17:40:23 +0800
Subject: [PATCH] 130 战斗修改回合样式
---
Main/System/Main/HomeWin.cs | 342 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 323 insertions(+), 19 deletions(-)
diff --git a/Main/System/Main/HomeWin.cs b/Main/System/Main/HomeWin.cs
index 8e49695..fdac2ad 100644
--- a/Main/System/Main/HomeWin.cs
+++ b/Main/System/Main/HomeWin.cs
@@ -1,3 +1,4 @@
+using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@@ -12,6 +13,7 @@
//缁忛獙鍖�
[SerializeField] Text playerLevelText;
[SerializeField] SmoothSlider expSlider;
+ [SerializeField] Button officialUpBtn;
//浠诲姟鍖�
[SerializeField] Button taskButton; //寮曞鎴栬�呴鍙栦换鍔″鍔�
@@ -20,12 +22,41 @@
[SerializeField] Image awardIcon;
[SerializeField] Text awardCnt;
[SerializeField] UIEffectPlayer taskEffect;
-
+ [SerializeField] UIEffectPlayer lvUPEffect;
//鍏冲崱
[SerializeField] Button bossBtn;
+ [SerializeField] MainLevelWaveCell[] mainLevelWaves;
+ [SerializeField] ScrollRect mainLevelScrollRect;
+ [SerializeField] Text levelName;
+ [SerializeField] GameObject restMark;
+ [SerializeField] Button restBtn;
+ [SerializeField] GameObject fightMark;
+ [SerializeField] ScaleTween bossTween;
+ [SerializeField] GameObject bossmask; //瀹屾垚杩涘害閬尅绠¢亾 绾樉绀�
+ [SerializeField] GameObject bossActiveGo;
+ [SerializeField] GameObject bitemeGo;
+ [SerializeField] Text processText;
+
+
+ //鍗$墝
+ [SerializeField] HeroFightingCardCell[] heroFightingCardCells;
[SerializeField] Button changeHeroPosBtn;
+
+ //搴曢儴鍔熻兘
+ [SerializeField] Button autoBtn;
+ [SerializeField] Image autoCloseImg;
+ [SerializeField] UIEffectPlayer autoOpenEffect;
+ [SerializeField] Button blessLVBtn;
+ [SerializeField] Text blessLVText;
+ [SerializeField] Button mailBtn;
+
+ //鍙充晶鍔熻兘
+ [SerializeField] Button funcColBtn;
+ [SerializeField] RightFuncInHome rightFuncInHome;
+
+ [SerializeField] Button FirstChargeBtn;
/// <summary>
/// 鍒濆鍖栫粍浠�
@@ -33,49 +64,131 @@
protected override void InitComponent()
{
taskButton.AddListener(OnClickTaskButton);
- bossBtn.AddListener(() =>
- {
- UIManager.Instance.OpenWindow<MainBossEnterWin>();
- });
-
+ bossBtn.AddListener(OnClickEnterBoss);
+
changeHeroPosBtn.AddListener(() =>
{
HeroUIManager.Instance.selectTeamType = TeamType.Story;
UIManager.Instance.OpenWindow<HeroPosWin>();
+ });
+
+ autoBtn.AddListener(() =>
+ {
+ if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.AutoFight, true))
+ {
+ return;
+ }
+ UIManager.Instance.OpenWindow<AutoFightWin>();
+ });
+
+
+
+
+ FirstChargeBtn.AddListener(() =>
+ {
+ UIManager.Instance.OpenWindow<FirstChargeWin>();
+ });
+
+ blessLVBtn.AddListener(() =>
+ {
+ if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.BlessLV, true))
+ {
+ return;
+ }
+ UIManager.Instance.OpenWindow<BlessLVWin>();
+ });
+
+ mailBtn.AddListener(() =>
+ {
+ UIManager.Instance.OpenWindow<MailWin>();
+ });
+
+ officialUpBtn.AddListener(() =>
+ {
+ if (RealmConfig.GetKeys().Count <= PlayerDatas.Instance.baseData.realmLevel)
+ return;
+ UIManager.Instance.OpenWindow<OfficialUpWin>();
+ });
+
+ restBtn.AddListener(GotoRest);
+ funcColBtn.AddListener(()=>
+ {
+ rightFuncInHome.ShowFuncCol(true);
});
}
- public override void Refresh()
+ public void Display()
{
UpdatePlayerInfo();
UpdateTask();
+ RefreshRecharge();
+ ShowBlessLV();
+ DisplayAutoFight();
+ DisplayCard(TeamType.Story);
+ DisplayLevel();
+ DisplayRestState();
+
+ funcColBtn.SetActive(FuncOpen.Instance.IsFuncOpen(GeneralDefine.mainRightFuncOpenFuncID));
}
protected override void OnPreOpen()
{
PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefresh;
TaskManager.Instance.OnTaskUpdate += UpdateTask;
- Refresh();
- var battleWin = UIManager.Instance.OpenWindow<BattleWin>();
- battleWin.SetBattleField(BattleManager.Instance.storyBattleField);
+ BlessLVManager.Instance.OnBlessLVUpdateEvent += ShowBlessLV;
+ AutoFightModel.Instance.ChangeAutoEvent += DisplayAutoFight;
+ AutoFightModel.Instance.OnFightEvent += ChangeMode;
+ TeamManager.Instance.OnTeamChange += DisplayCard;
+ UIManager.Instance.OnCloseWindow += OnCloseWindow;
+ FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChange;
+ FirstChargeManager.Instance.OnUpdateFirstChargeInfo += OnUpdateFirstChargeInfo;
+ GlobalTimeEvent.Instance.secondEvent += OnSecondEvent;
+ HeroUIManager.Instance.OnUnLockHeroCountEvent += OnUnLockHeroCountEvent;
+ Display();
+ DisplayFirstChargeBtn();
+
+ // var battleWin = UIManager.Instance.OpenWindow<BattleWin>();
+ // battleWin.SetBattleField(BattleManager.Instance.storyBattleField);
}
- protected override void OnOpen()
- {
- base.OnOpen();
-
- }
+
protected override void OnPreClose()
{
PlayerDatas.Instance.playerDataRefreshEvent -= PlayerDataRefresh;
TaskManager.Instance.OnTaskUpdate -= UpdateTask;
+ BlessLVManager.Instance.OnBlessLVUpdateEvent -= ShowBlessLV;
+ AutoFightModel.Instance.ChangeAutoEvent -= DisplayAutoFight;
+ AutoFightModel.Instance.OnFightEvent -= ChangeMode;
+ TeamManager.Instance.OnTeamChange -= DisplayCard;
+ UIManager.Instance.OnCloseWindow -= OnCloseWindow;
+ FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChange;
+ FirstChargeManager.Instance.OnUpdateFirstChargeInfo -= OnUpdateFirstChargeInfo;
+ GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent;
+ HeroUIManager.Instance.OnUnLockHeroCountEvent -= OnUnLockHeroCountEvent;
+
+ // 鍏抽棴鐨勬椂鍊欐妸鎴樻枟鐣岄潰涔熺粰鍏充簡 铏界劧鏄湪澶栭潰寮�鐨�
UIManager.Instance.CloseWindow<BattleWin>();
}
+ private void OnClickEnterBoss()
+ {
+ // BattleField battleField = BattleManager.Instance.GetBattleFieldByMapID(2); //BOSS鎴樻枟
+
+ // if (null != battleField)
+ // {
+ // StoryBossBattleWin fsBattleWin = UIManager.Instance.OpenWindow<StoryBossBattleWin>();
+ // fsBattleWin.SetBattleField(battleField);
+ // return;
+ // }
+
+ UIManager.Instance.OpenWindow<MainBossEnterWin>();
+ }
+
+ int lastLV = 0;
void PlayerDataRefresh(PlayerDataType type)
{
switch (type)
@@ -85,8 +198,44 @@
ShowExp();
break;
case PlayerDataType.LV:
+ if (lastLV != PlayerDatas.Instance.baseData.LV)
+ {
+ lastLV = PlayerDatas.Instance.baseData.LV;
+ lvUPEffect.Play();
+ }
playerLevelText.text = PlayerDatas.Instance.baseData.LV.ToString();
break;
+ case PlayerDataType.ExAttr1:
+ case PlayerDataType.ExAttr2:
+ DisplayLevel();
+ break;
+ }
+
+
+ }
+
+ void RefreshRecharge()
+ {
+ //monthCardBtn.SetActive(!InvestModel.Instance.IsInvested(InvestModel.monthCardType));
+ }
+
+
+ void ShowBlessLV()
+ {
+ blessLVText.text = BlessLVManager.Instance.m_TreeLV.ToString();
+ }
+
+ void DisplayAutoFight()
+ {
+ if (AutoFightModel.Instance.isAutoAttackSet)
+ {
+ autoCloseImg.SetActive(false);
+ autoOpenEffect.Play();
+ }
+ else
+ {
+ autoCloseImg.SetActive(true);
+ autoOpenEffect.Stop();
}
@@ -111,7 +260,7 @@
void UpdateTask()
- {
+ {
var task = TaskManager.Instance.mainTask;
if (task.TaskID == 0)
{
@@ -123,8 +272,15 @@
var taskConfig = TaskConfig.Get(task.TaskID);
taskText.text = taskConfig.TaskDescribe;
taskNumText.text = string.Format("({0}/{1})", task.CurValue, taskConfig.NeedValue);
- taskNumText.color = task.CurValue >= taskConfig.NeedValue ? UIHelper.GetUIColor(TextColType.NavyYellow) : UIHelper.GetUIColor(TextColType.Red);
- taskEffect.SetActive(TaskManager.Instance.GetMainTaskState() == 2);
+ taskNumText.color = task.CurValue >= taskConfig.NeedValue ? UIHelper.GetUIColor(TextColType.NavyYellow) : UIHelper.GetUIColor(TextColType.Red);
+ if (TaskManager.Instance.GetMainTaskState() == 2)
+ {
+ taskEffect.Play();
+ }
+ else
+ {
+ taskEffect.Stop();
+ }
awardIcon.SetOrgSprite(ItemConfig.Get(taskConfig.AwardItemList[0][0]).IconKey);
awardCnt.text = taskConfig.AwardItemList[0][1].ToString();
}
@@ -140,9 +296,157 @@
getReward.DataEx = (uint)TaskManager.Instance.mainTask.TaskID;
GameNetSystem.Instance.SendInfo(getReward);
}
+
+ TaskManager.Instance.ClickTask();
+ }
+
+ void DisplayCard(TeamType teamType)
+ {
+ if (teamType != TeamType.Story)
+ return;
+ var team = TeamManager.Instance.GetTeam(teamType);
+ var heros = team.GetHerosOnTeam();
+ //鏄剧ず鍗$墝
+ for (int i = 0; i < heroFightingCardCells.Length; i++)
+ {
+ heroFightingCardCells[i].Display(i, heros);
+ }
+ }
+
+ private void OnCloseWindow(UIBase closeUI)
+ {
+ //鍏朵粬姝﹀皢鍔熻兘浜х敓鏁版嵁鍙樺寲锛岄渶瑕佸埛鏂版灏嗗垪琛�
+ if (closeUI is HeroTrainWin)
+ {
+ DisplayCard(TeamType.Story);
+ }
+ }
+
+
+ private void DisplayLevel()
+ {
+ var value = PlayerDatas.Instance.baseData.ExAttr2;
+ var chapterID = value / 10000;
+ var levelNum = value % 10000 / 100;
+ var waveID = value % 100;
+
+ var config = MainLevelConfig.GetMainLevelConfig(chapterID, levelNum);
+ var totalWave = MainLevelConfig.GetwaveCount(config);
+ for (int i = 0; i < mainLevelWaves.Length; i++)
+ {
+ if (i < totalWave)
+ {
+ mainLevelWaves[i].SetActive(true);
+ mainLevelWaves[i].Display(i);
+ }
+ else
+ {
+ mainLevelWaves[i].SetActive(false);
+ }
+ }
+
+ mainLevelScrollRect.normalizedPosition = new Vector2(waveID > 3 ? 1 : 0, 0);
+
+ var chapterConfig = MainChapterConfig.Get(chapterID);
+ //銆愭櫘閫氥�戝叧鍗″悕瀛�1-6
+ levelName.text = Language.Get("mainui7", chapterConfig.Level, chapterConfig.ChapterName, chapterID, levelNum);
+
+ bool canChallengeBoss = MainLevelManager.Instance.CanChallengeBoss();
+ //BOSS
+ if (canChallengeBoss)
+ {
+ bossActiveGo.SetActive(true);
+ processText.SetActive(false);
+ bossTween.Play();
+ bitemeGo.SetActive(true);
+ bossmask.SetActive(true);
+ }
else
{
- //鏍规嵁浠诲姟绫诲瀷寮曞
+ bossActiveGo.SetActive(false);
+ processText.SetActive(true);
+ processText.text = (waveID - 1) * 100 / totalWave + "%";
+ bossTween.Stop();
+ bitemeGo.SetActive(false);
+ bossmask.SetActive(false);
}
+
+ }
+
+ void DisplayRestState()
+ {
+ if (BattleManager.Instance.storyBattleField != null &&
+ BattleManager.Instance.storyBattleField.GetBattleMode() == BattleMode.Stop)
+ {
+ //浼戞伅涓�
+ restMark.SetActive(true);
+ fightMark.SetActive(false);
+ }
+ else
+ {
+ //鎴樻枟涓�
+ restMark.SetActive(false);
+ fightMark.SetActive(true);
+ }
+
+ }
+
+ void ChangeMode(bool isFight)
+ {
+ if (isFight)
+ return;
+ DisplayRestState();
+ DisplayLevel();
+ }
+
+ void GotoRest()
+ {
+ if (BattleManager.Instance.storyBattleField != null &&
+ BattleManager.Instance.storyBattleField.GetBattleMode() != BattleMode.Stop)
+ {
+ BattleManager.Instance.storyBattleField.HaveRest();
+ }
+ }
+
+ private void DisplayFirstChargeBtn()
+ {
+ bool isFirstChargeFuncOpen = FuncOpen.Instance.IsFuncOpen(FirstChargeManager.FuncID);
+ if (FirstChargeManager.Instance.IsAllFirstChargeRewardsClaimed() &&
+ FirstChargeManager.Instance.IsNextDayAfterAllClaimed())
+ {
+ FirstChargeBtn.SetActive(false);
+ }
+ else
+ {
+ FirstChargeBtn.SetActive(isFirstChargeFuncOpen);
+ }
+
+ }
+
+ private void OnFuncStateChange(int funcId)
+ {
+ if (funcId == FirstChargeManager.FuncID)
+ {
+ DisplayFirstChargeBtn();
+ }
+ else if (funcId == GeneralDefine.mainRightFuncOpenFuncID)
+ {
+ funcColBtn.SetActive(FuncOpen.Instance.IsFuncOpen(GeneralDefine.mainRightFuncOpenFuncID));
+ }
+ }
+
+ private void OnUpdateFirstChargeInfo()
+ {
+ DisplayFirstChargeBtn();
+ }
+
+ private void OnSecondEvent()
+ {
+ DisplayFirstChargeBtn();
+ }
+
+ void OnUnLockHeroCountEvent()
+ {
+ DisplayCard(TeamType.Story);
}
}
\ No newline at end of file
--
Gitblit v1.8.0