This commit is contained in:
2026-01-22 18:16:11 +08:00
parent f2fe6fbf04
commit 7464cd8b6c
76 changed files with 8828 additions and 2272 deletions
@@ -1,53 +0,0 @@
using System;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace AibisDream
{
[RequireComponent(typeof(Button))]
public class ShapeCreateButton : MonoBehaviour
{
[SerializeField] private Button button;
[SerializeField] private TMP_Text text;
private string blockShapeKey;
private int count;
public event Action<string> OnClick;
private void Awake()
{
GetComponent<Button>().onClick.AddListener(OnButtonClick);
}
private void OnDestroy()
{
GetComponent<Button>().onClick.RemoveListener(OnButtonClick);
}
public void OnButtonClick()
{
if (count > 0)
{
OnClick?.Invoke(blockShapeKey);
count--;
text.text = $"{blockShapeKey}: {count}";
}
}
public void SetButtonInfo(string key, int count)
{
blockShapeKey = key;
this.count = count;
text.text = $"{key}: {count}";
gameObject.name = key;
}
public void AddCount()
{
count++;
text.text = $"{blockShapeKey}: {count}";
}
}
}