继续更新小问题,增加了启动编队前外部头像预览
This commit is contained in:
@@ -29,6 +29,9 @@ public class SkillGroup
|
||||
[Tooltip("A multiline description for this skill group. Use this to store notes or an overview that can be shown at runtime.")]
|
||||
public string skillDescriptionsText = "";
|
||||
|
||||
[Tooltip("This skill group requires the hero to reach at least this level (1-4) to be selectable.")]
|
||||
public int thisSkill_levelLimit = 1;
|
||||
|
||||
// Backwards-compatible accessor that previously returned a per-skill description.
|
||||
// Now returns the single group-level text so callers can still obtain a description string.
|
||||
public string GetSkillDescription(int index)
|
||||
|
||||
@@ -21,6 +21,8 @@ public class AllyHero_SO : ScriptableObject
|
||||
public Sprite ally_heroPoster;
|
||||
[Header("角色带通道立绘")]
|
||||
public Sprite ally_hero_HD_image;
|
||||
[Header("角色正方形头像")]
|
||||
public Sprite ally_hero_squareProfile;
|
||||
|
||||
[Header("主题色")]
|
||||
public Color ally_heroThemeColor;
|
||||
@@ -46,7 +48,7 @@ public class AllyHero_SO : ScriptableObject
|
||||
[Tooltip("最大生命值")]
|
||||
public int maxHP = 100;
|
||||
|
||||
[Tooltip("伤害抗性 (0..1), 用于减少所受伤害")]
|
||||
[Tooltip("伤害抗性 (0-1), 用于减少所受伤害")]
|
||||
public float damageResistance = 0f;
|
||||
|
||||
[Tooltip("最大法力值")]
|
||||
@@ -59,7 +61,10 @@ public class AllyHero_SO : ScriptableObject
|
||||
[Tooltip("升到本等级所需经验")]
|
||||
public int requiredEXP;
|
||||
|
||||
// --- 新增:每等级的共享音符击中参数(用于将来调整) ---
|
||||
[Header("本等级限制解锁技能槽位数量")]
|
||||
[Tooltip("本等级限制解锁技能槽位数量")]
|
||||
public int skill_slot_limited;
|
||||
|
||||
[Header("Note-hit shared parameters")]
|
||||
[Tooltip("Good 判定时获得的法力值(整数)")]
|
||||
public int manaGainGood = 1;
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class load_teammatesProfile : MonoBehaviour
|
||||
{
|
||||
[Header("½ÇɫͷÏñ")]
|
||||
public Image teammate_profile_01;
|
||||
public Image teammate_profile_02;
|
||||
public Image teammate_profile_03;
|
||||
public Image teammate_profile_04;
|
||||
public Image teammate_profile_05;
|
||||
|
||||
[Header("boarder")]
|
||||
public Image teammate_profile_boarder_01;
|
||||
public Image teammate_profile_boarder_02;
|
||||
public Image teammate_profile_boarder_03;
|
||||
public Image teammate_profile_boarder_04;
|
||||
public Image teammate_profile_boarder_05;
|
||||
|
||||
[Header("Level Colors")]
|
||||
public Color levelColor_C;
|
||||
public Color levelColor_B;
|
||||
public Color levelColor_A;
|
||||
public Color levelColor_S;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
update_teammates_profile();
|
||||
}
|
||||
|
||||
public void update_teammates_profile()
|
||||
{
|
||||
// Load selected hero IDs from PlayerPrefs
|
||||
int heroId1 = PlayerPrefs.GetInt("selected_heroSlot01_heroID", 0);
|
||||
int heroId2 = PlayerPrefs.GetInt("selected_heroSlot02_heroID", 0);
|
||||
int heroId3 = PlayerPrefs.GetInt("selected_heroSlot03_heroID", 0);
|
||||
int heroId4 = PlayerPrefs.GetInt("selected_heroSlot04_heroID", 0);
|
||||
int heroId5 = PlayerPrefs.GetInt("selected_heroSlot05_heroID", 0);
|
||||
|
||||
// Set sprites for each profile image
|
||||
teammate_profile_01.sprite = GetHeroSquareProfile(heroId1);
|
||||
teammate_profile_02.sprite = GetHeroSquareProfile(heroId2);
|
||||
teammate_profile_03.sprite = GetHeroSquareProfile(heroId3);
|
||||
teammate_profile_04.sprite = GetHeroSquareProfile(heroId4);
|
||||
teammate_profile_05.sprite = GetHeroSquareProfile(heroId5);
|
||||
|
||||
// Set border colors based on hero level
|
||||
teammate_profile_boarder_01.color = GetBorderColor(GetHeroLevel(heroId1));
|
||||
teammate_profile_boarder_02.color = GetBorderColor(GetHeroLevel(heroId2));
|
||||
teammate_profile_boarder_03.color = GetBorderColor(GetHeroLevel(heroId3));
|
||||
teammate_profile_boarder_04.color = GetBorderColor(GetHeroLevel(heroId4));
|
||||
teammate_profile_boarder_05.color = GetBorderColor(GetHeroLevel(heroId5));
|
||||
}
|
||||
|
||||
private Sprite GetHeroSquareProfile(int heroId)
|
||||
{
|
||||
if (heroId == 0) return null;
|
||||
|
||||
// Load all AllyHero_SO and find the one with matching ID
|
||||
var allHeroes = Resources.LoadAll<AllyHero_SO>("");
|
||||
foreach (var hero in allHeroes)
|
||||
{
|
||||
if (hero != null && hero.ally_heroID == heroId)
|
||||
{
|
||||
return hero.ally_hero_squareProfile;
|
||||
}
|
||||
}
|
||||
return null; // Not found
|
||||
}
|
||||
|
||||
private string GetHeroLevel(int heroId)
|
||||
{
|
||||
if (heroId == 0) return "C"; // default
|
||||
|
||||
var allHeroes = Resources.LoadAll<AllyHero_SO>("");
|
||||
AllyHero_SO hero = null;
|
||||
foreach (var h in allHeroes)
|
||||
{
|
||||
if (h != null && h.ally_heroID == heroId)
|
||||
{
|
||||
hero = h;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (hero == null) return "C";
|
||||
|
||||
return GetRatingFromSO(hero);
|
||||
}
|
||||
|
||||
private string GetRatingFromSO(AllyHero_SO so)
|
||||
{
|
||||
if (so == null || so.levelStats == null || so.levelStats.Count == 0) return "C";
|
||||
|
||||
// Build a sorted copy by requiredEXP ascending
|
||||
List<AllyHero_SO.AllyLevelInfo> sorted = new List<AllyHero_SO.AllyLevelInfo>();
|
||||
foreach (var l in so.levelStats) if (l != null) sorted.Add(l);
|
||||
sorted.Sort((a, b) => a.requiredEXP.CompareTo(b.requiredEXP));
|
||||
|
||||
int currentExp = so.ally_currentEXP;
|
||||
int selectedIndex = 0;
|
||||
for (int i = 0; i < sorted.Count; i++)
|
||||
{
|
||||
if (currentExp >= sorted[i].requiredEXP)
|
||||
{
|
||||
selectedIndex = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Map indices to ratings: index 0 -> C, 1 -> B, 2 -> A, 3+ -> S
|
||||
if (selectedIndex <= 0) return "C";
|
||||
if (selectedIndex == 1) return "B";
|
||||
if (selectedIndex == 2) return "A";
|
||||
return "S";
|
||||
}
|
||||
|
||||
private Color GetBorderColor(string level)
|
||||
{
|
||||
Color color;
|
||||
switch (level)
|
||||
{
|
||||
case "C": color = levelColor_C; break;
|
||||
case "B": color = levelColor_B; break;
|
||||
case "A": color = levelColor_A; break;
|
||||
case "S": color = levelColor_S; break;
|
||||
default: color = Color.white; break;
|
||||
}
|
||||
color.a = 1f;
|
||||
return color;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1764c09e2d730fd42b7a2d1f24161bfb
|
||||
Reference in New Issue
Block a user