UICustomBtn.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 ENieLianStyple eNieLianStyple = ENieLianStyple.None;
  20. [Header("是否重新生成列表")]
  21. public bool isCreate = false;
  22. public bool isZDYPart = false;
  23. private float value = 0;
  24. // Start is called before the first frame update
  25. void Awake()
  26. {
  27. //Debug.Log("111");
  28. Button btn = this.GetComponent<Button>();
  29. btn.onClick.AddListener(CustomBtnFun);
  30. }
  31. void CustomBtnFun() {
  32. //Debug.Log("111");
  33. //return;
  34. switch (this.eButtonStyple)
  35. {
  36. case EButtonStyple.Button:
  37. if (!isCreate)
  38. {
  39. }
  40. else
  41. {
  42. CreatImgListFun();
  43. }
  44. break;
  45. case EButtonStyple.Scroll:
  46. if (!uICustom.scrollbar.gameObject.activeSelf)
  47. {
  48. uICustom.scrollbar.gameObject.SetActive(true);
  49. }
  50. // uICustom.scrollbar.value = GetValue();
  51. uICustom.SetValue(id, eCustomStyple);
  52. break;
  53. case EButtonStyple.TiaoSe:
  54. break;
  55. case EButtonStyple.NorButton:
  56. CreatImgListFun();
  57. break;
  58. case EButtonStyple.Back:
  59. break;
  60. }
  61. }
  62. //float GetVale()
  63. //{
  64. // return 1;
  65. //}
  66. void CreatImgListFun() {
  67. if (uICustom.isTween)
  68. {
  69. return;
  70. }
  71. else
  72. {
  73. uICustom.HistoryAdd("ziDingyi" + "," + id + "");
  74. //object[] _objects = new object[]{ eCustomStyple, id };
  75. // uICustom.ClickBotton(_objects);
  76. uICustom.ClickBotton(eCustomStyple, id,isZDYPart);
  77. int _numIsZDYPart = isZDYPart ? 1 : 0;
  78. //uICustom.HistoryAdd(eCustomStyple + "," + isZDYPart + "");
  79. }
  80. }
  81. // Update is called once per frame
  82. void Update()
  83. {
  84. }
  85. }
  86. }