UICustomNor.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. private float tweenTime = 0.5f;
  20. // Start is called before the first frame update
  21. void Start()
  22. {
  23. Button btn =gameObject.GetComponent<Button>();
  24. btn.onClick.AddListener(ClickBotton);
  25. }
  26. public void ClickBotton()
  27. {
  28. if (uICustom.isTween)
  29. {
  30. return;
  31. }
  32. uICustom.isTween = true;
  33. uICustom.leftView.transform.DOLocalMoveX(uICustom.tween_leftMin, tweenTime).SetEase(Ease.InOutBack).OnComplete(() => {
  34. // ClickBtnFun(_objects);
  35. objDisAppear.ForEach(i => i.SetActive(false));
  36. objAppear.ForEach(i => i.SetActive(true));
  37. uICustom.leftView.transform.DOLocalMoveX(0, tweenTime).SetEase(Ease.InOutBack).OnComplete(() => {
  38. uICustom.isTween = false;
  39. uICustom.HistoryAdd("firstpush");
  40. Debug.Log("222");
  41. });
  42. });
  43. Debug.Log("333");
  44. uICustom.rightView.transform.DOLocalMoveX(uICustom.tween_rightMax, tweenTime).SetEase(Ease.InOutBack).OnComplete(() => {
  45. uICustom.rightView.transform.DOLocalMoveX(0, tweenTime).SetEase(Ease.InOutBack).OnComplete(() => {
  46. });
  47. });
  48. }
  49. void CustomBtnFun() {
  50. }
  51. // Update is called once per frame
  52. void Update()
  53. {
  54. }
  55. }
  56. }