UICustomNor.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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,uICustom.slowUIMoveTime).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, uICustom.slowUIMoveTime).SetEase(Ease.InOutBack).OnComplete(() => {
  37. uICustom.isTween = false;
  38. uICustom.HistoryAdd("firstpush");
  39. Debug.Log("222");
  40. });
  41. });
  42. Debug.Log("333");
  43. uICustom.rightView.transform.DOLocalMoveX(uICustom.tween_rightMax, uICustom.slowUIMoveTime).SetEase(Ease.InOutBack).OnComplete(() => {
  44. uICustom.rightView.transform.DOLocalMoveX(0, uICustom.slowUIMoveTime).SetEase(Ease.InOutBack).OnComplete(() => {
  45. });
  46. });
  47. }
  48. void CustomBtnFun() {
  49. }
  50. // Update is called once per frame
  51. void Update()
  52. {
  53. }
  54. }
  55. }