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 ENieLianStyple eNieLianStyple = ENieLianStyple.None;
        [Header("是否重新生成列表")]
        public bool isCreate = false;

        public bool isZDYPart = false;

        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(part, eCustomStyple);
                    
                    break;
                case EButtonStyple.TiaoSe:
                    break;
                case EButtonStyple.NorButton:
                    CreatImgListFun();
                    break;
            }



        }

        //float GetVale()
        //{
        //    return 1;
        //}
        void CreatImgListFun() {
            if (uICustom.isTween)
            {
                return;
            }
            else
            {
                 //object[] _objects = new object[]{ eCustomStyple, id };
                // uICustom.ClickBotton(_objects);
                uICustom.ClickBotton(eCustomStyple, id,isZDYPart);
            }
        }
        // Update is called once per frame
        void Update()
        {

        }
    }
}
