Cute_demon_attacks/meng_yao/Assets/script/A_Fight/StopBtn.cs

47 lines
1.0 KiB
C#
Raw Normal View History

2024-12-09 11:56:41 +08:00
using System.Collections;
using System.Collections.Generic;
2024-12-09 18:01:59 +08:00
using System.Threading.Tasks;
2024-12-09 11:56:41 +08:00
using UnityEngine;
using UnityEngine.UI;
public class StopBtn : MonoBehaviour
{
public Image startImage;
public Image stopImage;
public Button stopBtn;
2024-12-09 18:01:59 +08:00
public GameObject panelPrefab;
2024-12-09 11:56:41 +08:00
int number;
// Start is called before the first frame update
void Start()
{
2024-12-09 18:01:59 +08:00
GameSatrt();
2024-12-09 11:56:41 +08:00
stopBtn = GetComponent<Button>();
2024-12-09 18:01:59 +08:00
stopBtn.onClick.AddListener(async ()=>{
GameStop();
GameObject obj = Instantiate(panelPrefab,GameObject.Find("Canvas").transform);
obj.GetComponent<Beat_ZanTing>().sBtn = this;//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD>ű<EFBFBD>
2024-12-09 18:01:59 +08:00
await Task.Delay(500);
gameGlobal.GameStop();
2024-12-09 18:01:59 +08:00
});
2024-12-09 11:56:41 +08:00
}
public void GameStop()
2024-12-09 18:01:59 +08:00
{
startImage.gameObject.SetActive(true);
stopImage.gameObject.SetActive(false);
2024-12-09 11:56:41 +08:00
}
public void GameSatrt()
2024-12-09 11:56:41 +08:00
{
2024-12-09 18:01:59 +08:00
startImage.gameObject.SetActive(false);
stopImage.gameObject.SetActive(true);
2024-12-09 11:56:41 +08:00
}
2024-12-09 18:01:59 +08:00
2024-12-09 11:56:41 +08:00
}