UICustomNor.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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" + eCustomStyple);
  44. });
  45. });
  46. CustomManager.Instance.ChangeCustomCamera(eCustomStyple);
  47. Debug.Log("333");
  48. uICustom.rightView.transform.DOLocalMoveX(uICustom.tween_rightMax, tweenTime).SetEase(Ease.InOutBack).OnComplete(() => {
  49. uICustom.rightView.transform.DOLocalMoveX(0, tweenTime).SetEase(Ease.InOutBack).OnComplete(() => {
  50. });
  51. });
  52. }
  53. void CustomBtnFun() {
  54. }
  55. // Update is called once per frame
  56. void Update()
  57. {
  58. }
  59. }
  60. }