编队系统重置 选角页面基本完成 等待存入playerprefs

This commit is contained in:
FloatGaming
2025-12-07 12:04:21 +08:00
parent 941b294fce
commit c0a822b958
134 changed files with 14796 additions and 198 deletions
+56 -1
View File
@@ -12,8 +12,17 @@ public class AllyHero_SO : ScriptableObject
public Sprite ally_heroImage;
[Header("英雄局内头像")]
public Sprite ally_heroProfile;
[Header("英雄选择界面头像")]
public Sprite ally_heroSelectIcon;
[Header("英雄轨道icon")]
public Sprite ally_heroIcon;
[Header("英雄编队界面海报")]
public Sprite ally_heroPoster;
[Header("英雄简介")]
[TextArea(3, 10)]
[Tooltip("英雄的详细简介信息")]
public string ally_heroDescription;
[Header("等级属性列表")]
public List<AllyLevelInfo> levelStats = new List<AllyLevelInfo>();
@@ -76,12 +85,58 @@ public class AllyHero_SO : ScriptableObject
[Tooltip("Primary selected skill index into availableSkills (-1 = none)")]
public int primarySkillIndex = -1;
// --- 技能组逻辑(已修复) ---
[Tooltip("Skill groups defined on this hero. Each SkillGroup has a numeric skillGroupID which can be equipped into slots to allow activation of the entire group via that ID.")]
public SkillGroup[] skillGroups = new SkillGroup[0];
[Tooltip("Equipped skill group IDs for this ally. Each int references a skillGroupID defined in skillGroups. Use 0 to indicate empty.")]
public int[] equippedSkillGroupIDs = new int[0];
// --- 技能方法 ---
public SkillDefinition GetPrimarySkill()
{
if (availableSkills == null || primarySkillIndex < 0 || primarySkillIndex >= availableSkills.Length) return null;
return availableSkills[primarySkillIndex];
}
// Adjusted: primary group is no longer stored as an index; prefer the first equipped group ID, otherwise fall back to the first non-null defined group.
public SkillGroup GetPrimarySkillGroup()
{
if (skillGroups == null || skillGroups.Length == 0) return null;
// If equipped group IDs exist, prefer the first valid referenced group
if (equippedSkillGroupIDs != null && equippedSkillGroupIDs.Length > 0)
{
foreach (var gid in equippedSkillGroupIDs)
{
if (gid == 0) continue;
var g = GetSkillGroupByID(gid);
if (g != null) return g;
}
}
// Fallback: return first non-null skill group defined on the SO
foreach (var g in skillGroups)
{
if (g != null) return g;
}
return null;
}
// New helper: find a SkillGroup by its numeric skillGroupID
public SkillGroup GetSkillGroupByID(int groupID)
{
if (skillGroups == null || skillGroups.Length == 0) return null;
foreach (var g in skillGroups)
{
if (g != null && g.skillGroupID == groupID) return g;
}
return null;
}
// Return the AllyLevelInfo that corresponds to the current ally_currentEXP.
// Picks the highest level whose requiredEXP <= ally_currentEXP. If none match, returns levelStats[0] if present, otherwise null.
public AllyLevelInfo GetEffectiveLevelForCurrentEXP()
@@ -104,4 +159,4 @@ public class AllyHero_SO : ScriptableObject
if (best == null) return levelStats[0];
return best;
}
}
}