(client) feat:实现摄像机跟踪与移动,实现任意位置生成实体,实现更安全的资源加载方式(指定unity内部加载资源) (#42)
Co-authored-by: zzdxxz <2079238449@qq.com> Co-committed-by: zzdxxz <2079238449@qq.com>
This commit is contained in:
36
Client/Assets/Scripts/UI/EntityPlacementUI.cs
Normal file
36
Client/Assets/Scripts/UI/EntityPlacementUI.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using Base;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
|
||||
public delegate void NonReturnCallback();
|
||||
public class EntityPlacementUI:UIBase,ITickUI
|
||||
{
|
||||
public TMP_Text promptText;
|
||||
|
||||
public NonReturnCallback currentAction;
|
||||
|
||||
public string Prompt
|
||||
{
|
||||
get => promptText.text;
|
||||
set => promptText.text = value;
|
||||
}
|
||||
public void TickUI()
|
||||
{
|
||||
if (!IsVisible)
|
||||
return;
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
{
|
||||
Base.UIInputControl.Instance.Hide(this);
|
||||
}
|
||||
if (currentAction!=null&&Input.GetMouseButtonDown(0))
|
||||
{
|
||||
currentAction();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user