fix: resolve Next/Previous step and UI skipping bugs
This commit is contained in:
@@ -16,7 +16,6 @@ public class TouchPositionHandler : MonoBehaviour
|
||||
private void Start()
|
||||
{
|
||||
_meshRenderer = GetComponent<MeshRenderer>();
|
||||
StartCoroutine(BlinkMesh());
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
@@ -32,19 +31,29 @@ public class TouchPositionHandler : MonoBehaviour
|
||||
var c = mat.GetColor("_MainColor");
|
||||
c.a = 0f;
|
||||
mat.SetColor("_MainColor", c);
|
||||
|
||||
// 同步赋值统一的描边宽度,否则可能会太细导致看不见闪动
|
||||
if (mat.HasProperty("_OutlineWidth"))
|
||||
{
|
||||
mat.SetFloat("_OutlineWidth", OutlineConfig.Width);
|
||||
}
|
||||
}
|
||||
}
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(BlinkMesh());
|
||||
}
|
||||
|
||||
private System.Collections.IEnumerator BlinkMesh()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if (_meshRenderer != null) _meshRenderer.enabled = !_meshRenderer.enabled;
|
||||
yield return new WaitForSeconds(0.4f);
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
public bool CanBeClicked()
|
||||
{
|
||||
return gameObject.activeInHierarchy && _meshRenderer != null && _meshRenderer.enabled;
|
||||
}
|
||||
|
||||
public void PerformClick()
|
||||
{
|
||||
OnMouseDown();
|
||||
}
|
||||
|
||||
private void OnMouseDown()
|
||||
@@ -92,7 +101,6 @@ public class TouchPositionHandler : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
StopAllCoroutines();
|
||||
if (_meshRenderer != null) _meshRenderer.enabled = false;
|
||||
|
||||
gameObject.SetActive(false);
|
||||
|
||||
Reference in New Issue
Block a user