UICustomBtn.cs 4.6 KB

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