using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;
namespace MetaClient
{
    public class UICustomNor : MonoBehaviour
    {
        //[Header("左边界面")]
        //public GameObject leftView;

        //[Header("右边界面")]
        //public GameObject rightView;

        public UICustom uICustom;
        [Header("出现对象")]
        public List<GameObject> objAppear;
        [Header("消失对象")]
        public List<GameObject> objDisAppear;

        private float tweenTime = 0.5f;

        // Start is called before the first frame update
        void Start()
        {
            Button btn =gameObject.GetComponent<Button>();
            btn.onClick.AddListener(ClickBotton);
        }
        public void ClickBotton()
        {
            if (uICustom.isTween)
            {
                return;
            }
            uICustom.isTween = true;
            uICustom.leftView.transform.DOLocalMoveX(uICustom.tween_leftMin, tweenTime).SetEase(Ease.InOutBack).OnComplete(() => {
                //  ClickBtnFun(_objects);
                objDisAppear.ForEach(i => i.SetActive(false));
                objAppear.ForEach(i => i.SetActive(true));
                uICustom.leftView.transform.DOLocalMoveX(0, tweenTime).SetEase(Ease.InOutBack).OnComplete(() => {
                    uICustom.isTween = false;
                    uICustom.HistoryAdd("firstpush");
                    Debug.Log("222");
                });
            });
            Debug.Log("333");
            uICustom.rightView.transform.DOLocalMoveX(uICustom.tween_rightMax, tweenTime).SetEase(Ease.InOutBack).OnComplete(() => {
                uICustom.rightView.transform.DOLocalMoveX(0, tweenTime).SetEase(Ease.InOutBack).OnComplete(() => {
                });
            });

        }

        void CustomBtnFun() {

        }


        // Update is called once per frame
        void Update()
        {

        }
    }
}
