This commit is contained in:
liuliang 2024-12-29 21:17:23 +08:00
commit c1a3db87c7
4 changed files with 11880 additions and 10342 deletions

View File

@ -5384,7 +5384,7 @@ MonoBehaviour:
m_SelectOnDown: {fileID: 0} m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0} m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0} m_SelectOnRight: {fileID: 0}
m_Transition: 1 m_Transition: 0
m_Colors: m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,12 @@ public class CheckpointsBox : MonoBehaviour
_modePanel.mode1 += async () => _modePanel.mode1 += async () =>
{ {
if (_text.text == temp)
{
return;
}
_text.text = ""; _text.text = "";
await RotationObj(OBJ); await RotationObj(OBJ);
await TypeWriterEffect(temp); await TypeWriterEffect(temp);
@ -26,9 +32,14 @@ public class CheckpointsBox : MonoBehaviour
_modePanel.mode2 += async () => _modePanel.mode2 += async () =>
{ {
if (_text.text== temp + "(¾«Ó¢)")
{
return;
}
_text.text = ""; _text.text = "";
await RotationObj(OBJ); await RotationObj(OBJ);
await TypeWriterEffect(temp + "(¾«Ó¢)"); await TypeWriterEffect(temp +"(¾«Ó¢)");
}; };
} }

View File

@ -30,17 +30,28 @@ public class ModePanel : MonoBehaviour
{ {
btn1.onClick.AddListener(() => btn1.onClick.AddListener(() =>
{ {
// 禁用按钮,防止重复点击
btn1.interactable = false;
btn2.interactable = false;
mode1?.Invoke(); mode1?.Invoke();
MoveToTarget(obj, btn1.GetComponent<RectTransform>().position, speed * 100, btn2, btn1); MoveToTarget(obj, btn1.GetComponent<RectTransform>().position, speed * 100, btn2, btn1);
}); });
btn2.onClick.AddListener(() => btn2.onClick.AddListener(() =>
{ {
// 禁用按钮,防止重复点击
btn2.interactable = false;
btn2.interactable = false;
mode2?.Invoke(); mode2?.Invoke();
MoveToTarget(obj, btn2.GetComponent<RectTransform>().position, speed * 100, btn1, btn2); MoveToTarget(obj, btn2.GetComponent<RectTransform>().position, speed * 100, btn1, btn2);
}); });
} }
// 让物体滑动到目标位置,并同步更新按钮文本颜色 // 让物体滑动到目标位置,并同步更新按钮文本颜色
void MoveToTarget(GameObject obj, Vector3 targetPosition, float speed, Button btnToDisable, Button btnToEnable) void MoveToTarget(GameObject obj, Vector3 targetPosition, float speed, Button btnToDisable, Button btnToEnable)
{ {
@ -75,6 +86,14 @@ public class ModePanel : MonoBehaviour
btnToEnable.GetComponent<Text>().color = Color.Lerp(textColor2, textColor1, progress); btnToEnable.GetComponent<Text>().color = Color.Lerp(textColor2, textColor1, progress);
} }
}); });
// 动画完成后启用按钮
moveTween.OnComplete(async () =>
{
await Task.Delay(500);
btn1.interactable = true; // 恢复按钮的交互性
btn2.interactable = true; // 恢复按钮的交互性
});
} }
else if (obj.GetComponent<Transform>() != null) else if (obj.GetComponent<Transform>() != null)
{ {
@ -106,6 +125,14 @@ public class ModePanel : MonoBehaviour
btnToEnable.GetComponent<Text>().color = Color.Lerp(textColor2, textColor1, progress); btnToEnable.GetComponent<Text>().color = Color.Lerp(textColor2, textColor1, progress);
} }
}); });
// 动画完成后启用按钮
moveTween.OnComplete(async () =>
{
await Task.Delay(500);
btn1.interactable = true; // 恢复按钮的交互性
btn2.interactable = true; // 恢复按钮的交互性
});
} }
} }
} }