UICustomBtn.cs 3.7 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(id, eCustomStyple);
  55. uICustom.PickOnButton(this.gameObject,id);
  56. break;
  57. case EButtonStyple.TiaoSe:
  58. TiaoSeFun();
  59. break;
  60. case EButtonStyple.NorButton:
  61. CreatImgListFun();
  62. break;
  63. case EButtonStyple.Back:
  64. uICustom.BackBtnFun();
  65. break;
  66. }
  67. }
  68. void TiaoSeFun() {
  69. switch (this.eTSStyple)
  70. {
  71. case ETSStyple.None:
  72. uICustom.BackBtnFun();
  73. break;
  74. case ETSStyple.ViewOpen:
  75. uICustom.TiaoSeViewOpenFun();
  76. break;
  77. case ETSStyple.Close:
  78. uICustom.TiaoSeBanOpenStyple(false);
  79. break;
  80. case ETSStyple.Sure:
  81. //uICustom.
  82. break;
  83. case ETSStyple.Open:
  84. // uICustom.TiaoSeBanOpenStyple(true);
  85. break;
  86. }
  87. }
  88. //float GetVale()
  89. //{
  90. // return 1;
  91. //}
  92. void CreatImgListFun() {
  93. if (uICustom.isTween)
  94. {
  95. return;
  96. }
  97. else
  98. {
  99. uICustom.HistoryAdd("ziDingyi" + "," + id + "");
  100. //object[] _objects = new object[]{ eCustomStyple, id };
  101. // uICustom.ClickBotton(_objects);
  102. uICustom.ClickBotton(eCustomStyple, id,isZDYPart);
  103. int _numIsZDYPart = isZDYPart ? 1 : 0;
  104. //uICustom.HistoryAdd(eCustomStyple + "," + isZDYPart + "");
  105. }
  106. }
  107. // Update is called once per frame
  108. void Update()
  109. {
  110. }
  111. }
  112. }