45 lines
1.0 KiB
C#
45 lines
1.0 KiB
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
|
|||
|
public class BettingBtn : MonoBehaviour
|
|||
|
{
|
|||
|
public GameObject BetList;
|
|||
|
public Button NumBtn;
|
|||
|
public Text BetText;
|
|||
|
public float BetValue;//Ͷע<CDB6><D7A2>ֵ
|
|||
|
// Start is called before the first frame update
|
|||
|
void Start()
|
|||
|
{
|
|||
|
BetList.SetActive(false);
|
|||
|
NumBtn.onClick.AddListener(OnClickNumBtn);
|
|||
|
BetValue = 50;//Ĭ<><C4AC>50
|
|||
|
SetBet();
|
|||
|
}
|
|||
|
|
|||
|
void OnClickNumBtn()
|
|||
|
{
|
|||
|
BetList.SetActive(true);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void SetBet()
|
|||
|
{
|
|||
|
// <20><>ȡ<EFBFBD><C8A1><EFBFBD>е<EFBFBD>Button<6F><6E><EFBFBD><EFBFBD>
|
|||
|
Button[] buttons = BetList.GetComponentsInChildren<Button>();
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD>ÿһ<C3BF><D2BB>Button<6F><6E><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD>¼<EFBFBD>
|
|||
|
foreach (Button button in buttons)
|
|||
|
{
|
|||
|
button.onClick.AddListener(() => {
|
|||
|
BetText.text = button.transform.GetComponentInChildren<Text>().text;
|
|||
|
BetValue = float.Parse(BetText.text);
|
|||
|
BetList.SetActive(false);
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|