UICustomNor.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using DG.Tweening;
  6. namespace MetaClient
  7. {
  8. public class UICustomNor : MonoBehaviour
  9. {
  10. //[Header("左边界面")]
  11. //public GameObject leftView;
  12. //[Header("右边界面")]
  13. //public GameObject rightView;
  14. public UICustom uICustom;
  15. [Header("出现对象")]
  16. public List<GameObject> objAppear;
  17. [Header("消失对象")]
  18. public List<GameObject> objDisAppear;
  19. // Start is called before the first frame update
  20. void Start()
  21. {
  22. Button btn =gameObject.GetComponent<Button>();
  23. btn.onClick.AddListener(ClickBotton);
  24. }
  25. public void ClickBotton()
  26. {
  27. if (uICustom.isTween)
  28. {
  29. return;
  30. }
  31. uICustom.isTween = true;
  32. uICustom.leftView.transform.DOLocalMoveX(uICustom.tween_leftMin, 2f).SetEase(Ease.InOutBack).OnComplete(() => {
  33. // ClickBtnFun(_objects);
  34. objDisAppear.ForEach(i => i.SetActive(false));
  35. objAppear.ForEach(i => i.SetActive(true));
  36. uICustom.leftView.transform.DOLocalMoveX(0, 2f).SetEase(Ease.InOutBack).OnComplete(() => {
  37. uICustom.isTween = false;
  38. Debug.Log("222");
  39. });
  40. });
  41. Debug.Log("333");
  42. uICustom.rightView.transform.DOLocalMoveX(uICustom.tween_rightMax, 2f).SetEase(Ease.InOutBack).OnComplete(() => {
  43. uICustom.rightView.transform.DOLocalMoveX(0, 2f).SetEase(Ease.InOutBack).OnComplete(() => {
  44. });
  45. });
  46. }
  47. void CustomBtnFun() {
  48. }
  49. // Update is called once per frame
  50. void Update()
  51. {
  52. }
  53. }
  54. }