优化ui,谱面替换,以及科研模糊
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -99,11 +99,11 @@ public class load_teammatesProfile : MonoBehaviour
|
||||
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));
|
||||
teammate_profile_boarder_01.color = GetBorderColor(GetHeroLevel(heroId1, 1));
|
||||
teammate_profile_boarder_02.color = GetBorderColor(GetHeroLevel(heroId2, 2));
|
||||
teammate_profile_boarder_03.color = GetBorderColor(GetHeroLevel(heroId3, 3));
|
||||
teammate_profile_boarder_04.color = GetBorderColor(GetHeroLevel(heroId4, 4));
|
||||
teammate_profile_boarder_05.color = GetBorderColor(GetHeroLevel(heroId5, 5));
|
||||
}
|
||||
|
||||
private Sprite GetHeroSquareProfile(int heroId)
|
||||
@@ -117,25 +117,27 @@ public class load_teammatesProfile : MonoBehaviour
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetHeroLevel(int heroId)
|
||||
private string GetHeroLevel(int heroId, int slotIndex)
|
||||
{
|
||||
if (heroId == 0) return "C";
|
||||
if (heroById == null) return "C";
|
||||
AllyHero_SO hero;
|
||||
if (!heroById.TryGetValue(heroId, out hero) || hero == null) return "C";
|
||||
return GetRatingFromSO(hero);
|
||||
int exp = hero.ally_currentEXP;
|
||||
int keySlot = Mathf.Clamp(slotIndex, 1, 5);
|
||||
string expKey = $"selected_heroSlot0{keySlot}_exp";
|
||||
if (PlayerPrefs.HasKey(expKey))
|
||||
exp = PlayerPrefs.GetInt(expKey, exp);
|
||||
return GetRatingFromSO(hero, exp);
|
||||
}
|
||||
|
||||
private string GetRatingFromSO(AllyHero_SO so)
|
||||
private string GetRatingFromSO(AllyHero_SO so, int currentExp)
|
||||
{
|
||||
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++)
|
||||
{
|
||||
@@ -149,7 +151,6 @@ public class load_teammatesProfile : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
// 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";
|
||||
|
||||
Reference in New Issue
Block a user