任务栏的按钮调整

This commit is contained in:
huyulong 2024-12-09 09:46:52 +08:00
parent 957e7cc035
commit e4c0491f53
3 changed files with 13 additions and 3 deletions

View File

@ -50,12 +50,14 @@ public class TaskPanel : Base
{ {
// 恢复按钮到原位置 // 恢复按钮到原位置
buttonRect.DOAnchorPosX(showPositionX, moveDuration).SetEase(Ease.InOutCubic); buttonRect.DOAnchorPosX(showPositionX, moveDuration).SetEase(Ease.InOutCubic);
hideBtn.transform.Rotate(0, 0, 180f);
isHidden = false; // 更新状态为未隐藏 isHidden = false; // 更新状态为未隐藏
} }
else else
{ {
// 隐藏按钮 // 隐藏按钮
buttonRect.DOAnchorPosX(hidePositionX, moveDuration).SetEase(Ease.InOutCubic); buttonRect.DOAnchorPosX(hidePositionX, moveDuration).SetEase(Ease.InOutCubic);
hideBtn.transform.Rotate(0, 0, 180f);
isHidden = true; // 更新状态为隐藏 isHidden = true; // 更新状态为隐藏
} }
} }

View File

@ -6865,7 +6865,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0.5} m_AnchorMin: {x: 1, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: -198, y: 24.961} m_AnchoredPosition: {x: -198, y: 221}
m_SizeDelta: {x: 405.7333, y: 341.73} m_SizeDelta: {x: 405.7333, y: 341.73}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &814718672 --- !u!114 &814718672

View File

@ -12,6 +12,8 @@ public enum Npcstate
public class RecuseNpc : MonoBehaviour public class RecuseNpc : MonoBehaviour
{ {
public static RecuseNpc instance;
private Button recusebtn; private Button recusebtn;
private bool statebool = false; private bool statebool = false;
@ -24,6 +26,7 @@ public class RecuseNpc : MonoBehaviour
public Transform target; public Transform target;
private void Awake() private void Awake()
{ {
instance = this;
recusebtn = GameObject.Find("Canvas/Recuse").GetComponent<Button>(); recusebtn = GameObject.Find("Canvas/Recuse").GetComponent<Button>();
anim = this.GetComponent<Animator>(); anim = this.GetComponent<Animator>();
@ -51,6 +54,11 @@ public class RecuseNpc : MonoBehaviour
Debug.Log("Setnpcstate调用"); Debug.Log("Setnpcstate调用");
} }
public void SetNpcDes(Transform tar)
{
target = tar;
}
private void Update() private void Update()
{ {
if (Vector3.Distance(transform.position,target.position) < 1.3f && movebool && target.transform.position != null)//判断人物被救援后移动到目标位置 if (Vector3.Distance(transform.position,target.position) < 1.3f && movebool && target.transform.position != null)//判断人物被救援后移动到目标位置