LayerBtn.cs 742 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class LayerBtn : MonoBehaviour
  6. {
  7. public Image sprite;
  8. public Text nameText;
  9. public Text numText;
  10. public Button btn;
  11. public VerticalLayoutGroup secContent;
  12. // Start is called before the first frame update
  13. void Start()
  14. {
  15. }
  16. public void SetLayerBtnData(Sprite sp,string name,string num)
  17. {
  18. sprite.sprite = sp;
  19. nameText.text = name;
  20. numText.text = num.ToString();
  21. }
  22. public void SetUseful(bool use) {
  23. btn.GetComponent<CanvasGroup>().alpha = use ? 1 : 0.5f;
  24. }
  25. // Update is called once per frame
  26. void Update()
  27. {
  28. }
  29. }