UICustomBtn.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. namespace MetaClient
  6. {
  7. public class UICustomBtn : MonoBehaviour
  8. {
  9. public UICustom uICustom;
  10. [Header("选择界面分支")]
  11. public ECustomStyple eCustomStyple = ECustomStyple.None;
  12. [Header("按钮id")]
  13. public int id;
  14. [Header("功能分类")]
  15. public EButtonStyple eButtonStyple = EButtonStyple.Button;
  16. [Header("对应部位part")]
  17. public int part=0;
  18. [Header("对应调色")]
  19. public ETSStyple eTSStyple = ETSStyple.None;
  20. //[Header("点击分支")]
  21. //public ENieLianStyple eNieLianStyple = ENieLianStyple.None;
  22. [Header("是否重新生成列表")]
  23. public bool isCreate = false;
  24. public bool isZDYPart = false;
  25. public GameObject tiaoSeObj;
  26. private float value = 0;
  27. // Start is called before the first frame update
  28. void Awake()
  29. {
  30. //Debug.Log("111");
  31. Button btn = this.GetComponent<Button>();
  32. btn.onClick.AddListener(CustomBtnFun);
  33. }
  34. void CustomBtnFun() {
  35. //Debug.Log("111");
  36. //return;
  37. switch (this.eButtonStyple)
  38. {
  39. case EButtonStyple.Button:
  40. if (!isCreate)
  41. {
  42. }
  43. else
  44. {
  45. CreatImgListFun();
  46. }
  47. break;
  48. case EButtonStyple.Scroll:
  49. if (!uICustom.scrollbar.gameObject.activeSelf)
  50. {
  51. uICustom.scrollbar.gameObject.SetActive(true);
  52. }
  53. // uICustom.scrollbar.value = GetValue();
  54. uICustom.SetValue(part, eCustomStyple);
  55. break;
  56. case EButtonStyple.TiaoSe:
  57. TiaoSeFun();
  58. break;
  59. case EButtonStyple.NorButton:
  60. CreatImgListFun();
  61. break;
  62. case EButtonStyple.Back:
  63. uICustom.BackBtnFun();
  64. break;
  65. }
  66. }
  67. void TiaoSeFun() {
  68. switch (this.eTSStyple)
  69. {
  70. case ETSStyple.None:
  71. //uICustom.BackBtnFun();
  72. break;
  73. case ETSStyple.ViewOpen:
  74. uICustom.TiaoSeViewOpenFun();
  75. break;
  76. case ETSStyple.Close:
  77. uICustom.TiaoSeBanOpenStyple(false);
  78. break;
  79. case ETSStyple.Sure:
  80. //uICustom.
  81. break;
  82. case ETSStyple.Open:
  83. uICustom.TiaoSeBanOpenStyple(true);
  84. break;
  85. }
  86. }
  87. //float GetVale()
  88. //{
  89. // return 1;
  90. //}
  91. void CreatImgListFun() {
  92. if (uICustom.isTween)
  93. {
  94. return;
  95. }
  96. else
  97. {
  98. uICustom.HistoryAdd("ziDingyi" + "," + id + "");
  99. //object[] _objects = new object[]{ eCustomStyple, id };
  100. // uICustom.ClickBotton(_objects);
  101. uICustom.ClickBotton(eCustomStyple, id,isZDYPart);
  102. int _numIsZDYPart = isZDYPart ? 1 : 0;
  103. //uICustom.HistoryAdd(eCustomStyple + "," + isZDYPart + "");
  104. }
  105. }
  106. // Update is called once per frame
  107. void Update()
  108. {
  109. }
  110. }
  111. }