fix:1、添加兑换code界面。2、更改单双指的禁用和开启(打开其他界面时)
This commit is contained in:
@@ -172,8 +172,59 @@ namespace ChillConnect
|
||||
return new Vector2(x, y);
|
||||
}
|
||||
|
||||
#region 全局计数式开关
|
||||
// 全局开关(true: 恢复输入 false:禁用输入)
|
||||
private void OpenOrStopGameInput(object obj = null)
|
||||
{
|
||||
if (obj != null && !(bool)obj)
|
||||
{
|
||||
// 禁用输入
|
||||
DisableGameInput();
|
||||
}
|
||||
else
|
||||
{
|
||||
// 恢复输入
|
||||
EnableGameInput();
|
||||
}
|
||||
}
|
||||
|
||||
private int _inputDisableCount = 0;
|
||||
// 禁用输入
|
||||
private void DisableGameInput()
|
||||
{
|
||||
_inputDisableCount++;
|
||||
// 只有第一次禁用时执行清理
|
||||
if (_inputDisableCount == 1)
|
||||
{
|
||||
if (_viewContainer != null)
|
||||
_viewContainer.touchable = false;
|
||||
|
||||
_isDraging = false;
|
||||
_isTwoFingerTouch = false;
|
||||
_lastTouchPos = Vector2.zero;
|
||||
}
|
||||
}
|
||||
|
||||
// 恢复输入
|
||||
private void EnableGameInput(object obj = null)
|
||||
{
|
||||
_inputDisableCount = Mathf.Max(0, _inputDisableCount - 1);
|
||||
// 计数归0时才真正恢复
|
||||
if (_inputDisableCount == 0)
|
||||
{
|
||||
if (_viewContainer != null)
|
||||
_viewContainer.touchable = true;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public override void OnUpdate()
|
||||
{
|
||||
// Update 里判断改为:
|
||||
if (_inputDisableCount > 0)
|
||||
return;
|
||||
|
||||
// 初始化未完成,直接跳过拖拽
|
||||
if (!_initComplete)
|
||||
return;
|
||||
@@ -333,6 +384,7 @@ namespace ChillConnect
|
||||
GameDispatcher.Instance.AddListener(GameMsg.ThemeChange, SetModel);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.UpdateSpeed, SetSpeed);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.UseProps, SetUserPorp);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.StopArrowTouch,OpenOrStopGameInput);
|
||||
|
||||
}
|
||||
|
||||
@@ -344,6 +396,7 @@ namespace ChillConnect
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.ThemeChange, SetModel);
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.UpdateSpeed, SetSpeed);
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.UseProps, SetUserPorp);
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.StopArrowTouch, OpenOrStopGameInput);
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user