UICustomBtn.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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(part, eCustomStyple);
  52. break;
  53. case EButtonStyple.TiaoSe:
  54. break;
  55. case EButtonStyple.NorButton:
  56. CreatImgListFun();
  57. break;
  58. }
  59. }
  60. //float GetVale()
  61. //{
  62. // return 1;
  63. //}
  64. void CreatImgListFun() {
  65. if (uICustom.isTween)
  66. {
  67. return;
  68. }
  69. else
  70. {
  71. //object[] _objects = new object[]{ eCustomStyple, id };
  72. // uICustom.ClickBotton(_objects);
  73. uICustom.ClickBotton(eCustomStyple, id,isZDYPart);
  74. int _numIsZDYPart = isZDYPart ? 1 : 0;
  75. uICustom.HistoryAdd(eCustomStyple + "," + isZDYPart + "");
  76. }
  77. }
  78. // Update is called once per frame
  79. void Update()
  80. {
  81. }
  82. }
  83. }