Merge remote-tracking branch 'origin/feature/demo脚本调整' into 7.11春优化
This commit is contained in:
@@ -49,7 +49,7 @@ namespace AibisDream
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
_handler.Handle(_curSyncToken, IsInputAvailable);
|
||||
_handler.Handle(_curSyncToken, IsInputAvailable, IsPointerOverUI);
|
||||
}
|
||||
|
||||
public void SwitchAdvanceHandler(AdvanceModeEnum advanceMode)
|
||||
@@ -77,12 +77,18 @@ namespace AibisDream
|
||||
&& _curSyncToken.state != LineSyncState.Advanced;
|
||||
}
|
||||
|
||||
private bool IsPointerOverUI()
|
||||
{
|
||||
return UIManager.Instance != null
|
||||
&& UIManager.Instance.IsPointerOverUI(Input.mousePosition);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public interface ILineAdvanceHandler
|
||||
{
|
||||
void Handle(LineSyncToken token, Func<bool> isAvailable);
|
||||
void Handle(LineSyncToken token, Func<bool> isAvailable, Func<bool> isPointerOverUI);
|
||||
|
||||
static ILineAdvanceHandler Create(bool autoMode)
|
||||
{
|
||||
@@ -92,9 +98,12 @@ namespace AibisDream
|
||||
|
||||
public class DefaultAdvanceHandler : ILineAdvanceHandler
|
||||
{
|
||||
public void Handle(LineSyncToken token, Func<bool> isAvailable)
|
||||
public void Handle(LineSyncToken token, Func<bool> isAvailable, Func<bool> isPointerOverUI)
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.Space))
|
||||
var pointerAdvance = Input.GetMouseButtonDown(0) && !isPointerOverUI();
|
||||
var keyboardAdvance = Input.GetKeyDown(KeyCode.Space);
|
||||
|
||||
if (pointerAdvance || keyboardAdvance)
|
||||
{
|
||||
if (isAvailable())
|
||||
{
|
||||
@@ -122,7 +131,7 @@ namespace AibisDream
|
||||
|
||||
public class AutoAdvanceHandler : ILineAdvanceHandler
|
||||
{
|
||||
public void Handle(LineSyncToken token, Func<bool> isAvailable)
|
||||
public void Handle(LineSyncToken token, Func<bool> isAvailable, Func<bool> isPointerOverUI)
|
||||
{
|
||||
if (!isAvailable())
|
||||
{
|
||||
@@ -136,7 +145,10 @@ namespace AibisDream
|
||||
return;
|
||||
}
|
||||
|
||||
if (Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.Space))
|
||||
var pointerAdvance = Input.GetMouseButtonDown(0) && !isPointerOverUI();
|
||||
var keyboardAdvance = Input.GetKeyDown(KeyCode.Space);
|
||||
|
||||
if (pointerAdvance || keyboardAdvance)
|
||||
{
|
||||
HandleInput(token);
|
||||
}
|
||||
@@ -161,7 +173,7 @@ namespace AibisDream
|
||||
|
||||
public class QuickAdvanceHandler : ILineAdvanceHandler
|
||||
{
|
||||
public void Handle(LineSyncToken token, Func<bool> isAvailable)
|
||||
public void Handle(LineSyncToken token, Func<bool> isAvailable, Func<bool> isPointerOverUI)
|
||||
{
|
||||
if (!isAvailable())
|
||||
{
|
||||
@@ -180,4 +192,4 @@ namespace AibisDream
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user