UICustomBtn.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. private float value = 0;
  23. // Start is called before the first frame update
  24. void Awake()
  25. {
  26. //Debug.Log("111");
  27. Button btn = this.GetComponent<Button>();
  28. btn.onClick.AddListener(CustomBtnFun);
  29. }
  30. void CustomBtnFun() {
  31. //Debug.Log("111");
  32. //return;
  33. switch (this.eButtonStyple)
  34. {
  35. case EButtonStyple.Button:
  36. if (!isCreate)
  37. {
  38. }
  39. else
  40. {
  41. CreatImgListFun();
  42. }
  43. break;
  44. case EButtonStyple.Scroll:
  45. if (!uICustom.scrollbar.gameObject.activeSelf)
  46. {
  47. uICustom.scrollbar.gameObject.SetActive(true);
  48. }
  49. // uICustom.scrollbar.value = GetValue();
  50. uICustom.SetValue(part, eCustomStyple);
  51. break;
  52. case EButtonStyple.TiaoSe:
  53. break;
  54. case EButtonStyple.NorButton:
  55. CreatImgListFun();
  56. break;
  57. }
  58. }
  59. //float GetVale()
  60. //{
  61. // return 1;
  62. //}
  63. void CreatImgListFun() {
  64. if (uICustom.isTween)
  65. {
  66. return;
  67. }
  68. else
  69. {
  70. //object[] _objects = new object[]{ eCustomStyple, id };
  71. // uICustom.ClickBotton(_objects);
  72. uICustom.ClickBotton(eCustomStyple, id);
  73. }
  74. }
  75. // Update is called once per frame
  76. void Update()
  77. {
  78. }
  79. }
  80. }