2025-07-31 17:45:50 +08:00
|
|
|
using Base;
|
2025-08-04 13:26:04 +08:00
|
|
|
using TMPro;
|
2025-07-31 17:45:50 +08:00
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.Events;
|
|
|
|
|
|
|
|
namespace UI
|
|
|
|
{
|
2025-08-04 13:26:04 +08:00
|
|
|
|
|
|
|
public delegate void NonReturnCallback();
|
2025-07-31 17:45:50 +08:00
|
|
|
public class EntityPlacementUI:UIBase,ITickUI
|
|
|
|
{
|
2025-08-04 13:26:04 +08:00
|
|
|
public TMP_Text promptText;
|
|
|
|
|
|
|
|
public NonReturnCallback currentAction;
|
|
|
|
|
|
|
|
public string Prompt
|
|
|
|
{
|
|
|
|
get => promptText.text;
|
|
|
|
set => promptText.text = value;
|
|
|
|
}
|
2025-07-31 17:45:50 +08:00
|
|
|
public void TickUI()
|
|
|
|
{
|
2025-08-04 13:26:04 +08:00
|
|
|
if (!IsVisible)
|
2025-07-31 17:45:50 +08:00
|
|
|
return;
|
2025-08-04 13:26:04 +08:00
|
|
|
if (Input.GetKeyDown(KeyCode.Escape))
|
2025-07-31 17:45:50 +08:00
|
|
|
{
|
2025-08-04 13:26:04 +08:00
|
|
|
Base.UIInputControl.Instance.Hide(this);
|
2025-07-31 17:45:50 +08:00
|
|
|
}
|
2025-08-04 13:26:04 +08:00
|
|
|
if (currentAction!=null&&Input.GetMouseButtonDown(0))
|
2025-07-31 17:45:50 +08:00
|
|
|
{
|
2025-08-04 13:26:04 +08:00
|
|
|
currentAction();
|
2025-07-31 17:45:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|