Pro_Unit

ContentButton

Dec 6th, 2018
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.94 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3.  
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. using Text = TMPro.TextMeshProUGUI;
  7.  
  8. namespace GameCore
  9. {
  10.     public class ContentButton : MonoBehaviour
  11.     {
  12.         private Button _button = null;
  13.         public Button button { get { if (_button == null) _button = GetComponent<Button> (); return _button; } }
  14.         public bool interactable { get { return button.interactable; } set { button.interactable = value; } }
  15.         public Button.ButtonClickedEvent onClick { get { return button.onClick; } set { button.onClick = value;} }
  16.         public void SetActive (bool active)
  17.         {
  18.             gameObject.SetActive (active);
  19.         }
  20.         public Graphic targetGraphic { get{return button.targetGraphic;}  }
  21.         public Text textCompnent;
  22.  
  23.         public string text { get { return textCompnent.text; } set { textCompnent.text = value; } }
  24.         public Color textColor { get { return textCompnent.color; } set { textCompnent.color = value; } }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment