UICustomNor.cs 2.1 KB

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