2025-07-21 05:42:20 -04:00
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
2025-08-11 14:04:06 -04:00
|
|
|
|
using DG.Tweening;
|
2025-07-26 04:20:25 -04:00
|
|
|
|
using Ichni.RhythmGame;
|
2025-07-21 05:42:20 -04:00
|
|
|
|
using TMPro;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
2025-08-11 14:04:06 -04:00
|
|
|
|
namespace Ichni.Menu
|
2025-07-21 05:42:20 -04:00
|
|
|
|
{
|
|
|
|
|
|
public class SongInfoUI : MonoBehaviour
|
|
|
|
|
|
{
|
|
|
|
|
|
public Image illustration;
|
|
|
|
|
|
public TMP_Text charterNameText;
|
|
|
|
|
|
public TMP_Text illustratorText;
|
|
|
|
|
|
|
|
|
|
|
|
public TMP_Text accuracyText;
|
2025-07-26 04:20:25 -04:00
|
|
|
|
public Image fullComboMark;
|
|
|
|
|
|
public Image allPerfectMark;
|
2025-07-21 05:42:20 -04:00
|
|
|
|
|
2025-08-11 14:04:06 -04:00
|
|
|
|
public bool isOpeningFullIllustration;
|
|
|
|
|
|
public Button openFullIllustrationButton;
|
|
|
|
|
|
public GameObject fullIllustration;
|
|
|
|
|
|
public Button closeFullIllustrationButton;
|
|
|
|
|
|
public bool isDuringFullIllustrationFade;
|
|
|
|
|
|
public void SetUp()
|
|
|
|
|
|
{
|
|
|
|
|
|
openFullIllustrationButton.onClick.AddListener(() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!isOpeningFullIllustration && !isDuringFullIllustrationFade)
|
|
|
|
|
|
{
|
|
|
|
|
|
isOpeningFullIllustration = true;
|
|
|
|
|
|
isDuringFullIllustrationFade = true;
|
|
|
|
|
|
fullIllustration.SetActive(true);
|
|
|
|
|
|
fullIllustration.GetComponentInChildren<Image>().sprite = illustration.sprite;
|
|
|
|
|
|
fullIllustration.GetComponent<CanvasGroup>().DOFade(1f, 0.5f)
|
|
|
|
|
|
.OnComplete(() => isDuringFullIllustrationFade = false)
|
|
|
|
|
|
.Play();
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
closeFullIllustrationButton.onClick.AddListener(() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
if (isOpeningFullIllustration && !isDuringFullIllustrationFade)
|
|
|
|
|
|
{
|
|
|
|
|
|
isOpeningFullIllustration = false;
|
|
|
|
|
|
isDuringFullIllustrationFade = true;
|
|
|
|
|
|
fullIllustration.GetComponent<CanvasGroup>().DOFade(0f, 0.5f)
|
|
|
|
|
|
.OnComplete(() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
fullIllustration.SetActive(false);
|
|
|
|
|
|
isDuringFullIllustrationFade = false;
|
|
|
|
|
|
})
|
|
|
|
|
|
.Play();
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-21 05:42:20 -04:00
|
|
|
|
public void SetIllustration(Sprite cover, string illustratorName)
|
|
|
|
|
|
{
|
|
|
|
|
|
illustration.sprite = cover;
|
|
|
|
|
|
illustratorText.text = illustratorName;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SetCharter(string charterName)
|
|
|
|
|
|
{
|
|
|
|
|
|
charterNameText.text = charterName == string.Empty ? "Unknown Charter" : charterName;
|
|
|
|
|
|
}
|
2025-07-26 04:20:25 -04:00
|
|
|
|
|
|
|
|
|
|
public void SetBeatmapInfo(BeatmapSave beatmapSave)
|
|
|
|
|
|
{
|
|
|
|
|
|
accuracyText.text = $"{beatmapSave.accuracy * 100:F2}%";
|
|
|
|
|
|
|
2026-07-24 17:56:30 -04:00
|
|
|
|
// 两种成绩徽记互斥显示:All Perfect 的优先级高于 Full Combo。
|
|
|
|
|
|
// 必须每次都显式设置两个对象;仅在非 All Perfect 时更新 Full Combo 会让 Prefab
|
|
|
|
|
|
// 初始状态或上一次选择谱面的显示状态残留,造成首次进入时同时出现两个徽记。
|
|
|
|
|
|
bool showAllPerfect = beatmapSave.isAllPerfect;
|
|
|
|
|
|
fullComboMark.gameObject.SetActive(!showAllPerfect && beatmapSave.isFullCombo);
|
|
|
|
|
|
allPerfectMark.gameObject.SetActive(showAllPerfect);
|
2025-07-26 04:20:25 -04:00
|
|
|
|
}
|
2025-07-21 05:42:20 -04:00
|
|
|
|
}
|
2026-07-24 17:56:30 -04:00
|
|
|
|
}
|