Files
Unity20GameJam/Assets/Gameplay/Scripts/UI/MusicGamePanel.cs
2025-11-09 23:36:29 +08:00

56 lines
1.4 KiB
C#

using A2W;
using Cysharp.Threading.Tasks;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;
public class MusicGamePanel : UIPanel
{
// Start is called once before the first execution of Update after the MonoBehaviour is created
public TMP_Text scoreText;
public TMP_Text tipText;
public TMP_Text tipText2;
public Button startButton;
public override UniTask Hide()
{
return UniTask.CompletedTask;
}
public override void Init()
{
tipText.gameObject.SetActive(true);
startButton.gameObject.SetActive(true);
}
public override UniTask Show()
{
return UniTask.CompletedTask;
}
void Start()
{
// startButton.onClick.AddListener(() =>
// {
// tipText.gameObject.SetActive(false);
// startButton.gameObject.SetActive(false);
// });
}
// Update is called once per frame
bool isStart = false;
void Update()
{
scoreText.text = MusicGame.instance.Sroce.ToString();
if (Keyboard.current.spaceKey.wasPressedThisFrame && !isStart)
{
isStart = true;
tipText.gameObject.SetActive(false);
tipText2.gameObject.SetActive(false);
MusicGame.instance.Play();
startButton.gameObject.SetActive(false);
}
}
}