UICustomBtn.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. if (eCustomStyple == ECustomStyple.Cloth)
  44. {
  45. CustomManager.Instance.ChangeClothing(id);
  46. }
  47. }
  48. else
  49. {
  50. CreatImgListFun();
  51. }
  52. break;
  53. case EButtonStyple.Scroll:
  54. //if (!uICustom.scrollbar.gameObject.activeSelf)
  55. //{
  56. // uICustom.scrollbar.gameObject.SetActive(true);
  57. //}
  58. // uICustom.scrollbar.value = GetValue();
  59. uICustom.SetValue(id, eCustomStyple);
  60. uICustom.PickOnButton(this.gameObject,id);
  61. break;
  62. case EButtonStyple.TiaoSe:
  63. uICustom.SetColor(id, eCustomStyple);
  64. TiaoSeFun();
  65. break;
  66. case EButtonStyple.NorButton:
  67. CreatImgListFun();
  68. break;
  69. case EButtonStyple.Back:
  70. uICustom.BackBtnFun();
  71. break;
  72. }
  73. }
  74. void TiaoSeFun() {
  75. switch (this.eTSStyple)
  76. {
  77. case ETSStyple.None:
  78. uICustom.BackBtnFun();
  79. break;
  80. case ETSStyple.ViewOpen:
  81. uICustom.TiaoSeViewOpenFun();
  82. break;
  83. case ETSStyple.Close:
  84. uICustom.TiaoSeBanOpenStyple(false);
  85. uICustom.TiaoSeBanCloseFun();
  86. break;
  87. case ETSStyple.Sure:
  88. uICustom.TiaoSeSure();
  89. //uICustom.
  90. break;
  91. case ETSStyple.Open:
  92. uICustom.TiaoSeBanOpenStyple(true);
  93. // uICustom.TiaoSeBanOpenStyple(true);
  94. break;
  95. case ETSStyple.Button:
  96. uICustom.SetColor(id, eCustomStyple);
  97. break;
  98. }
  99. }
  100. //float GetVale()
  101. //{
  102. // return 1;
  103. //}
  104. void CreatImgListFun() {
  105. if (uICustom.isTween)
  106. {
  107. return;
  108. }
  109. else
  110. {
  111. //var a = new PartData();
  112. //var str =JsonUtility.ToJson(a);
  113. //var obj = JsonUtility.FromJson<PartData>(str);
  114. //GameEntry.Setting.SetString("savecolor",str);
  115. //GameEntry.Setting.Save();
  116. //GameEntry.Setting.HasSetting("savecolor");
  117. //GameEntry.Setting.GetString("");
  118. int ishasColor = uICustom.hasColorChoose ? 1 : 0;
  119. uICustom.HistoryAdd("ziDingyi" + ","+ishasColor+"," + id + "");
  120. //object[] _objects = new object[]{ eCustomStyple, id };
  121. // uICustom.ClickBotton(_objects);
  122. uICustom.ClickBotton(eCustomStyple, id,isZDYPart,isColor);
  123. int _numIsZDYPart = isZDYPart ? 1 : 0;
  124. //uICustom.HistoryAdd(eCustomStyple + "," + isZDYPart + "");
  125. }
  126. }
  127. // Update is called once per frame
  128. //void Update()
  129. //{
  130. //}
  131. }
  132. }