(client) feat:实现指定位置生成实体
This commit is contained in:
@ -1,24 +1,34 @@
|
||||
using Base;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
|
||||
public delegate void NonReturnCallback();
|
||||
public class EntityPlacementUI:UIBase,ITickUI
|
||||
{
|
||||
public UnityAction currentAction = null;
|
||||
public TMP_Text promptText;
|
||||
|
||||
public NonReturnCallback currentAction;
|
||||
|
||||
public string Prompt
|
||||
{
|
||||
get => promptText.text;
|
||||
set => promptText.text = value;
|
||||
}
|
||||
public void TickUI()
|
||||
{
|
||||
if (!IsVisible||currentAction==null)
|
||||
if (!IsVisible)
|
||||
return;
|
||||
if (Input.GetMouseButton(0))
|
||||
{
|
||||
currentAction.Invoke();
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
{
|
||||
Hide();
|
||||
Base.UIInputControl.Instance.Hide(this);
|
||||
}
|
||||
if (currentAction!=null&&Input.GetMouseButtonDown(0))
|
||||
{
|
||||
currentAction();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user