_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Scene_main/main_game.cs

56 lines
1.3 KiB
C#
Raw Normal View History

2024-11-26 15:33:45 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
2024-11-26 17:41:48 +08:00
using UnityEngine.UI;
2024-11-26 15:33:45 +08:00
2024-11-26 17:41:48 +08:00
public class main_game :Base
2024-11-26 15:33:45 +08:00
{
2024-11-26 17:41:48 +08:00
[Header("canvas<61><73><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD>ɵĸ<C9B5><C4B8>ڵ<EFBFBD>")]
public Canvas canvas;
[Header("<22><>ť<EFBFBD><C5A5><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>һһ<D2BB><D2BB>Ӧ")]
public Button BTN1;
public Button BTN2;
public Button BTN3;
public Button BTN4;
[Header("<22><>ť<EFBFBD><C5A5><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>һһ<D2BB><D2BB>Ӧ")]
public GameObject panel1;
public GameObject panel2;
public GameObject panel3;
public GameObject panel4;
2024-11-26 23:30:03 +08:00
public virtual void Start()
2024-11-26 15:33:45 +08:00
{
2024-11-26 23:30:03 +08:00
2024-11-26 17:41:48 +08:00
BTN1.onClick.AddListener(()=> {
asyncOnShopBTN(BTN1, panel1);
});
BTN2.onClick.AddListener(() => {
asyncOnShopBTN(BTN2, panel2);
});
BTN3.onClick.AddListener(() => {
asyncOnShopBTN(BTN3, panel3);
});
BTN4.onClick.AddListener(() => {
asyncOnShopBTN(BTN4, panel4);
});
2024-11-26 15:33:45 +08:00
}
2024-11-26 17:41:48 +08:00
public async void asyncOnShopBTN(Button BTN,GameObject _panel)
{
await ButtonClickAnimationAsync(BTN.gameObject);
if (_panel == null)
{
2024-11-26 23:30:03 +08:00
addEventPopUp(<><CEB4><EFBFBD><EFBFBD>", 3f);
2024-11-26 17:41:48 +08:00
return;
}
// ʵ<><CAB5><EFBFBD><EFBFBD> Panel <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ 0.5
GameObject newPanel = GameObject.Instantiate(_panel, canvas.transform);
newPanel.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
2024-11-26 23:30:03 +08:00
}
2024-11-26 15:33:45 +08:00
}