指针
This commit is contained in:
@@ -14,15 +14,14 @@ namespace AibisDream
|
||||
{
|
||||
private const float DelayTime = 0.1f;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject border;
|
||||
|
||||
[SerializeField] private GameObject border;
|
||||
|
||||
[Header("指针图片")] public Sprite defaultCursor;
|
||||
public Sprite nextTalk, talking, option, interactive, holding, disable;
|
||||
|
||||
private Image _cursor;
|
||||
private GraphicRaycaster _raycaster;
|
||||
|
||||
|
||||
private Sprite _curCursor;
|
||||
private CursorState _stateCache;
|
||||
|
||||
@@ -113,10 +112,10 @@ namespace AibisDream
|
||||
private void OnGameQuit()
|
||||
{
|
||||
_curCursor = defaultCursor;
|
||||
|
||||
|
||||
_curState = CursorState.Default;
|
||||
_stateCache = CursorState.Default;
|
||||
|
||||
|
||||
_isInGame = false;
|
||||
}
|
||||
|
||||
@@ -165,7 +164,7 @@ namespace AibisDream
|
||||
{
|
||||
if (!_isInGame) return;
|
||||
if (!Input.GetMouseButtonDown(0) && !Input.GetKeyDown(KeyCode.Space)) return;
|
||||
|
||||
|
||||
// 控制对话
|
||||
if (_isTalking)
|
||||
{
|
||||
@@ -179,15 +178,15 @@ namespace AibisDream
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
var eventData = new PointerEventData(EventSystem.current)
|
||||
{
|
||||
position = Input.mousePosition
|
||||
};
|
||||
|
||||
|
||||
var results = new List<RaycastResult>();
|
||||
_raycaster.Raycast(eventData, results);
|
||||
|
||||
|
||||
return results.Count > 0 && results.Any(result => result.gameObject.CompareTag("Selectable"));
|
||||
}
|
||||
|
||||
@@ -247,6 +246,10 @@ namespace AibisDream
|
||||
{
|
||||
SwitchCursor(interactive);
|
||||
}
|
||||
else
|
||||
{
|
||||
SwitchCursor(defaultCursor);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnInteractiveEnd()
|
||||
|
||||
Reference in New Issue
Block a user