修复判定线问题
This commit is contained in:
@@ -50,6 +50,15 @@ public class TrackTouchInput : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// 【多点触控根因修复】若 multiTouchEnabled 为 false,Input.touchCount 永远 ≤1,
|
||||
// 同时按多条轨道时只会报告一个触点 → 只能触发一个轨道。强制开启多点触控。
|
||||
// simulateMouseWithTouches 关掉:避免触摸被合成成鼠标事件,与真实多指冲突。
|
||||
Input.multiTouchEnabled = true;
|
||||
Input.simulateMouseWithTouches = false;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var im = InputManager.Instance;
|
||||
|
||||
@@ -36,10 +36,43 @@ public sealed class StartupSettingsApplier : MonoBehaviour
|
||||
private void ApplyStartupSettings()
|
||||
{
|
||||
ApplyAndroidLandscapeOrientation();
|
||||
ApplyStartupFrameRate();
|
||||
graphicSettings.ApplySavedDisplaySettingsAtStartup(this);
|
||||
ApplySavedAudioSettings();
|
||||
}
|
||||
|
||||
// 启动即应用帧率。原本 targetFrameRate 只在设置面板 graphicSettings.Start() 里设置,
|
||||
// 而设置面板不在启动/gameplay 场景中,导致移动端启动后一直停在 Unity 默认 30fps —
|
||||
// 触摸每帧才采样一次(~33ms),表现为点击延迟大、快速连点丢按键。
|
||||
// 这里在启动时读取与设置面板相同的 PlayerPrefs(frameRateIndex),无存档时默认 90,
|
||||
// 让帧率从进游戏起就正确,且玩家改过的设置下次启动立即生效。不改变原有设置逻辑。
|
||||
private void ApplyStartupFrameRate()
|
||||
{
|
||||
int[] fpsValues = { 24, 30, 60, 90, 120, 144, 165, 210, 240, 300 };
|
||||
int index = PlayerPrefs.GetInt("frameRateIndex", -999);
|
||||
|
||||
if (index < 0 || index > fpsValues.Length + 1)
|
||||
{
|
||||
index = 3; // 默认 90,与 graphicSettings 设置面板一致
|
||||
}
|
||||
|
||||
if (index < fpsValues.Length)
|
||||
{
|
||||
QualitySettings.vSyncCount = 0;
|
||||
Application.targetFrameRate = fpsValues[index];
|
||||
}
|
||||
else if (index == fpsValues.Length)
|
||||
{
|
||||
QualitySettings.vSyncCount = 0;
|
||||
Application.targetFrameRate = -1; // 无限制
|
||||
}
|
||||
else
|
||||
{
|
||||
QualitySettings.vSyncCount = 1; // 垂直同步
|
||||
Application.targetFrameRate = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyAndroidLandscapeOrientation()
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
|
||||
Reference in New Issue
Block a user