From 453e96025c4f78888e11f8da85fbdb78245e23f9 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期一, 29 十二月 2025 02:36:23 +0800
Subject: [PATCH] 351 【内政】红颜系统
---
Main/System/Battle/BaseBattleWin.cs | 194 +++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 173 insertions(+), 21 deletions(-)
diff --git a/Main/System/Battle/BaseBattleWin.cs b/Main/System/Battle/BaseBattleWin.cs
index ec9484d..a71b94e 100644
--- a/Main/System/Battle/BaseBattleWin.cs
+++ b/Main/System/Battle/BaseBattleWin.cs
@@ -1,4 +1,5 @@
-锘縰sing UnityEngine;
+锘縰sing System.Collections.Generic;
+using UnityEngine;
using UnityEngine.UI;
/// <summary>
@@ -14,7 +15,6 @@
[SerializeField] protected Button btnSpeed; // 閫熷害鎺у埗
[SerializeField] protected Text textSpeed; // 閫熷害鏄剧ず
[SerializeField] protected Button btnPass; // 璺宠繃鎴樻枟
- [SerializeField] protected Button btnPause; // 鏆傚仠鎸夐挳 (BattleWin涓殑btnStop鍙搴旀鎸夐挳)
[Header("鎴樻枟UI缁勪欢")]
[SerializeField] protected TotalDamageDisplayer totalDamageDisplayer; // 浼ゅ缁熻
@@ -33,20 +33,26 @@
if (btnPass != null)
btnPass.AddListener(OnClickPass);
-
- if (btnPause != null)
- btnPause.AddListener(OnClickPause);
}
protected override void OnPreOpen()
{
base.OnPreOpen();
+ UIManager.Instance.CloseWindow<MapLoadingWin>();
BattleManager.Instance.onBattleFieldCreate += OnCreateBattleField;
RegisterBattleEvents();
// 鍦ㄦ墦寮�鏃堕渶瑕佹殏鍋滀富绾挎垬鏂�
if (BattleManager.Instance.storyBattleField != null)
+ {
BattleManager.Instance.storyBattleField.IsPause = true;
+ if (UIManager.Instance.IsOpened<EquipExchangeWin>())
+ {
+ UIManager.Instance.CloseWindow<EquipExchangeWin>();
+ }
+ }
+
+ PlayBackGroundMusic();
}
protected override void OnPreClose()
@@ -60,10 +66,13 @@
if (BattleManager.Instance.storyBattleField != null)
BattleManager.Instance.storyBattleField.IsPause = false;
+ // battleField?.SetFocus(false);
+
if (battleField != null)
{
battleField.OnRoundChange -= OnRoundChange;
}
+ SoundPlayer.Instance.StopBackGroundMusic();
}
protected override void OnClose()
@@ -76,6 +85,7 @@
}
battleField = null;
}
+
/// <summary>
/// 閫氱敤鍒锋柊閫昏緫 (妯℃澘鏂规硶)
@@ -176,26 +186,145 @@
battleField.OnRoundChange += OnRoundChange;
OnRoundChange(battleField.round, battleField.turnMax); // 绔嬪嵆鎵ц涓�娆′互鏄剧ず鍒濆鍥炲悎
}
-
-
- /// <summary>
- /// 鏆傚仠/缁х画
- /// </summary>
- protected virtual void OnClickPause()
- {
- if (null == battleField)
- return;
- battleField.IsPause = !battleField.IsPause;
- }
-
/// <summary>
/// 璺宠繃鎴樻枟
/// </summary>
protected virtual void OnClickPass()
{
- if (null == battleField)
+ if (!IsPass())
return;
battleField.ForceFinish();
+ }
+
+ public bool IsPass()
+ {
+ if (null == battleField)
+ return true;
+
+ bool hasForeverPrivilege = InvestModel.Instance.IsInvested(InvestModel.foreverCardType);
+ string battleFieldName = battleField.ToString();
+
+ // 妫�鏌ュ姛鑳藉紑鍚姸鎬�
+ if (!IsPassOpen(hasForeverPrivilege, battleFieldName))
+ return false;
+
+ // 鑾峰彇閰嶇疆鐨勫洖鍚堥檺鍒�
+ int configRoundLimit = GetRequiredPassRound(hasForeverPrivilege, battleFieldName);
+ int nowRound = battleField.round > 0 ? battleField.round : 1;
+ if (nowRound >= configRoundLimit + 1)
+ {
+ return true;
+ }
+ ShowSkipWaitTip(configRoundLimit, battleFieldName, hasForeverPrivilege);
+ return false;
+ }
+
+ private bool IsPassOpen(bool hasForeverPrivilege, string battleFieldName)
+ {
+ // 鎷ユ湁姘镐箙鐗规潈鍗★紝鏃犺鍔熻兘寮�鍚檺鍒�
+ if (hasForeverPrivilege)
+ return true;
+
+ int passFuncId = BattleManager.Instance.passFuncId;
+ // 妫�鏌ュ姛鑳絀D鏄惁寮�鍚�
+ if (FuncOpen.Instance.IsFuncOpen(passFuncId))
+ return true;
+
+ if (!FuncOpenLVConfig.HasKey(passFuncId))
+ return true;
+ int lv = FuncOpenLVConfig.Get(passFuncId).LimitLV;
+ SysNotifyMgr.Instance.ShowTip("BattlePass2", lv);
+ return false;
+ }
+
+ private int GetRequiredPassRound(bool hasForeverPrivilege, string battleFieldName)
+ {
+ // 鍒濆鍖栭粯璁ゅ��
+ int resultRound = BattleManager.Instance.defaultPassRound;
+
+ // 灏濊瘯鑾峰彇鏅�氶厤缃紙瑕嗙洊榛樿鍊硷級
+ if (BattleConst.FieldNameToIndex.TryGetValue(battleFieldName, out int index))
+ {
+ if (BattleManager.Instance.passDict.TryGetValue(index, out int normalRound))
+ {
+ resultRound = normalRound;
+ }
+ }
+ else
+ {
+ // 濡傛灉杩炵储寮曢兘鎵句笉鍒帮紝鐩存帴杩斿洖榛樿鍊硷紝鏃犻渶鍚庣画鍒ゆ柇
+ return resultRound;
+ }
+
+ // 濡傛灉娌℃湁鐗规潈锛岀洿鎺ヨ繑鍥炴櫘閫氶厤缃�
+ if (!hasForeverPrivilege)
+ return resultRound;
+
+ // 鍒ゆ柇鐗规潈鏄惁鐢熸晥
+ bool isPrivilegeEffective = true;
+
+ // 鐗规畩瑙勫垯锛氫富绾緽OSS闇�瑕佽揪鍒版寚瀹氱珷鑺傦紝鐗规潈鎵嶇敓鏁�
+ if (battleFieldName == BattleConst.StoryBossBattleField)
+ {
+ if (IsStoryBossChapterLimited())
+ {
+ isPrivilegeEffective = false;
+ }
+ }
+
+ if (isPrivilegeEffective)
+ {
+ var vipDict = BattleManager.Instance.foreverPrivilegePassDict;
+ // 鍙湁褰撶壒鏉冭〃閲屾樉寮忛厤缃簡璇ユ垬鍦猴紝鎵嶈繘琛岃鐩�
+ if (vipDict.TryGetValue(index, out int vipRound))
+ {
+ resultRound = vipRound;
+ }
+ }
+
+ return resultRound;
+ }
+
+ private void ShowSkipWaitTip(int configRoundLimit, string battleFieldName, bool hasForeverPrivilege)
+ {
+ int waitRound = Mathf.Max(configRoundLimit - battleField.round + 1, 0);
+
+ // 涓荤嚎BOSS鎴樺満鐗规畩鎻愮ず
+ if (battleFieldName == BattleConst.StoryBossBattleField)
+ {
+ if (!hasForeverPrivilege || IsStoryBossChapterLimited())
+ {
+ SysNotifyMgr.Instance.ShowTip("BattlePass3", waitRound, BattleManager.Instance.passChapterID);
+ }
+ else
+ {
+ SysNotifyMgr.Instance.ShowTip("BattlePass", waitRound);
+ }
+ }
+ // 鍏朵粬鎴樺満鎻愮ず
+ else
+ {
+ if (hasForeverPrivilege)
+ {
+ SysNotifyMgr.Instance.ShowTip("BattlePass", waitRound);
+ }
+ else
+ {
+ SysNotifyMgr.Instance.ShowTip("BattlePass1", waitRound);
+ }
+
+ }
+ }
+
+ /// <summary>
+ /// 妫�鏌ヤ富绾緽OSS鏄惁鍙楀埌绔犺妭闄愬埗
+ /// </summary>
+ private bool IsStoryBossChapterLimited()
+ {
+ long currentProgress = PlayerDatas.Instance.baseData.ExAttr2;
+ int nowChapterID = (int)(currentProgress / 10000);
+
+ return nowChapterID <= BattleManager.Instance.passChapterID;
}
/// <summary>
@@ -206,9 +335,26 @@
if (null == battleField)
return;
- BattleManager.Instance.speedIndex = (BattleManager.Instance.speedIndex + 1) % BattleManager.Instance.speedGear.Length;
+ // 璁$畻涓嬩竴涓�熷害妗d綅鐨勭储寮�
+ int nextSpeedIndex = (BattleManager.Instance.speedIndex + 1) % BattleManager.Instance.speedGear.Length;
+ bool isOpen = false;
+ if (InvestModel.Instance.IsActiveFightSpeed(3))
+ {
+ isOpen = true;
+ }
+ else
+ {
+ // 妫�鏌ヤ笅涓�妗e�嶉�熷姛鑳芥槸鍚﹀紑鍚�
+ int nextSpeedFuncId = BattleManager.Instance.speedIndexfuncIdArr[nextSpeedIndex];
+ isOpen = FuncOpen.Instance.IsFuncOpen(nextSpeedFuncId);
+ if (!isOpen && FuncOpenLVConfig.HasKey(nextSpeedFuncId))
+ {
+ var config = FuncOpenLVConfig.Get(nextSpeedFuncId);
+ SysNotifyMgr.Instance.ShowTip("BattleSpeedTip", TaskManager.Instance.GetNeedFinishTaskCount(config.LimitMissionID), nextSpeedIndex + 1);
+ }
+ }
+ BattleManager.Instance.speedIndex = !isOpen ? 0 : nextSpeedIndex;
battleField.SetSpeedRatio(BattleManager.Instance.speedGear[BattleManager.Instance.speedIndex]);
-
if (textSpeed != null)
textSpeed.text = (BattleManager.Instance.speedIndex + 1).ToString();
}
@@ -272,8 +418,14 @@
{
if (txtBattleRound != null)
{
- txtBattleRound.text = string.Format("{0}/{1}", round, maxRound);
+ txtBattleRound.text = Language.Get("RoundText", round, maxRound);
}
}
+
+ protected virtual void PlayBackGroundMusic()
+ {
+ SoundPlayer.Instance.PlayBackGroundMusic(39);
+ }
+
}
\ No newline at end of file
--
Gitblit v1.8.0