客户端rsa,冗余清理,bug修复,安卓build问题

This commit is contained in:
2026-07-14 01:43:49 +08:00
parent fd22501f71
commit f8985d91d2
682 changed files with 4595 additions and 11216 deletions
+24 -22
View File
@@ -15,6 +15,8 @@ using TMPro;
/// </summary>
public class AllyCombatant : MonoBehaviour, ICombatant
{
private static float GameplayNow => Application.isPlaying ? GameplayClock.NowSongTime : Time.realtimeSinceStartup;
private static AllyHero_SO[] cachedAllAllyHeroes;
public int slotIndex = 0; // Documentation text normalized.
@@ -209,7 +211,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
if (Application.isPlaying && skillIconAutoFadeTime > 0f && lastSkillIconPushTime > 0f)
{
// Only start coroutine if not already running and time exceeded
if (skillIconAutoFadeCoroutine == null && Time.time - lastSkillIconPushTime >= skillIconAutoFadeTime)
if (skillIconAutoFadeCoroutine == null && GameplayNow - lastSkillIconPushTime >= skillIconAutoFadeTime)
{
// Double check visibility
bool anyVisible = false;
@@ -238,23 +240,23 @@ public class AllyCombatant : MonoBehaviour, ICombatant
TryCastOnFullMana();
}
if (_selfDamageRedirectToAdjacentExpireTime > 0f && Time.time > _selfDamageRedirectToAdjacentExpireTime)
if (_selfDamageRedirectToAdjacentExpireTime > 0f && GameplayNow > _selfDamageRedirectToAdjacentExpireTime)
{
ConsumeSelfDamageRedirectToAdjacent();
}
if (_rewriteNonMissToPerfectExpireTime > 0f && Time.time > _rewriteNonMissToPerfectExpireTime)
if (_rewriteNonMissToPerfectExpireTime > 0f && GameplayNow > _rewriteNonMissToPerfectExpireTime)
{
ClearNonMissToPerfectRewrite();
}
else if (_rewriteNonMissToPerfectExpireTime > 0f &&
Time.time <= _rewriteNonMissToPerfectExpireTime &&
GameplayNow <= _rewriteNonMissToPerfectExpireTime &&
string.IsNullOrEmpty(_rewriteNonMissToPerfectIconId) &&
iBudeffPrefabController.Instance != null)
{
// Fallback: if icon registration failed earlier (e.g. controller initialized later),
// retry during active window.
float remain = Mathf.Max(0.01f, _rewriteNonMissToPerfectExpireTime - Time.time);
float remain = Mathf.Max(0.01f, _rewriteNonMissToPerfectExpireTime - GameplayNow);
_rewriteNonMissToPerfectIconId = iBudeffPrefabController.Instance.RegisterTimedEffect(this, PlayerBudeffIconType.ot_luckyChance, 1f, remain);
iBudeffPrefabController.Instance.RefreshAllyNow(this);
}
@@ -728,7 +730,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
if (skillIconSlots == null || skillIconSlots.Length == 0) return;
// Reset auto-fade logic
lastSkillIconPushTime = Time.time;
lastSkillIconPushTime = GameplayNow;
if (skillIconAutoFadeCoroutine != null)
{
StopCoroutine(skillIconAutoFadeCoroutine);
@@ -837,7 +839,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
skillIconOccupied[i] = false;
// Wait small interval between fades
yield return new WaitForSeconds(0.15f);
yield return GameplayClock.WaitForSeconds(0.15f);
}
}
@@ -1887,7 +1889,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
}
activeBuffs.Add(buff);
_buffAppliedTimes[buff.buffId] = Application.isPlaying ? Time.time : Time.realtimeSinceStartup;
_buffAppliedTimes[buff.buffId] = GameplayNow;
// 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();
@@ -2539,7 +2541,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
float expireTime = -1f;
if (duration > 0f && Application.isPlaying)
{
expireTime = Time.time + duration;
expireTime = GameplayNow + duration;
}
NextDamageRedirectState state = null;
@@ -2577,7 +2579,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
bool remove = redirector == null;
if (!remove && (redirector.IsDead || !redirector.gameObject.activeInHierarchy))
remove = true;
if (!remove && Application.isPlaying && state.expireTime > 0f && Time.time > state.expireTime)
if (!remove && Application.isPlaying && state.expireTime > 0f && GameplayNow > state.expireTime)
remove = true;
if (!remove) continue;
@@ -2703,12 +2705,12 @@ public class AllyCombatant : MonoBehaviour, ICombatant
if (string.IsNullOrWhiteSpace(buff.buffId))
{
buff.buffId = Guid.NewGuid().ToString();
_buffAppliedTimes[buff.buffId] = Application.isPlaying ? Time.time : Time.realtimeSinceStartup;
_buffAppliedTimes[buff.buffId] = GameplayNow;
}
float t = 0f;
if (!_buffAppliedTimes.TryGetValue(buff.buffId, out t))
{
t = Application.isPlaying ? Time.time : Time.realtimeSinceStartup;
t = GameplayNow;
_buffAppliedTimes[buff.buffId] = t;
}
if (latest == null || t > latestTime)
@@ -2747,7 +2749,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
{
if (!_buffAppliedTimes.TryGetValue(objectBuff.buffId, out objectBuffTime))
{
objectBuffTime = Application.isPlaying ? Time.time : Time.realtimeSinceStartup;
objectBuffTime = GameplayNow;
_buffAppliedTimes[objectBuff.buffId] = objectBuffTime;
}
}
@@ -2958,7 +2960,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
// Compensate at expiry: source +delta, target -delta, to keep net transfer behavior correct.
if (duration > 0f)
{
float remaining = Mathf.Max(0.01f, (startTime + duration) - Time.time);
float remaining = Mathf.Max(0.01f, (startTime + duration) - GameplayNow);
StartCoroutine(CompensateTransferredTimedBudeffAtExpiry(actualTarget, iconType, value, remaining));
}
return true;
@@ -2966,7 +2968,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
private IEnumerator CompensateTransferredTimedBudeffAtExpiry(AllyCombatant target, PlayerBudeffIconType iconType, float value, float waitSeconds)
{
yield return new WaitForSeconds(Mathf.Max(0.01f, waitSeconds));
yield return GameplayClock.WaitForSeconds(Mathf.Max(0.01f, waitSeconds));
if (target == null) yield break;
if (this == null) yield break;
@@ -3086,7 +3088,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
if (target.IsDead || !target.gameObject.activeInHierarchy) return;
if (!IsSelfDamageRedirectToAdjacentActive()) return;
float remain = Mathf.Max(0.01f, _selfDamageRedirectToAdjacentExpireTime - Time.time);
float remain = Mathf.Max(0.01f, _selfDamageRedirectToAdjacentExpireTime - GameplayNow);
string iconId = _selfDamageRedirectToAdjacentIconId;
// Clear source state without touching icon (icon already moved by budeff controller transfer).
@@ -3096,7 +3098,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
// Keep only one self-redirect state on target.
target.ConsumeSelfDamageRedirectToAdjacent();
target._selfDamageRedirectToAdjacentExpireTime = Time.time + remain;
target._selfDamageRedirectToAdjacentExpireTime = GameplayNow + remain;
target._selfDamageRedirectToAdjacentIconId = iconId;
}
@@ -3222,7 +3224,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
{
if (!Application.isPlaying) return;
if (duration <= 0f) duration = 0.01f;
_selfDamageRedirectToAdjacentExpireTime = Time.time + duration;
_selfDamageRedirectToAdjacentExpireTime = GameplayNow + duration;
if (!string.IsNullOrEmpty(_selfDamageRedirectToAdjacentIconId))
{
iBudeffPrefabController.Instance?.UnregisterTimedEffect(slotIndex, _selfDamageRedirectToAdjacentIconId);
@@ -3236,7 +3238,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
if (!Application.isPlaying) return;
if (duration <= 0f) duration = 0.01f;
_rewriteNonMissToPerfectExpireTime = Time.time + duration;
_rewriteNonMissToPerfectExpireTime = GameplayNow + duration;
if (!string.IsNullOrEmpty(_rewriteNonMissToPerfectIconId))
{
@@ -3252,7 +3254,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
{
if (!Application.isPlaying) return false;
if (_rewriteNonMissToPerfectExpireTime <= 0f) return false;
if (Time.time > _rewriteNonMissToPerfectExpireTime)
if (GameplayNow > _rewriteNonMissToPerfectExpireTime)
{
ClearNonMissToPerfectRewrite();
return false;
@@ -3280,7 +3282,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
{
if (!Application.isPlaying) return false;
if (IsDead) return false;
return _rewriteNonMissToPerfectExpireTime > 0f && Time.time <= _rewriteNonMissToPerfectExpireTime;
return _rewriteNonMissToPerfectExpireTime > 0f && GameplayNow <= _rewriteNonMissToPerfectExpireTime;
}
private bool IsSelfDamageRedirectToAdjacentActive()
@@ -3292,7 +3294,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
ConsumeSelfDamageRedirectToAdjacent();
return false;
}
if (Time.time > _selfDamageRedirectToAdjacentExpireTime)
if (GameplayNow > _selfDamageRedirectToAdjacentExpireTime)
{
ConsumeSelfDamageRedirectToAdjacent();
return false;
+14 -14
View File
@@ -1191,7 +1191,7 @@ public class EffectSystem : MonoBehaviour
comp.ReceiveDamage(perTick, source, false);
// No need to call TriggerQueuedPopups manually as deferPopup is false
yield return new WaitForSeconds(tickInterval);
yield return GameplayClock.WaitForSeconds(tickInterval);
elapsed += tickInterval;
}
}
@@ -1239,7 +1239,7 @@ public class EffectSystem : MonoBehaviour
comp.ReceiveHeal(perTick, source, false);
// No need to call TriggerQueuedPopups manually as deferPopup is false
yield return new WaitForSeconds(tickInterval);
yield return GameplayClock.WaitForSeconds(tickInterval);
elapsed += tickInterval;
}
}
@@ -1305,7 +1305,7 @@ public class EffectSystem : MonoBehaviour
{
ally.ModifyMana(Mathf.CeilToInt(perTick), true, true);
}
yield return new WaitForSeconds(tickInterval);
yield return GameplayClock.WaitForSeconds(tickInterval);
elapsed += tickInterval;
}
}
@@ -1321,7 +1321,7 @@ public class EffectSystem : MonoBehaviour
}
comp.ApplyBuff(buff, source);
yield return new WaitForSeconds(buff.duration);
yield return GameplayClock.WaitForSeconds(buff.duration);
comp.RemoveBuff(buff.buffId);
}
@@ -1337,7 +1337,7 @@ public class EffectSystem : MonoBehaviour
}
comp.ApplyBuff(debuff, source);
yield return new WaitForSeconds(debuff.duration);
yield return GameplayClock.WaitForSeconds(debuff.duration);
comp.RemoveBuff(debuff.buffId);
}
@@ -1348,7 +1348,7 @@ public class EffectSystem : MonoBehaviour
{
if (ally == null) yield break;
ally.scoreEfficiency = Mathf.Max(0f, ally.scoreEfficiency + delta);
yield return new WaitForSeconds(duration);
yield return GameplayClock.WaitForSeconds(duration);
if (ally == null) yield break;
ally.scoreEfficiency = Mathf.Max(0f, ally.scoreEfficiency - delta);
}
@@ -1369,7 +1369,7 @@ public class EffectSystem : MonoBehaviour
if (ally != null)
{
ally.damageResistance = ClampDamageResistance(ally.damageResistance + delta);
yield return new WaitForSeconds(duration);
yield return GameplayClock.WaitForSeconds(duration);
if (ally == null) yield break;
ally.damageResistance = ClampDamageResistance(ally.damageResistance - delta);
yield break;
@@ -1380,7 +1380,7 @@ public class EffectSystem : MonoBehaviour
{
enemy.damageResistance = ClampDamageResistance(enemy.damageResistance + delta);
iBudeffPrefabController.Instance?.RefreshEnemyNow(enemy);
yield return new WaitForSeconds(duration);
yield return GameplayClock.WaitForSeconds(duration);
if (enemy == null) yield break;
enemy.damageResistance = ClampDamageResistance(enemy.damageResistance - delta);
yield break;
@@ -1403,7 +1403,7 @@ public class EffectSystem : MonoBehaviour
{
if (ally == null) yield break;
ally.ModifyAttack(delta);
yield return new WaitForSeconds(duration);
yield return GameplayClock.WaitForSeconds(duration);
if (ally == null) yield break;
ally.ModifyAttack(-delta);
}
@@ -1427,7 +1427,7 @@ public class EffectSystem : MonoBehaviour
if (enemy == null) yield break;
enemy.ModifyAttack(delta);
iBudeffPrefabController.Instance?.RefreshEnemyNow(enemy);
yield return new WaitForSeconds(duration);
yield return GameplayClock.WaitForSeconds(duration);
if (enemy == null) yield break;
enemy.ModifyAttack(-delta);
}
@@ -1445,7 +1445,7 @@ public class EffectSystem : MonoBehaviour
if (ally == null) yield break;
ally.SetMaxHP(Mathf.Max(1, ally.maxHP + delta), false);
if (delta > 0) ally.SetCurrentHP(ally.currentHP + delta, false);
yield return new WaitForSeconds(duration);
yield return GameplayClock.WaitForSeconds(duration);
if (ally == null) yield break;
ally.SetMaxHP(Mathf.Max(1, ally.maxHP - delta), false);
}
@@ -1464,7 +1464,7 @@ public class EffectSystem : MonoBehaviour
enemy.SetMaxHP(Mathf.Max(1, enemy.maxHP + delta), false);
if (delta > 0) enemy.ModifyHP(delta);
iBudeffPrefabController.Instance?.RefreshEnemyNow(enemy);
yield return new WaitForSeconds(duration);
yield return GameplayClock.WaitForSeconds(duration);
if (enemy == null) yield break;
enemy.SetMaxHP(Mathf.Max(1, enemy.maxHP - delta), false);
}
@@ -1481,7 +1481,7 @@ public class EffectSystem : MonoBehaviour
{
if (ally == null) yield break;
ally.SetMaxMana(Mathf.Max(1, ally.maxMana + delta), false);
yield return new WaitForSeconds(duration);
yield return GameplayClock.WaitForSeconds(duration);
if (ally == null) yield break;
ally.SetMaxMana(Mathf.Max(1, ally.maxMana - delta), false);
}
@@ -1499,7 +1499,7 @@ public class EffectSystem : MonoBehaviour
if (enemy == null) yield break;
enemy.SetMaxMana(Mathf.Max(1, enemy.maxMana + delta), false);
iBudeffPrefabController.Instance?.RefreshEnemyNow(enemy);
yield return new WaitForSeconds(duration);
yield return GameplayClock.WaitForSeconds(duration);
if (enemy == null) yield break;
enemy.SetMaxMana(Mathf.Max(1, enemy.maxMana - delta), false);
}
+17 -17
View File
@@ -604,7 +604,7 @@ public class SkillBuilder : MonoBehaviour
else Debug.LogWarning($"ApplyBuffToTargets: target {t.name} has no ICombatant");
}
if (buff.duration > 0f)
yield return new WaitForSeconds(buff.duration);
yield return GameplayClock.WaitForSeconds(buff.duration);
else
yield break;
@@ -1010,7 +1010,7 @@ public class SkillBuilder : MonoBehaviour
private IEnumerator RemoveRefreshOnlyTimedEffectAfterDuration(string key, GameObject target, float duration)
{
yield return new WaitForSeconds(duration);
yield return GameplayClock.WaitForSeconds(duration);
if (_refreshOnlyTimedEffectStates.TryGetValue(key, out var state))
{
@@ -1212,7 +1212,7 @@ public class SkillBuilder : MonoBehaviour
if (target == null) break;
if (!ApplyRefreshOnlyOverTimeTick(def.effectType, target, perTick, source)) break;
yield return new WaitForSeconds(tickInterval);
yield return GameplayClock.WaitForSeconds(tickInterval);
elapsed += tickInterval;
}
@@ -1544,7 +1544,7 @@ ResolvedGroup:
{
string sid = !string.IsNullOrWhiteSpace(def.skillId) ? def.skillId : def.name;
string repeatKey = $"{slotIndex}:{sid}";
float now = Time.time;
float now = GameplayClock.NowSongTime;
if (_lastSkillTriggerTime.TryGetValue(repeatKey, out float last) && (now - last) <= def.repeatWindowSeconds)
{
amountTotal = def.repeatValue;
@@ -2406,7 +2406,7 @@ ResolvedGroup:
}
ally.AddScoreDirect(Mathf.Max(0, state.scorePerSecond));
yield return new WaitForSeconds(1f);
yield return GameplayClock.WaitForSeconds(1f);
}
}
@@ -2650,7 +2650,7 @@ ResolvedGroup:
{
iBudeffPrefabController.Instance?.RegisterTimedEffect(ally, PlayerBudeffIconType.ot_scoreEfficiency_down, -ally.scoreEfficiency, duration);
}
yield return new WaitForSeconds(duration);
yield return GameplayClock.WaitForSeconds(duration);
if (ally != null && !ally.IsDead && _equipTalentScoutDisagreeRestoreScoreBySlot.TryGetValue(slotIndex, out float restore))
{
ally.scoreEfficiency = Mathf.Max(0f, restore);
@@ -2760,7 +2760,7 @@ ResolvedGroup:
private IEnumerator NewIdeaExpireCoroutine(int slotIndex, float duration)
{
yield return new WaitForSeconds(duration);
yield return GameplayClock.WaitForSeconds(duration);
if (_equipNewIdeaStacksBySlot.TryGetValue(slotIndex, out int stacks))
{
_equipNewIdeaStacksBySlot[slotIndex] = Mathf.Max(0, stacks - 1);
@@ -3372,7 +3372,7 @@ ResolvedGroup:
{
LogVerbose($"[SkillBuilder] NotifyNoteHit RECEIVED: track={trackIndex} judge={judgeResult} noteType={noteType} uniqueId={uniqueNoteId}");
// cleanup old processed ids (> 10s)
float nowCleanup = Time.time;
float nowCleanup = GameplayClock.NowSongTime;
_tmpNoteIdRemoval.Clear();
var toRemove = _tmpNoteIdRemoval;
foreach (var kv in _processedNoteHitTimestamps)
@@ -3391,7 +3391,7 @@ ResolvedGroup:
}
else
{
_processedNoteHitTimestamps[uniqueNoteId] = Time.time;
_processedNoteHitTimestamps[uniqueNoteId] = nowCleanup;
}
}
@@ -3491,7 +3491,7 @@ ResolvedGroup:
// cooldown per slot+skill
string key = $"{trackIndex}:{def.skillId}";
float now = Time.time;
float now = GameplayClock.NowSongTime;
if (def.onNoteHitCooldown > 0f)
{
if (_lastOnNoteHitTriggerTime.TryGetValue(key, out float last))
@@ -3544,7 +3544,7 @@ ResolvedGroup:
while (elapsed < duration)
{
ally.ModifyMana(Mathf.CeilToInt(perTick), true, true);
yield return new WaitForSeconds(tickInterval);
yield return GameplayClock.WaitForSeconds(tickInterval);
elapsed += tickInterval;
}
}
@@ -3552,7 +3552,7 @@ ResolvedGroup:
private IEnumerator RemoveBuffAfterDuration(GameObject target, string buffId, float duration)
{
if (duration <= 0f) yield break;
yield return new WaitForSeconds(duration);
yield return GameplayClock.WaitForSeconds(duration);
if (target == null) yield break;
var ic = target.GetComponent<ICombatant>();
ic?.RemoveBuff(buffId);
@@ -3564,7 +3564,7 @@ ResolvedGroup:
{
if (ally == null) yield break;
ally.scoreEfficiency = Mathf.Max(0f, ally.scoreEfficiency + delta);
yield return new WaitForSeconds(duration);
yield return GameplayClock.WaitForSeconds(duration);
if (ally == null) yield break;
ally.scoreEfficiency = Mathf.Max(0f, ally.scoreEfficiency - delta);
}
@@ -3581,7 +3581,7 @@ ResolvedGroup:
{
if (ally == null) yield break;
ally.ModifyAttack(delta);
yield return new WaitForSeconds(duration);
yield return GameplayClock.WaitForSeconds(duration);
if (ally == null) yield break;
ally.ModifyAttack(-delta);
}
@@ -3599,7 +3599,7 @@ ResolvedGroup:
if (enemy == null) yield break;
enemy.ModifyAttack(delta);
iBudeffPrefabController.Instance?.RefreshEnemyNow(enemy);
yield return new WaitForSeconds(duration);
yield return GameplayClock.WaitForSeconds(duration);
if (enemy == null) yield break;
enemy.ModifyAttack(-delta);
}
@@ -3674,7 +3674,7 @@ ResolvedGroup:
if (ally != null) ally.ModifyHP(-Mathf.CeilToInt(perTick), true);
else ic?.ReceiveDamage(perTick, source);
yield return new WaitForSeconds(tickInterval);
yield return GameplayClock.WaitForSeconds(tickInterval);
elapsed += tickInterval;
}
}
@@ -3713,7 +3713,7 @@ ResolvedGroup:
{
if (ally != null) ally.ReceiveHeal(perTick, source);
else ic?.ReceiveHeal(perTick, source);
yield return new WaitForSeconds(tickInterval);
yield return GameplayClock.WaitForSeconds(tickInterval);
elapsed += tickInterval;
}
}