源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.1 KiB

  1. using UnityEngine.UI;
  2. using UnityEngine;
  3. namespace LuaFramework
  4. {
  5. public class ImageExtend : Image
  6. {
  7. private float _alpha = 1.0F;
  8. private Outline[] _outLine;
  9. public float alpha
  10. {
  11. get { return _alpha; }
  12. set { SetAlpha(value); }
  13. }
  14. private void SetAlpha(float value)
  15. {
  16. _alpha = value;
  17. color = new UnityEngine.Color(color.r, color.g, color.b, _alpha);
  18. }
  19. private bool _gray = false;
  20. public bool gray
  21. {
  22. get { return _gray; }
  23. set { SetGray(value); }
  24. }
  25. private void SetGray(bool value)
  26. {
  27. _gray = value;
  28. if (_gray)
  29. {
  30. material = Resources.Load("material/Gray") as Material;
  31. }
  32. else
  33. {
  34. material = null;
  35. }
  36. if (_outLine == null)
  37. {
  38. _outLine = GetComponentsInChildren<Outline>(true);
  39. }
  40. foreach (var line in _outLine)
  41. {
  42. line.enabled = !value;
  43. }
  44. }
  45. }
  46. }