UICustomBtn.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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 bool isColor = false;
  26. //public GameObject tiaoSeObj;
  27. private float value = 0;
  28. // Start is called before the first frame update
  29. void Awake()
  30. {
  31. //Debug.Log("111");
  32. Button btn = this.GetComponent<Button>();
  33. btn.onClick.AddListener(CustomBtnFun);
  34. }
  35. void CustomBtnFun() {
  36. //Debug.Log("111");
  37. //return;
  38. switch (this.eButtonStyple)
  39. {
  40. case EButtonStyple.Button:
  41. if (!isCreate)
  42. {
  43. }
  44. else
  45. {
  46. CreatImgListFun();
  47. }
  48. break;
  49. case EButtonStyple.Scroll:
  50. //if (!uICustom.scrollbar.gameObject.activeSelf)
  51. //{
  52. // uICustom.scrollbar.gameObject.SetActive(true);
  53. //}
  54. // uICustom.scrollbar.value = GetValue();
  55. uICustom.SetValue(id, eCustomStyple);
  56. uICustom.PickOnButton(this.gameObject,id);
  57. break;
  58. case EButtonStyple.TiaoSe:
  59. TiaoSeFun();
  60. break;
  61. case EButtonStyple.NorButton:
  62. CreatImgListFun();
  63. break;
  64. case EButtonStyple.Back:
  65. uICustom.BackBtnFun();
  66. break;
  67. }
  68. }
  69. void TiaoSeFun() {
  70. switch (this.eTSStyple)
  71. {
  72. case ETSStyple.None:
  73. uICustom.BackBtnFun();
  74. break;
  75. case ETSStyple.ViewOpen:
  76. uICustom.TiaoSeViewOpenFun();
  77. break;
  78. case ETSStyple.Close:
  79. uICustom.TiaoSeBanOpenStyple(false);
  80. uICustom.TiaoSeBanCloseFun();
  81. break;
  82. case ETSStyple.Sure:
  83. uICustom.TiaoSeSure();
  84. //uICustom.
  85. break;
  86. case ETSStyple.Open:
  87. uICustom.TiaoSeBanOpenStyple(true);
  88. // uICustom.TiaoSeBanOpenStyple(true);
  89. break;
  90. case ETSStyple.Button:
  91. uICustom.SetColor(id, eCustomStyple);
  92. break;
  93. }
  94. }
  95. //float GetVale()
  96. //{
  97. // return 1;
  98. //}
  99. void CreatImgListFun() {
  100. if (uICustom.isTween)
  101. {
  102. return;
  103. }
  104. else
  105. {
  106. //var a = new PartData();
  107. //var str =JsonUtility.ToJson(a);
  108. //var obj = JsonUtility.FromJson<PartData>(str);
  109. //GameEntry.Setting.SetString("savecolor",str);
  110. //GameEntry.Setting.Save();
  111. //GameEntry.Setting.HasSetting("savecolor");
  112. //GameEntry.Setting.GetString("");
  113. int ishasColor = uICustom.hasColorChoose ? 1 : 0;
  114. uICustom.HistoryAdd("ziDingyi" + ","+ishasColor+"," + id + "");
  115. //object[] _objects = new object[]{ eCustomStyple, id };
  116. // uICustom.ClickBotton(_objects);
  117. uICustom.ClickBotton(eCustomStyple, id,isZDYPart,isColor);
  118. int _numIsZDYPart = isZDYPart ? 1 : 0;
  119. //uICustom.HistoryAdd(eCustomStyple + "," + isZDYPart + "");
  120. }
  121. }
  122. // Update is called once per frame
  123. void Update()
  124. {
  125. }
  126. }
  127. }