You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
778 B
46 lines
778 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using DG.Tweening;
|
|
public class MoveUI : MonoBehaviour
|
|
{
|
|
|
|
[Header("ui初始位置和目标位置")]
|
|
[SerializeField] private Vector3 endpos;
|
|
private Vector3 startpos;
|
|
void Start()
|
|
{
|
|
startpos = transform.localPosition;
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 放出
|
|
/// </summary>
|
|
public void Release()
|
|
{
|
|
UImove(startpos);
|
|
|
|
}
|
|
/// <summary>
|
|
/// 收起
|
|
/// </summary>
|
|
public void Collapse()
|
|
{
|
|
UImove(endpos);
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 实现UI移入移出
|
|
/// </summary>
|
|
/// <param name="pos">目标位置</param>
|
|
public void UImove(Vector3 pos)
|
|
{
|
|
transform.DOLocalMove(pos, 1);
|
|
}
|
|
|
|
}
|