feat: 自动更新按钮上的文字
This commit is contained in:
@@ -7,25 +7,19 @@ namespace OCES
|
||||
{
|
||||
public class ButtonInvoker : MonoBehaviour
|
||||
{
|
||||
public TileMaterial targetGameState;
|
||||
public GameState targetGameState;
|
||||
public bool enableLowpass;
|
||||
public Text buttonText;
|
||||
|
||||
Button m_button;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
this.m_button = GetComponent<Button>();
|
||||
|
||||
|
||||
this.m_button.onClick.AddListener(ButtonPressed);
|
||||
this.buttonText.text = this.buttonText.text.Replace("PlaceHolder", this.targetGameState.ToString());
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
this.m_button.onClick.RemoveListener(ButtonPressed);
|
||||
}
|
||||
|
||||
private void ButtonPressed()
|
||||
public void OnButtonPressed()
|
||||
{
|
||||
AudioSystem.Instance.SetState(this.targetGameState);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user