using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public enum MovingDefenseMode { none, hide, CannotClick } public class UIMoveManager : MonoBehaviour { public RectTransform MovePanel; public Button MoveOut; public Button MoveIn; public MoveDir MoveOutDirction; public MoveDir MoveInDirction; public float MoveTime; public float Offset; public MovingDefenseMode DefenseMode; private UIMove UIMoving; private float timmer; bool click = false; bool MoveOver; void Start() { MoveOut.onClick.AddListener(MoveOut_Click); MoveIn.onClick.AddListener(MoveIn_Click); SetMoving(); } public void SetMoving() { if (!MovePanel.GetComponent()) { UIMoving = MovePanel.gameObject.AddComponent(); UIMoving.SetPos(); } else { UIMoving = MovePanel.gameObject.GetComponent(); } } public void MoveIn_Click() { UIMoving.AnchorMove(MovePanel, MoveTime, MoveInDirction, Offset); switch (DefenseMode) { case MovingDefenseMode.hide: MoveIn.gameObject.SetActive(false); MoveOut.gameObject.SetActive(true); break; case MovingDefenseMode.CannotClick: click = true; MoveIn.GetComponent