update
This commit is contained in:
@@ -1,19 +1,69 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using Ichni.UI;
|
||||
using Michsky.MUIP;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Ichni.RhythmGame.UI
|
||||
{
|
||||
public class GameLoadingCanvas : UIPageBase
|
||||
{
|
||||
public bool allPartsSet;
|
||||
public RectTransform leftParts;
|
||||
public RectTransform rightParts;
|
||||
|
||||
public TMP_Text progressText;
|
||||
public RectTransform progressMark;
|
||||
public ProgressBar progressBar;
|
||||
|
||||
public TMP_Text songNameText;
|
||||
public Image illustrationImage;
|
||||
public TMP_Text difficultyText;
|
||||
public TMP_Text levelText;
|
||||
|
||||
public TMP_Text composerText;
|
||||
public TMP_Text illustratorText;
|
||||
public TMP_Text chartDesignerText;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
InformationTransistor info = InformationTransistor.instance;
|
||||
|
||||
songNameText.text = info.song.songName;
|
||||
illustrationImage.sprite = info.song.illustration;
|
||||
difficultyText.text = info.difficulty.GetDifficultyName();
|
||||
levelText.text = info.difficulty.difficultyValue.ToString();
|
||||
composerText.text = info.song.composer;
|
||||
illustratorText.text = info.song.illustratorName;
|
||||
chartDesignerText.text = info.difficulty.charterName;
|
||||
}
|
||||
|
||||
public void SetProgress(float value)
|
||||
{
|
||||
progressBar.currentPercent = value;
|
||||
progressText.text = Mathf.RoundToInt(value) + "%";
|
||||
float markXPosition = 1920 * (value / 100f);
|
||||
progressMark.anchoredPosition = new Vector2(markXPosition, progressMark.anchoredPosition.y);
|
||||
progressBar.UpdateUI();
|
||||
}
|
||||
|
||||
public void MoveParts()
|
||||
{
|
||||
leftParts.anchoredPosition = new Vector2(-1030f, 0f);
|
||||
rightParts.anchoredPosition = new Vector2(250, 0f);
|
||||
allPartsSet = false;
|
||||
|
||||
leftParts.DOAnchorPosX(1030f, 0.5f).OnComplete(() => allPartsSet = true).Play();
|
||||
rightParts.DOAnchorPosX(-250f, 0.5f).Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,11 +12,16 @@ namespace Ichni.RhythmGame.UI
|
||||
public class GameUICanvas : UIPageBase
|
||||
{
|
||||
public Button pauseButton;
|
||||
|
||||
public TMP_Text difficultyNameText;
|
||||
public TMP_Text difficultyValueText;
|
||||
|
||||
public TMP_Text readyText;
|
||||
public TMP_Text accuracyText;
|
||||
public TMP_Text comboText;
|
||||
|
||||
public Image progressBar;
|
||||
|
||||
public GamePauseInterface pauseInterface;
|
||||
|
||||
[Title("Debug")]
|
||||
@@ -26,16 +31,28 @@ namespace Ichni.RhythmGame.UI
|
||||
{
|
||||
pauseButton.onClick.AddListener(()=>
|
||||
{
|
||||
GameManager.instance.audioManager.songPlayer.PauseSong();
|
||||
pauseButton.interactable = false;
|
||||
pauseInterface.FadeIn(0.5f, true);
|
||||
if (GameManager.instance.audioManager.isPlaying)
|
||||
{
|
||||
GameManager.instance.audioManager.songPlayer.PauseSong();
|
||||
pauseButton.interactable = false;
|
||||
pauseInterface.FadeIn(0.5f, true);
|
||||
}
|
||||
});
|
||||
|
||||
difficultyNameText.text = InformationTransistor.instance.difficulty.difficultyName;
|
||||
difficultyNameText.color = InformationTransistor.instance.difficulty.color / 2f;
|
||||
difficultyValueText.text = InformationTransistor.instance.difficulty.difficultyValue.ToString();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
fpsText.text = (1.0f / Time.unscaledDeltaTime).ToString("F2");
|
||||
}
|
||||
if (GameManager.instance.audioManager.isPlaying)
|
||||
{
|
||||
float songLength = GameManager.instance.songInformation.songLength;
|
||||
progressBar.fillAmount = songLength > 0 ? GameManager.instance.songTime / songLength : 0f; // 如果歌曲长度为0,填充量为0
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateAccuracy(float accuracy)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user