Files
ichni_Official/Assets/Scripts/Game/UI/GameLoadingCanvas.cs

69 lines
2.1 KiB
C#
Raw Normal View History

2025-08-22 14:54:40 -04:00
using System;
2025-07-08 14:28:40 -04:00
using System.Collections;
using System.Collections.Generic;
2025-08-22 14:54:40 -04:00
using DG.Tweening;
2025-07-08 14:28:40 -04:00
using Ichni.UI;
using Michsky.MUIP;
2025-08-22 14:54:40 -04:00
using TMPro;
2025-07-08 14:28:40 -04:00
using UnityEngine;
2025-08-22 14:54:40 -04:00
using UnityEngine.UI;
2025-07-08 14:28:40 -04:00
namespace Ichni.RhythmGame.UI
{
public class GameLoadingCanvas : UIPageBase
{
2025-08-22 14:54:40 -04:00
public bool allPartsSet;
public RectTransform leftParts;
public RectTransform rightParts;
public TMP_Text progressText;
public RectTransform progressMark;
2025-07-08 14:28:40 -04:00
public ProgressBar progressBar;
2025-08-22 14:54:40 -04:00
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;
}
2025-07-08 14:28:40 -04:00
public void SetProgress(float value)
{
progressBar.currentPercent = value;
2025-08-22 14:54:40 -04:00
progressText.text = Mathf.RoundToInt(value) + "%";
2025-08-23 05:29:37 -04:00
float markXPosition = 1800 * (value / 100f);
2025-08-22 14:54:40 -04:00
progressMark.anchoredPosition = new Vector2(markXPosition, progressMark.anchoredPosition.y);
2025-07-08 14:28:40 -04:00
progressBar.UpdateUI();
}
2025-08-22 14:54:40 -04:00
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();
}
2025-07-08 14:28:40 -04:00
}
}