UICustomBtn.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. uICustom.SetColor(id, eCustomStyple);
  83. break;
  84. case ETSStyple.Close:
  85. uICustom.TiaoSeBanOpenStyple(false);
  86. uICustom.TiaoSeBanCloseFun();
  87. break;
  88. case ETSStyple.Sure:
  89. uICustom.TiaoSeSure();
  90. //uICustom.
  91. break;
  92. case ETSStyple.Open:
  93. uICustom.TiaoSeBanOpenStyple(true);
  94. // uICustom.TiaoSeBanOpenStyple(true);
  95. break;
  96. case ETSStyple.Button:
  97. uICustom.SetColor(id, eCustomStyple);
  98. break;
  99. }
  100. }
  101. //float GetVale()
  102. //{
  103. // return 1;
  104. //}
  105. void CreatImgListFun() {
  106. if (uICustom.isTween)
  107. {
  108. return;
  109. }
  110. else
  111. {
  112. //var a = new PartData();
  113. //var str =JsonUtility.ToJson(a);
  114. //var obj = JsonUtility.FromJson<PartData>(str);
  115. //GameEntry.Setting.SetString("savecolor",str);
  116. //GameEntry.Setting.Save();
  117. //GameEntry.Setting.HasSetting("savecolor");
  118. //GameEntry.Setting.GetString("");
  119. int ishasColor = uICustom.hasColorChoose ? 1 : 0;
  120. uICustom.HistoryAdd("ziDingyi" + ","+ishasColor+"," + id + "");
  121. //object[] _objects = new object[]{ eCustomStyple, id };
  122. // uICustom.ClickBotton(_objects);
  123. uICustom.ClickBotton(eCustomStyple, id,isZDYPart,isColor);
  124. int _numIsZDYPart = isZDYPart ? 1 : 0;
  125. //uICustom.HistoryAdd(eCustomStyple + "," + isZDYPart + "");
  126. }
  127. }
  128. // Update is called once per frame
  129. //void Update()
  130. //{
  131. //}
  132. }
  133. }