123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- namespace MetaClient
- {
- public class UICustomBtn : MonoBehaviour
- {
- public UICustom uICustom;
- [Header("选择界面分支")]
- public ECustomStyple eCustomStyple = ECustomStyple.None;
- [Header("按钮id")]
- public int id;
- [Header("功能分类")]
- public EButtonStyple eButtonStyple = EButtonStyple.Button;
- [Header("对应部位part")]
- public int part=0;
- [Header("对应调色")]
- public ETSStyple eTSStyple = ETSStyple.None;
- //[Header("点击分支")]
- //public ENieLianStyple eNieLianStyple = ENieLianStyple.None;
- [Header("是否重新生成列表")]
- public bool isCreate = false;
- public bool isZDYPart = false;
- public bool isColor = false;
- //public GameObject tiaoSeObj;
- private float value = 0;
- // Start is called before the first frame update
- void Awake()
- {
- //Debug.Log("111");
- Button btn = this.GetComponent<Button>();
- btn.onClick.AddListener(CustomBtnFun);
- }
- void CustomBtnFun() {
- //Debug.Log("111");
- //return;
- switch (this.eButtonStyple)
- {
- case EButtonStyple.Button:
- if (!isCreate)
- {
- }
- else
- {
-
- CreatImgListFun();
- }
- break;
- case EButtonStyple.Scroll:
- //if (!uICustom.scrollbar.gameObject.activeSelf)
- //{
- // uICustom.scrollbar.gameObject.SetActive(true);
- //}
- // uICustom.scrollbar.value = GetValue();
- uICustom.SetValue(id, eCustomStyple);
- uICustom.PickOnButton(this.gameObject,id);
- break;
- case EButtonStyple.TiaoSe:
- TiaoSeFun();
- break;
- case EButtonStyple.NorButton:
- CreatImgListFun();
- break;
- case EButtonStyple.Back:
- uICustom.BackBtnFun();
- break;
- }
- }
- void TiaoSeFun() {
- switch (this.eTSStyple)
- {
- case ETSStyple.None:
- uICustom.BackBtnFun();
- break;
- case ETSStyple.ViewOpen:
- uICustom.TiaoSeViewOpenFun();
- break;
- case ETSStyple.Close:
- uICustom.TiaoSeBanOpenStyple(false);
- UICustom.TiaoSeBanCloseFun();
- break;
- case ETSStyple.Sure:
- uICustom.TiaoSeSure();
- //uICustom.
- break;
- case ETSStyple.Open:
- uICustom.TiaoSeBanOpenStyple(true);
- // uICustom.TiaoSeBanOpenStyple(true);
- break;
- case ETSStyple.Button:
- uICustom.SetColor(id, eCustomStyple);
- break;
- }
- }
- //float GetVale()
- //{
- // return 1;
- //}
- void CreatImgListFun() {
- if (uICustom.isTween)
- {
- return;
- }
- else
- {
- //var a = new PartData();
- //var str =JsonUtility.ToJson(a);
- //var obj = JsonUtility.FromJson<PartData>(str);
- //GameEntry.Setting.SetString("savecolor",str);
- //GameEntry.Setting.Save();
- //GameEntry.Setting.HasSetting("savecolor");
- //GameEntry.Setting.GetString("");
- uICustom.HistoryAdd("ziDingyi" + "," + id + "");
- //object[] _objects = new object[]{ eCustomStyple, id };
- // uICustom.ClickBotton(_objects);
- uICustom.ClickBotton(eCustomStyple, id,isZDYPart,isColor);
- int _numIsZDYPart = isZDYPart ? 1 : 0;
- //uICustom.HistoryAdd(eCustomStyple + "," + isZDYPart + "");
- }
- }
- // Update is called once per frame
- void Update()
- {
- }
- }
- }
|