优化ui,谱面替换,以及科研模糊
This commit is contained in:
@@ -303,6 +303,7 @@ public class EffectSystem : MonoBehaviour
|
||||
if (duration <= 0f)
|
||||
{
|
||||
ally.SetMaxHP(ally.maxHP + delta, false);
|
||||
if (delta > 0) ally.SetCurrentHP(ally.currentHP + delta, false);
|
||||
iBudeffPrefabController.Instance?.RegisterTimedEffect(ally, PlayerBudeffIconType.ot_maxHP_up, delta, 0f);
|
||||
}
|
||||
else
|
||||
@@ -317,6 +318,8 @@ public class EffectSystem : MonoBehaviour
|
||||
if (duration <= 0f)
|
||||
{
|
||||
enemy.SetMaxHP(enemy.maxHP + delta, false);
|
||||
if (delta > 0) enemy.currentHP = Mathf.Clamp(enemy.currentHP + delta, 0, enemy.maxHP);
|
||||
iBudeffPrefabController.Instance?.RefreshEnemyNow(enemy);
|
||||
iBudeffPrefabController.Instance?.RegisterEnemyTimedEffect(enemy, PlayerBudeffIconType.ot_maxHP_up, delta, 0f);
|
||||
}
|
||||
else
|
||||
@@ -1486,6 +1489,7 @@ public class EffectSystem : MonoBehaviour
|
||||
{
|
||||
if (ally == null) yield break;
|
||||
ally.SetMaxHP(Mathf.Max(1, ally.maxHP + delta), false);
|
||||
if (delta > 0) ally.SetCurrentHP(ally.currentHP + delta, false);
|
||||
yield return new WaitForSeconds(duration);
|
||||
if (ally == null) yield break;
|
||||
ally.SetMaxHP(Mathf.Max(1, ally.maxHP - delta), false);
|
||||
@@ -1503,6 +1507,7 @@ public class EffectSystem : MonoBehaviour
|
||||
{
|
||||
if (enemy == null) yield break;
|
||||
enemy.SetMaxHP(Mathf.Max(1, enemy.maxHP + delta), false);
|
||||
if (delta > 0) enemy.currentHP = Mathf.Clamp(enemy.currentHP + delta, 0, enemy.maxHP);
|
||||
iBudeffPrefabController.Instance?.RefreshEnemyNow(enemy);
|
||||
yield return new WaitForSeconds(duration);
|
||||
if (enemy == null) yield break;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -909,8 +909,16 @@ public class SkillBuilder : MonoBehaviour
|
||||
int hpDelta = Mathf.CeilToInt(Mathf.Abs(amount));
|
||||
if (effectType == EffectType.DecreaseMaxHP) hpDelta = -hpDelta;
|
||||
int oldHP = ally != null ? ally.maxHP : enemy.maxHP;
|
||||
if (ally != null) ally.SetMaxHP(Mathf.Max(1, ally.maxHP + hpDelta), false);
|
||||
else enemy.SetMaxHP(Mathf.Max(1, enemy.maxHP + hpDelta), false);
|
||||
if (ally != null)
|
||||
{
|
||||
ally.SetMaxHP(Mathf.Max(1, ally.maxHP + hpDelta), false);
|
||||
if (hpDelta > 0) ally.SetCurrentHP(ally.currentHP + hpDelta, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
enemy.SetMaxHP(Mathf.Max(1, enemy.maxHP + hpDelta), false);
|
||||
if (hpDelta > 0) enemy.currentHP = Mathf.Clamp(enemy.currentHP + hpDelta, 0, enemy.maxHP);
|
||||
}
|
||||
int newHP = ally != null ? ally.maxHP : enemy.maxHP;
|
||||
CheckLimitAndWarnInt(targetName, "最大生命值", oldHP, newHP, hpDelta);
|
||||
state = new RefreshOnlyTimedState { effectType = effectType, intDelta = hpDelta };
|
||||
@@ -1485,12 +1493,14 @@ ResolvedGroup:
|
||||
{
|
||||
int d = Mathf.CeilToInt(amountTotal);
|
||||
ally.SetMaxHP(ally.maxHP + d, false);
|
||||
if (d > 0) ally.SetCurrentHP(ally.currentHP + d, false);
|
||||
iBudeffPrefabController.Instance?.RegisterTimedEffect(ally, PlayerBudeffIconType.ot_maxHP_up, d, 0f);
|
||||
}
|
||||
else if (t.TryGetComponent<EnemyCombatant>(out var enemy))
|
||||
{
|
||||
int d = Mathf.CeilToInt(amountTotal);
|
||||
enemy.SetMaxHP(enemy.maxHP + d, false);
|
||||
if (d > 0) enemy.currentHP = Mathf.Clamp(enemy.currentHP + d, 0, enemy.maxHP);
|
||||
iBudeffPrefabController.Instance?.RegisterEnemyTimedEffect(enemy, PlayerBudeffIconType.ot_maxHP_up, d, 0f);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -329,10 +329,10 @@ public class UI_SongsSelect_RuntimeFeatures : MonoBehaviour
|
||||
|
||||
int difficulty = Mathf.Clamp(song.thisLevel_selectedDifficultyID, 0, 3);
|
||||
TextAsset chart = song.GetChartFile(difficulty);
|
||||
if (chart == null)
|
||||
if (chart == null || string.IsNullOrEmpty(chart.text))
|
||||
{
|
||||
gNotice.error.display("未找到此难度的关卡");
|
||||
Debug.LogError($"[Songs_Select] Enter gameplay cancelled: chart missing for '{song.songName}' difficulty {difficulty}.");
|
||||
gNotice.error.display("本歌曲本难度未找到");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,14 +109,14 @@ class UI_Panel_Character : MonoBehaviour
|
||||
{ Image_Character_Illustration.rectTransform.anchoredPosition = new Vector2(value, pos1.y); },
|
||||
startValue: Image_Character_Illustration.rectTransform.anchoredPosition.x - 200,
|
||||
pos1.x, anim_Time);
|
||||
Image_Character_Illustration.SetNativeSize();
|
||||
// Image_Character_Illustration.SetNativeSize(); // 注释掉以保持自适应而不改变大小
|
||||
var pos = Image_Character_Illustration_BG.rectTransform.anchoredPosition;
|
||||
Image_Character_Illustration_BG.sprite = data.ally_hero_HD_image;
|
||||
DOTween.To(value =>
|
||||
{ Image_Character_Illustration_BG.rectTransform.anchoredPosition = new Vector2(value, pos.y); },
|
||||
startValue: Image_Character_Illustration_BG.rectTransform.anchoredPosition.x - 200,
|
||||
pos.x, anim_Time);
|
||||
Image_Character_Illustration_BG.SetNativeSize();
|
||||
// Image_Character_Illustration_BG.SetNativeSize(); // 注释掉以保持自适应而不改变大小
|
||||
Image_Character_Illustration_BG.transform.localScale = new(2.7f, 2.7f, 2.7f);
|
||||
|
||||
|
||||
|
||||
@@ -705,7 +705,7 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
c_Character_Illustration_Anim = StartCoroutine(C_Character_Illustration_Anim(canvasGroup, () =>
|
||||
{
|
||||
image_Character.sprite = sprite;
|
||||
image_Character.SetNativeSize();
|
||||
// image_Character.SetNativeSize(); // 注释掉 SetNativeSize 以防改变目标图片大小
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ public class BeatmapManager : MonoBehaviour
|
||||
public Text gameplay_songname;
|
||||
public TextMeshProUGUI gameplay_difficultyID;
|
||||
public TextMeshProUGUI gameplay_difficultyName;
|
||||
public Text modeText;
|
||||
|
||||
public Image bgMainImage; // 场景主背景图 (UI Image)
|
||||
public Image startCanvas_image;
|
||||
@@ -477,6 +478,11 @@ public class BeatmapManager : MonoBehaviour
|
||||
}
|
||||
gameplay_difficultyName.text = diffText;
|
||||
}
|
||||
|
||||
if (modeText != null)
|
||||
{
|
||||
modeText.text = GameConfig.autoPlayEnabled ? "AUTOPLAYING" : string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
// Documentation text normalized.
|
||||
|
||||
@@ -304,7 +304,7 @@ public class settlementController : MonoBehaviour
|
||||
{
|
||||
int pm = sm != null ? sm.allSum_pmScore : 0;
|
||||
int idol = sm != null ? sm.allSum_idolScore : 0;
|
||||
thisSong_so.ApplySettlementResult(diff, pm, idol, maxScore_sum);
|
||||
thisSong_so.ApplySettlementResult(diff, pm, idol, _1000000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Bansonic;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
public class userSettings : MonoBehaviour
|
||||
{
|
||||
@@ -25,15 +31,86 @@ public class userSettings : MonoBehaviour
|
||||
[Tooltip("Documentation text normalized.")]
|
||||
public Button view_detailedHighlight_button;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
private const string RuntimeResourcesPath = "song_songIndex";
|
||||
private const string EditorAssetsPath = "Assets/Resources/song_songIndex";
|
||||
[SerializeField] private float clearupConfirmSeconds = 2f;
|
||||
private bool clearupPending;
|
||||
private float clearupExpireTime;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
|
||||
if (clearup_saveData_button != null)
|
||||
clearup_saveData_button.onClick.AddListener(OnClearupSaveDataClicked);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
private void OnDisable()
|
||||
{
|
||||
|
||||
if (clearup_saveData_button != null)
|
||||
clearup_saveData_button.onClick.RemoveListener(OnClearupSaveDataClicked);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (clearupPending && Time.unscaledTime > clearupExpireTime)
|
||||
clearupPending = false;
|
||||
}
|
||||
|
||||
private void OnClearupSaveDataClicked()
|
||||
{
|
||||
if (clearupPending && Time.unscaledTime <= clearupExpireTime)
|
||||
{
|
||||
clearupPending = false;
|
||||
StartCoroutine(ClearSongDataRoutine());
|
||||
return;
|
||||
}
|
||||
|
||||
clearupPending = true;
|
||||
clearupExpireTime = Time.unscaledTime + clearupConfirmSeconds;
|
||||
gNotice.alarm.display("再次按下清空存档");
|
||||
}
|
||||
|
||||
private IEnumerator ClearSongDataRoutine()
|
||||
{
|
||||
Dictionary<int, SongData> songs = new Dictionary<int, SongData>();
|
||||
|
||||
SongData[] runtimeSongs = Resources.LoadAll<SongData>(RuntimeResourcesPath);
|
||||
if (runtimeSongs != null)
|
||||
{
|
||||
for (int i = 0; i < runtimeSongs.Length; i++)
|
||||
{
|
||||
SongData so = runtimeSongs[i];
|
||||
if (so != null && !songs.ContainsKey(so.songID))
|
||||
songs.Add(so.songID, so);
|
||||
if ((i % 24) == 0)
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
string[] guids = AssetDatabase.FindAssets("t:SongData", new[] { EditorAssetsPath });
|
||||
if (guids != null)
|
||||
{
|
||||
for (int i = 0; i < guids.Length; i++)
|
||||
{
|
||||
string path = AssetDatabase.GUIDToAssetPath(guids[i]);
|
||||
SongData so = AssetDatabase.LoadAssetAtPath<SongData>(path);
|
||||
if (so != null && !songs.ContainsKey(so.songID))
|
||||
songs.Add(so.songID, so);
|
||||
if ((i % 24) == 0)
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int index = 0;
|
||||
foreach (var kvp in songs)
|
||||
{
|
||||
SongData so = kvp.Value;
|
||||
if (so != null)
|
||||
so.ClearSaveDataAndReload();
|
||||
index++;
|
||||
if ((index % 16) == 0)
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user