UI update 02
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user