Refactor scripts: dedup remainder, remove dead code, perf hardening
Iteration 4 over Assets/Scripts (no component/file splits, no Unity assets touched): Dedup: - Route inline cursor-release, material guards, Ctrl-held and undo/redo input through existing InputUtil / SetMatFloat helpers - Add ungated InputUtil.KeyPressedThisFrame; GameplayKeyPressed builds on it - Unify FindDeep/FindDeepChild into GeometryUtil.FindDeep Dead code / stale docs: - Remove unused code-gen bake path (HsvColorPicker.Build, PaintHud factory) - Drop unreferenced symbols (SubPhaseChanged event, LocalPhaseDuration, IsLocalSceneMain, MouseSensitivity.Changed, IsPaused, InSession, NetworkControlled, PreviousPose, JointCount, voxel-count accessors) - Fix incorrect PlayerRole / PaintHud / Pick / PlayerPose docs Perf / robustness (behaviour-neutral): - ConcealmentMeter.Evaluate: reuse vertex/topology buffers, two-pointer crossing count - BuildMeshCaches: alloc-free vertex copy, cached topology/UVs - Guard all PlayerPaintSync LogSync sites behind logSync - Cache LocalViewerIsHunter / controller / CanShoot / TypingGuard lookups; dedup LocalIsHunter with MatchHud - Change-guard RefreshEmissionColor and HeroCutout.Disarm - Cache scene/countdown string comparisons per frame - Grow NonAlloc buffers and log-once on saturation Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
2243cc823e
commit
382bfb36df
32 files changed
+292
-348
No files matched your search
+14
-16
@@ -4,9 +4,7 @@ using UnityEngine.InputSystem;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Shared low-level input reads that were previously copy-pasted verbatim across the camera rigs
|
||||
/// (<see cref="FirstPersonController"/>, <see cref="FreeCamController"/>,
|
||||
/// <see cref="ThirdPersonOrbitInput"/>), the paint controller and the first-person shoot mode. Each
|
||||
/// Shared low-level input reads used by the camera rigs, the paint controller and the modes. Each
|
||||
/// method preserves its original per-backend behaviour (new Input System when present, legacy Input
|
||||
/// Manager otherwise). Sensitivity scaling stays at the call sites.
|
||||
/// </summary>
|
||||
@@ -105,20 +103,20 @@ public static class InputUtil
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>Gameplay key pressed on this exact frame (edge), suppressed while a UI text field is
|
||||
/// focused so typing never triggers gameplay bindings. The parameter type follows the active input
|
||||
/// backend, matching how the callers' serialized key fields are declared.</summary>
|
||||
/// <summary>Key pressed on this exact frame (edge), regardless of UI focus. The parameter type
|
||||
/// follows the active input backend, matching how the callers' serialized key fields are declared.</summary>
|
||||
#if ENABLE_INPUT_SYSTEM
|
||||
public static bool GameplayKeyPressed(Key key)
|
||||
{
|
||||
if (TypingGuard.IsTyping) return false;
|
||||
return Keyboard.current != null && Keyboard.current[key].wasPressedThisFrame;
|
||||
}
|
||||
public static bool KeyPressedThisFrame(Key key)
|
||||
=> Keyboard.current != null && Keyboard.current[key].wasPressedThisFrame;
|
||||
#else
|
||||
public static bool GameplayKeyPressed(KeyCode key)
|
||||
{
|
||||
if (TypingGuard.IsTyping) return false;
|
||||
return Input.GetKeyDown(key);
|
||||
}
|
||||
public static bool KeyPressedThisFrame(KeyCode key) => Input.GetKeyDown(key);
|
||||
#endif
|
||||
|
||||
/// <summary>Gameplay key pressed on this exact frame (edge), suppressed while a UI text field is
|
||||
/// focused so typing never triggers gameplay bindings.</summary>
|
||||
#if ENABLE_INPUT_SYSTEM
|
||||
public static bool GameplayKeyPressed(Key key) => !TypingGuard.IsTyping && KeyPressedThisFrame(key);
|
||||
#else
|
||||
public static bool GameplayKeyPressed(KeyCode key) => !TypingGuard.IsTyping && KeyPressedThisFrame(key);
|
||||
#endif
|
||||
}
|
||||
Reference in new issue
Block a user