UI update 02

This commit is contained in:
FloatGaming
2026-06-30 21:21:30 +08:00
parent b2a1e307a4
commit f62f643cfc
1666 changed files with 211081 additions and 22799 deletions
+101 -12
View File
@@ -32,6 +32,10 @@ public class AllyHero_SO : ScriptableObject
[Tooltip("Optional obsession tag used by memory skills such as 30011012. Leave empty to ignore mismatch checks.")]
public string obsessionTag;
[Header("DLC")]
[Tooltip("DLC key that owns this hero. Leave empty for base-game heroes that are always available. When set, the hero is only accessible when the matching DLC is owned.")]
public string sourceDlcId;
[Header("Inspector")]
public Sprite ally_heroImage;
[Header("Inspector")]
@@ -120,6 +124,8 @@ public class AllyHero_SO : ScriptableObject
[Header("Inspector")]
public int ally_currentEXP;
public int ally_growthUnlockedTierIndex;
[Tooltip("When enabled, level display/effective level resolution is clamped to the previous tier while this hero is breakthrough-locked, even if EXP has already reached the next tier threshold.")]
public bool level_lock;
public bool ally_autoBreakthroughEnabled;
public int ally_battleDeployCount;
public int ally_finishCount;
@@ -165,14 +171,6 @@ public class AllyHero_SO : ScriptableObject
}
}
if (skillGroups != null)
{
foreach (SkillGroup group in skillGroups)
{
if (group != null) return group;
}
}
return null;
}
@@ -365,11 +363,53 @@ public class AllyHero_SO : ScriptableObject
result.Add(groupId);
}
public int GetUnlockedLevelIndex()
{
List<AllyLevelInfo> sorted = BuildSortedLevelStats();
return ResolveUnlockedLevelIndex(sorted);
}
public int GetExpQualifiedLevelIndex()
{
List<AllyLevelInfo> sorted = BuildSortedLevelStats();
return ResolveExpQualifiedLevelIndex(sorted);
}
public int GetDisplayLevelIndex()
{
List<AllyLevelInfo> sorted = BuildSortedLevelStats();
return ResolveDisplayLevelIndex(sorted);
}
public string GetDisplayLevelRatingKey()
{
int displayIndex = GetDisplayLevelIndex();
if (displayIndex <= 0) return "C";
if (displayIndex == 1) return "B";
if (displayIndex == 2) return "A";
return "S";
}
public AllyLevelInfo GetEffectiveLevelForCurrentEXP()
{
if (levelStats == null || levelStats.Count == 0) return null;
List<AllyLevelInfo> sorted = BuildSortedLevelStats();
int unlockedIndex = ResolveUnlockedLevelIndex(sorted);
if (unlockedIndex < 0 || unlockedIndex >= sorted.Count)
{
return null;
}
return sorted[unlockedIndex];
}
private List<AllyLevelInfo> BuildSortedLevelStats()
{
var sorted = new List<AllyLevelInfo>();
if (levelStats == null || levelStats.Count == 0)
{
return sorted;
}
List<AllyLevelInfo> sorted = new List<AllyLevelInfo>();
for (int i = 0; i < levelStats.Count; i++)
{
if (levelStats[i] != null)
@@ -384,8 +424,57 @@ public class AllyHero_SO : ScriptableObject
}
sorted.Sort((left, right) => left.requiredEXP.CompareTo(right.requiredEXP));
int unlockedTierIndex = Mathf.Clamp(ally_growthUnlockedTierIndex, 0, sorted.Count - 1);
return sorted[unlockedTierIndex];
return sorted;
}
private int ResolveUnlockedLevelIndex(List<AllyLevelInfo> sorted)
{
if (sorted == null || sorted.Count == 0)
{
return -1;
}
return Mathf.Clamp(ally_growthUnlockedTierIndex, 0, sorted.Count - 1);
}
private int ResolveExpQualifiedLevelIndex(List<AllyLevelInfo> sorted)
{
if (sorted == null || sorted.Count == 0)
{
return -1;
}
int expQualifiedIndex = 0;
for (int i = 0; i < sorted.Count; i++)
{
if (ally_currentEXP >= sorted[i].requiredEXP)
{
expQualifiedIndex = i;
}
else
{
break;
}
}
return Mathf.Clamp(expQualifiedIndex, 0, sorted.Count - 1);
}
private int ResolveDisplayLevelIndex(List<AllyLevelInfo> sorted)
{
if (sorted == null || sorted.Count == 0)
{
return -1;
}
int expQualifiedIndex = ResolveExpQualifiedLevelIndex(sorted);
if (!level_lock)
{
return expQualifiedIndex;
}
int unlockedIndex = ResolveUnlockedLevelIndex(sorted);
return Mathf.Clamp(Mathf.Min(expQualifiedIndex, unlockedIndex), 0, sorted.Count - 1);
}
private AllyLevelInfo CloneLevelInfo(AllyLevelInfo source)
@@ -404,26 +404,7 @@ class AllyHeroGraphView : GraphView
private int GetCurrentLevelIndex(AllyHero_SO so)
{
if (so.levelStats == null || so.levelStats.Count == 0) return -1;
int bestIndex = -1;
int currentExp = so.ally_currentEXP;
for (int i = 0; i < so.levelStats.Count; i++)
{
var lvl = so.levelStats[i];
if (lvl == null) continue;
if (bestIndex < 0)
{
bestIndex = i;
if (currentExp < lvl.requiredEXP) continue;
}
var best = so.levelStats[bestIndex];
if (best == null) continue;
if (currentExp >= lvl.requiredEXP && lvl.requiredEXP >= best.requiredEXP)
{
bestIndex = i;
}
}
return bestIndex < 0 ? 0 : bestIndex;
return so != null ? so.GetDisplayLevelIndex() : -1;
}
private string FormatNumber(float value)
+1 -7
View File
@@ -337,12 +337,6 @@ public static class HeroSkinResolver
}
#endif
HeroSkinSO[] loaded = RuntimeResourcesCache.LoadAllHeroSkins();
if (loaded != null && loaded.Length > 0)
{
return loaded;
}
return Resources.LoadAll<HeroSkinSO>(string.Empty) ?? Array.Empty<HeroSkinSO>();
return RuntimeResourcesCache.LoadAllHeroSkins() ?? Array.Empty<HeroSkinSO>();
}
}