gameplay所有基本功能都装了,加入了全局警告。加入飘字等各种东西。

This commit is contained in:
FloatGaming
2026-02-21 00:20:03 +08:00
parent 9f7c1c57b7
commit 14fb281d6f
254 changed files with 102927 additions and 9427 deletions
+62 -4
View File
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@@ -32,9 +32,12 @@ public class AllyCombatant : MonoBehaviour, ICombatant
// --- Damage redirect (next hit) ---
private static AllyCombatant s_nextDamageRedirector;
private static float s_redirectExpireTime = -1f;
private static string s_redirectIconId;
private static int s_redirectIconSlotIndex = -1;
// --- Self damage redirect to adjacent (duration) ---
private float _selfDamageRedirectToAdjacentExpireTime = -1f;
private string _selfDamageRedirectToAdjacentIconId;
// add attack stat to be available at runtime
[Tooltip("Documentation text normalized.")]
@@ -76,6 +79,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
private Image manaImage;
private Image fadeManaImage;
private TextMeshProUGUI nameText;
public string allyName => nameText != null ? nameText.text : name;
private TextMeshProUGUI healthRateText;
private TextMeshProUGUI currentScoreText;
private Image hurtRedImage;
@@ -177,6 +181,21 @@ public class AllyCombatant : MonoBehaviour, ICombatant
}
}
}
if (Application.isPlaying)
{
if (s_redirectExpireTime > 0f && Time.time > s_redirectExpireTime) ClearRedirect();
if (_selfDamageRedirectToAdjacentExpireTime > 0f && Time.time > _selfDamageRedirectToAdjacentExpireTime)
{
_selfDamageRedirectToAdjacentExpireTime = -1f;
if (!string.IsNullOrEmpty(_selfDamageRedirectToAdjacentIconId))
{
iBudeffPrefabController.Instance?.UnregisterTimedEffect(slotIndex, _selfDamageRedirectToAdjacentIconId);
_selfDamageRedirectToAdjacentIconId = null;
}
}
}
}
private void Start()
@@ -196,6 +215,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
UpdateUIImmediate();
// Ensure score UI shows initial value
UpdateScoreUI();
iBudeffPrefabController.Instance?.RegisterBaseline(this);
// Evaluate HP-percent triggers on start after a short delay to ensure singletons are ready
if (Application.isPlaying)
@@ -224,6 +244,8 @@ public class AllyCombatant : MonoBehaviour, ICombatant
currentHP = Mathf.Max(1, maxHP);
UpdateUIImmediate();
}
iBudeffPrefabController.Instance?.RegisterBaseline(this);
// Final wait to ensure SkillBuilder's internal mapping is ready
while (SkillBuilder.Instance.GetAllyHeroSOBySlot(slotIndex) == null)
@@ -1071,6 +1093,14 @@ public class AllyCombatant : MonoBehaviour, ICombatant
if (old > 0 && currentHP <= 0)
{
TryTriggerSkillsOnEvent(SkillDefinition.SkillTrigger.OnSelfDefeated);
string dName = "Unknown";
if (nameText != null) dName = nameText.text;
else if (SkillBuilder.Instance != null)
{
var so = SkillBuilder.Instance.GetAllyHeroSOBySlot(slotIndex);
if (so != null) dName = so.ally_heroName;
}
SkillTriggerFeedUI.PushDeath(dName);
}
// Evaluate HP-percentage based trigger transitions (entry/exit)
@@ -1236,6 +1266,11 @@ public class AllyCombatant : MonoBehaviour, ICombatant
return mult;
}
public float GetHealReceivedMultiplierForUI()
{
return GetTotalHealReceivedMultiplier();
}
private void RecalculateAttackFromBuffs()
{
EnsureAttackBaseInitialized();
@@ -1460,7 +1495,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
// Apply reversible multipliers. attackMultiplier is applied via baseline+recalc to ensure it can be reverted.
if (buff.scoreMultiplier != 1f) scoreEfficiency *= buff.scoreMultiplier;
if (buff.attackMultiplier != 1f) RecalculateAttackFromBuffs();
// UI/visual could be added
iBudeffPrefabController.Instance?.NotifyBuffApplied(this, buff);
}
public void RemoveBuff(string buffId)
@@ -1471,6 +1506,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
activeBuffs.Remove(b);
if (b.scoreMultiplier != 1f) scoreEfficiency /= b.scoreMultiplier;
if (b.attackMultiplier != 1f) RecalculateAttackFromBuffs();
iBudeffPrefabController.Instance?.NotifyBuffRemoved(this, b);
}
}
@@ -2126,11 +2162,23 @@ public class AllyCombatant : MonoBehaviour, ICombatant
public static void ActivateNextDamageRedirect(AllyCombatant redirector, float duration = 0f)
{
if (redirector == null) return;
if (!string.IsNullOrEmpty(s_redirectIconId) && s_redirectIconSlotIndex >= 0)
{
iBudeffPrefabController.Instance?.UnregisterTimedEffect(s_redirectIconSlotIndex, s_redirectIconId);
s_redirectIconId = null;
s_redirectIconSlotIndex = -1;
}
s_nextDamageRedirector = redirector;
if (duration > 0f && Application.isPlaying)
s_redirectExpireTime = Time.time + duration;
else
s_redirectExpireTime = -1f;
if (Application.isPlaying)
{
s_redirectIconSlotIndex = redirector.slotIndex;
s_redirectIconId = iBudeffPrefabController.Instance?.RegisterTimedEffect(redirector, PlayerBudeffIconType.dmg_redirect_toSelf, 0f, duration);
}
}
private static bool IsRedirectActive()
@@ -2151,6 +2199,12 @@ public class AllyCombatant : MonoBehaviour, ICombatant
private static void ClearRedirect()
{
if (!string.IsNullOrEmpty(s_redirectIconId) && s_redirectIconSlotIndex >= 0)
{
iBudeffPrefabController.Instance?.UnregisterTimedEffect(s_redirectIconSlotIndex, s_redirectIconId);
s_redirectIconId = null;
s_redirectIconSlotIndex = -1;
}
s_nextDamageRedirector = null;
s_redirectExpireTime = -1f;
}
@@ -2160,6 +2214,12 @@ public class AllyCombatant : MonoBehaviour, ICombatant
if (!Application.isPlaying) return;
if (duration <= 0f) duration = 0.01f;
_selfDamageRedirectToAdjacentExpireTime = Time.time + duration;
if (!string.IsNullOrEmpty(_selfDamageRedirectToAdjacentIconId))
{
iBudeffPrefabController.Instance?.UnregisterTimedEffect(slotIndex, _selfDamageRedirectToAdjacentIconId);
_selfDamageRedirectToAdjacentIconId = null;
}
_selfDamageRedirectToAdjacentIconId = iBudeffPrefabController.Instance?.RegisterTimedEffect(this, PlayerBudeffIconType.dmg_redirect_toAdjacent, 0f, duration);
}
private bool IsSelfDamageRedirectToAdjacentActive()
@@ -2297,5 +2357,3 @@ public class AllyCombatant : MonoBehaviour, ICombatant