装备系统完结,修复并加入很多

This commit is contained in:
2026-04-03 19:15:02 +08:00
parent 538085b64f
commit d9376833b6
378 changed files with 62464 additions and 16756 deletions
+128
View File
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "NewEquipment", menuName = "Equipment/Equipment SO")]
@@ -101,6 +102,11 @@ public class equipmentSO : ScriptableObject
public int sa_skillID;
public int ia_skillID;
public bool HasFinalDreamEffect()
{
return maxLevelEffects != null && maxLevelEffects.Length > 0;
}
public int GetTierStageIndex()
{
if (level >= 20)
@@ -126,11 +132,63 @@ public class equipmentSO : ScriptableObject
return 0;
}
public int GetVisualTierStageIndex()
{
if (level >= 20 && !HasFinalDreamEffect())
{
return 3;
}
return GetTierStageIndex();
}
public int GetVisualQualityColorIndex()
{
return GetVisualTierStageIndex() + 1;
}
public EquipmentTierPresentation GetCurrentTierPresentation()
{
return GetTierPresentationByStageIndex(GetTierStageIndex());
}
public EquipmentTierPresentation GetVisualTierPresentation()
{
return GetTierPresentationByStageIndex(GetVisualTierStageIndex());
}
public EquipmentTierPresentation GetIdentityTierPresentation()
{
if (level >= 20)
{
return GetTierPresentationByStageIndex(3);
}
return GetTierPresentationByStageIndex(GetTierStageIndex());
}
public string GetDisplayTierName()
{
string baseName = GetIdentityTierPresentation() != null ? GetIdentityTierPresentation().tierName : string.Empty;
if (level >= 20 && HasFinalDreamEffect())
{
return string.IsNullOrWhiteSpace(baseName) ? "梦醒记忆" : $"梦醒·{baseName}";
}
string visualName = GetVisualTierPresentation() != null ? GetVisualTierPresentation().tierName : string.Empty;
return !string.IsNullOrWhiteSpace(visualName) ? visualName : baseName;
}
public string GetDisplayTierDescription()
{
if (level >= 20 && HasFinalDreamEffect())
{
return GetIdentityTierPresentation() != null ? GetIdentityTierPresentation().tierDescription : string.Empty;
}
return GetVisualTierPresentation() != null ? GetVisualTierPresentation().tierDescription : string.Empty;
}
public EquipmentTierPresentation GetTierPresentationByStageIndex(int stageIndex)
{
if (tierNameConfig == null)
@@ -163,13 +221,83 @@ public class equipmentSO : ScriptableObject
return current != null ? current.equipmentSprite : null;
}
public SkillGroup GetSpecialSkillGroup()
{
return EquipmentSkillGroupLibrary.ResolveSpecialSkillGroup(sa_skillID);
}
public SkillGroup GetIllusionSkillGroup()
{
return EquipmentSkillGroupLibrary.ResolveIllusionSkillGroup(ia_skillID);
}
public EquipmentSpecialEffect[] GetNormalizedIllusionEffects()
{
if (illusionEffects == null || illusionEffects.Length == 0)
{
return Array.Empty<EquipmentSpecialEffect>();
}
var normalized = new List<EquipmentSpecialEffect>();
var bestValues = new Dictionary<EquipmentSpecialEffectType, float>();
bool hasSkill = false;
for (int i = 0; i < illusionEffects.Length; i++)
{
EquipmentSpecialEffect effect = illusionEffects[i];
if (effect == null)
{
continue;
}
if (effect.effectType == EquipmentSpecialEffectType.Skill)
{
if (!hasSkill)
{
normalized.Add(new EquipmentSpecialEffect
{
effectType = EquipmentSpecialEffectType.Skill,
value = effect.value
});
hasSkill = true;
}
continue;
}
if (!bestValues.TryGetValue(effect.effectType, out float currentBest) || effect.value > currentBest)
{
bestValues[effect.effectType] = effect.value;
}
}
foreach (KeyValuePair<EquipmentSpecialEffectType, float> pair in bestValues)
{
normalized.Add(new EquipmentSpecialEffect
{
effectType = pair.Key,
value = pair.Value
});
}
return normalized.ToArray();
}
public void NormalizeIllusionEffectsInPlace()
{
illusionEffects = GetNormalizedIllusionEffects();
}
private void OnValidate()
{
level = Mathf.Max(0, level);
sa_skillID = Mathf.Max(0, sa_skillID);
ia_skillID = Mathf.Max(0, ia_skillID);
maxHp?.Normalize();
attack?.Normalize();
maxMana?.Normalize();
damageResistance?.Normalize();
scoreEfficiency?.Normalize();
NormalizeIllusionEffectsInPlace();
}
}