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:
adminandClaude Opus 4.8 committed 2026-07-02 13:33:18 +02:00
1 parent 2243cc823e
commit 382bfb36df
32 files changed
+292 -348

No files matched your search

+15 -4
View File
@@ -1,3 +1,4 @@
using UnityEngine;
using UnityEngine.EventSystems;
using TMPro;
@@ -9,6 +10,12 @@ using TMPro;
/// </summary>
public static class TypingGuard
{
// Consulted several times per frame by the hotkey readers; the GetComponent lookups are cached
// per selected GameObject (a selection change refreshes them).
private static GameObject _cachedGo;
private static TMP_InputField _cachedTmp;
private static UnityEngine.UI.InputField _cachedLegacy;
/// <summary>A text input field is currently focused and capturing keystrokes.</summary>
public static bool IsTyping
{
@@ -20,11 +27,15 @@ public static class TypingGuard
var go = es.currentSelectedGameObject;
if (!go) return false;
var tmp = go.GetComponent<TMP_InputField>();
if (tmp) return tmp.isFocused;
if (go != _cachedGo)
{
_cachedGo = go;
_cachedTmp = go.GetComponent<TMP_InputField>();
_cachedLegacy = _cachedTmp ? null : go.GetComponent<UnityEngine.UI.InputField>();
}
var legacy = go.GetComponent<UnityEngine.UI.InputField>();
return legacy && legacy.isFocused;
if (_cachedTmp) return _cachedTmp.isFocused;
return _cachedLegacy && _cachedLegacy.isFocused;
}
}
}