101 lines
3.8 KiB
C#
101 lines
3.8 KiB
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using Ichni.Localization;
|
||
using Ichni.UI;
|
||
using Michsky.MUIP;
|
||
using Sirenix.OdinInspector;
|
||
using TMPro;
|
||
using UnityEngine.UI;
|
||
|
||
namespace Ichni.RhythmGame
|
||
{
|
||
public class SummaryPageCanvas : UIPageBase
|
||
{
|
||
[Title("Song Information")]
|
||
public TMP_Text songNameText;
|
||
public TMP_Text composerText;
|
||
|
||
[Title("Illustration")]
|
||
public Image illustrationImage;
|
||
|
||
[Title("Character")]
|
||
public Image characterImage;
|
||
public TMP_Text characterNameText;
|
||
public TMP_Text sentenceText;
|
||
[Tooltip("角色名的 Unity Localization 文本。应配置 UI/ui_summary_soullies_name。")]
|
||
public LocalizedTMPText characterNameLocalizedText;
|
||
[Tooltip("角色短句的 Unity Localization 文本。应配置 UI/ui_summary_soullies_sentence_0。")]
|
||
public LocalizedTMPText sentenceLocalizedText;
|
||
|
||
[Title("Difficulty")]
|
||
public TMP_Text difficultyText;
|
||
public TMP_Text levelText;
|
||
|
||
[Title("ChartInfo")]
|
||
public TMP_Text illustratorText;
|
||
public TMP_Text chartDesignerText;
|
||
public TMP_Text songLengthText;
|
||
public TMP_Text bpmText;
|
||
|
||
[Title("Accuracy")]
|
||
public TMP_Text accuracyText;
|
||
|
||
[Title("Game Records")]
|
||
public TMP_Text perfectCountText;
|
||
public TMP_Text goodCountText;
|
||
public TMP_Text badCountText;
|
||
public TMP_Text missCountText;
|
||
public TMP_Text maxComboText;
|
||
|
||
[Title("ResultGraph")]
|
||
public ResultGraph resultGraph;
|
||
|
||
[Title("Return")]
|
||
public Button shareButton;
|
||
public Button restartButton;
|
||
public Button backButton;
|
||
|
||
public void SetUpSummary()
|
||
{
|
||
InformationTransistor info = InformationTransistor.instance;
|
||
|
||
songNameText.text = info.song.songName;
|
||
composerText.text = info.song.composer;
|
||
|
||
illustrationImage.sprite = info.song.illustration;
|
||
|
||
// Summary 页面没有再依赖 I2 Term。迁移期间允许旧场景先不绑定新字段:
|
||
// 此时不会中断结算页面;完成 Inspector 配置后,两个 LocalizedTMPText 会自动跟随 Locale 切换。
|
||
characterNameLocalizedText ??= characterNameText.GetComponent<LocalizedTMPText>();
|
||
sentenceLocalizedText ??= sentenceText.GetComponent<LocalizedTMPText>();
|
||
characterNameLocalizedText?.RefreshText();
|
||
sentenceLocalizedText?.RefreshText();
|
||
|
||
difficultyText.text = info.difficulty.GetDifficultyName();
|
||
levelText.text = info.difficulty.difficultyValue.ToString();
|
||
|
||
chartDesignerText.text = info.difficulty.charterName;
|
||
illustratorText.text = info.song.illustratorName;
|
||
songLengthText.text = System.TimeSpan.FromSeconds(info.songLength).ToString(@"m\:ss");
|
||
bpmText.text = info.bpm.ToString("F1");
|
||
|
||
PlayingRecorder recorder = GameManager.Instance.playingRecorder;
|
||
|
||
perfectCountText.text = recorder.perfectCount.ToString();
|
||
goodCountText.text = recorder.goodCount.ToString();
|
||
badCountText.text = recorder.badCount.ToString();
|
||
missCountText.text = recorder.missCount.ToString();
|
||
accuracyText.text = recorder.accuracy.ToString("F2") + "%";
|
||
maxComboText.text = recorder.maxCombo.ToString();
|
||
|
||
resultGraph.Initialize(recorder.resultData);
|
||
|
||
restartButton.onClick.RemoveAllListeners();
|
||
restartButton.onClick.AddListener(GameManager.RestartGame);
|
||
backButton.onClick.RemoveAllListeners();
|
||
backButton.onClick.AddListener(GameManager.ReturnToMenu);
|
||
}
|
||
}
|
||
}
|