Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public void QueueOverlayClear_WithActiveOverlayState_ClearsState()
MouseAction.Click,
new Vector2(10f, 20f),
null,
"Target",
new Vector2(100f, 200f));
MouseUiMainThreadCleanupScheduler scheduler = new();
scheduler.CaptureMainThreadContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,6 @@ public ClearConsoleResponse(bool success, int clearedLogCount, ClearedLogCounts
Message = message ?? string.Empty;
ErrorMessage = string.Empty;
}

/// <summary>
/// Create a new ClearConsoleResponse for failed operation
/// </summary>
public ClearConsoleResponse(string errorMessage)
{
Success = false;
ClearedLogCount = 0;
ClearedCounts = new ClearedLogCounts();
Message = string.Empty;
ErrorMessage = errorMessage ?? string.Empty;
}

/// <summary>
/// Parameterless constructor for JSON deserialization
/// </summary>
public ClearConsoleResponse()
{
ClearedCounts = new ClearedLogCounts();
Message = string.Empty;
ErrorMessage = string.Empty;
}
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,6 @@ public static void NotifyRecordingStopped()
ServiceValue.NotifyRecordingStopped();
}

public static void ForceStop()
{
ServiceValue.ForceStop();
}

internal static string FormatVector2(Vector2 v)
{
return InputRecordingVectorFormat.FormatVector2(v);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ private void ApplyUiPointerActivity(UiReplayFrame replayFrame)
MouseAction.Click,
replayFrame.InputPosition,
null,
_currentPressTarget?.name,
replayFrame.GameViewSize);
SimulateMouseUiOverlayState.RequestExpandAnimation();
return;
Expand All @@ -104,7 +103,6 @@ private void ApplyUiPointerActivity(UiReplayFrame replayFrame)
MouseAction.Click,
replayFrame.InputPosition,
null,
null,
replayFrame.GameViewSize);
}
}
Expand All @@ -122,7 +120,6 @@ private void ApplyUiPointerHold(UiReplayFrame replayFrame)
MouseAction.Drag,
replayFrame.InputPosition,
pressInputPos,
null,
replayFrame.GameViewSize);
return;
}
Expand All @@ -137,7 +134,6 @@ private void ApplyUiPointerHold(UiReplayFrame replayFrame)
MouseAction.LongPress,
replayFrame.InputPosition,
null,
_currentPressTarget?.name,
replayFrame.GameViewSize);
SimulateMouseUiOverlayState.UpdateLongPressElapsed(elapsed);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ internal static class UiRaycastHelper
return context.Raycast(screenPosition);
}

// Bypass EventSystem's Screen-bounds clipping by directly testing Graphic rects in Canvas space.
// Only supports ScreenSpaceOverlay canvases where world positions equal Canvas-space positions.
public static RaycastResult? RaycastCanvasSpace(Vector2 canvasPosition)
{
List<CanvasRaycastSource> canvasRaycastSources = CollectCanvasRaycastSources();
return RaycastCanvasSpaceFromSources(canvasPosition, canvasRaycastSources);
}

private static List<CanvasRaycastSource> CollectCanvasRaycastSources()
{
#if UNITY_6000_4_OR_NEWER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Text.RegularExpressions;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;

using io.github.hatayama.UnityCliLoop.ToolContracts;

Expand All @@ -18,88 +17,6 @@ public class AssemblyDefinitionDuplicationValidationService
private static readonly Regex AsmdefNameRegex =
new("\"name\"\\s*:\\s*\"(?<name>[^\"]+)\"", RegexOptions.Compiled);

private static readonly Regex DuplicateAsmdefConsoleRegex = new(
"^Assembly with name '(?<name>[^']+)' already exists \\((?<path>[^)]+)\\)$",
RegexOptions.Compiled
);

public ValidationResult ValidateNoDuplicateAsmdefNamesFromConsoleErrors()
{
LogRetrievalService retrievalService = new();
LogDisplayDto logData = retrievalService.GetLogsWithSearch(
UnityCliLoopLogType.Error,
"Assembly with name '",
useRegex: false,
searchInStackTrace: false
);

Dictionary<string, List<string>> pathsByAsmName = new(StringComparer.Ordinal);

foreach (LogEntryDto entry in logData.LogEntries)
{
if (string.IsNullOrEmpty(entry.Message))
{
continue;
}

Match match = DuplicateAsmdefConsoleRegex.Match(entry.Message.Trim());
if (!match.Success)
{
continue;
}

string asmName = match.Groups["name"].Value;
string assetPath = match.Groups["path"].Value;
if (string.IsNullOrEmpty(asmName) || string.IsNullOrEmpty(assetPath))
{
continue;
}

// Prevent false positives from stale console logs by verifying the asset still exists.
UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(assetPath);
if (obj == null)
{
continue;
}

if (!pathsByAsmName.TryGetValue(asmName, out List<string> paths))
{
paths = new List<string>();
pathsByAsmName.Add(asmName, paths);
}

if (!paths.Contains(assetPath))
{
paths.Add(assetPath);
}
}

if (pathsByAsmName.Count == 0)
{
return ValidationResult.Success();
}

string details = string.Join(
"\n",
pathsByAsmName
.OrderBy(kvp => kvp.Key, StringComparer.Ordinal)
.Take(5)
.Select(d =>
{
string paths = string.Join("\n ", d.Value.Take(8));
return $"- {d.Key}\n {paths}";
})
);

string message =
$"{UnityCliLoopConstants.ERROR_MESSAGE_DUPLICATE_ASMDEF}\n" +
"Detected from Console errors:\n" +
$"{details}\n" +
"Fix: ensure each .asmdef has a unique \"name\".";

return ValidationResult.Failure(message);
}

public ValidationResult ValidateNoDuplicateAsmdefNames()
{
string[] asmdefGuids = AssetDatabase.FindAssets("t:AssemblyDefinitionAsset");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ namespace io.github.hatayama.UnityCliLoop.FirstPartyTools
public class GameObjectDetails
{
public bool Found { get; set; }
public string ErrorMessage { get; set; }
public GameObject GameObject { get; set; }
public string Name { get; set; }
public string Path { get; set; }
Expand Down
17 changes: 0 additions & 17 deletions Packages/src/Editor/FirstPartyTools/GetLogs/GetLogsResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ public LogEntry(string type, string message, string stackTrace)
Message = message;
StackTrace = stackTrace;
}

/// <summary>
/// Parameterless constructor for JSON deserialization
/// </summary>
public LogEntry()
{
}
}

/// <summary>
Expand Down Expand Up @@ -83,15 +76,5 @@ public GetLogsResponse(int totalCount, int displayedCount, string logType, int m
IncludeStackTrace = includeStackTrace;
Logs = logs ?? Array.Empty<LogEntry>();
}

/// <summary>
/// Parameterless constructor for JSON deserialization
/// </summary>
public GetLogsResponse()
{
LogType = string.Empty;
SearchText = string.Empty;
Logs = Array.Empty<LogEntry>();
}
}
}
12 changes: 0 additions & 12 deletions Packages/src/Editor/FirstPartyTools/RunTests/RunTestsResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,6 @@ public RunTestsResponse(
NoTestsFoundExplanation = noTestsFoundExplanation;
}

/// <summary>
/// Parameterless constructor for JSON deserialization
/// </summary>
public RunTestsResponse()
{
Message = string.Empty;
Status = string.Empty;
NoTestsFoundExplanation = string.Empty;
CompletedAt = string.Empty;
XmlPath = string.Empty;
}

public static RunTestsResponse CreateTestFrameworkUnavailable()
{
return new RunTestsResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ public void UnregisterTransientKey(Key key)
_transientKeys.Remove(key);
}

public void Clear()
{
_heldKeys.Clear();
_transientKeys.Clear();
}

// Keyboard keys are stored as a bitfield, so StateEvent.From captures
// the entire keyboard state. To support simultaneous key holds, we write
// ALL currently held keys into every event — not just the target key.
Expand Down Expand Up @@ -180,11 +174,6 @@ public static void UnregisterTransientKey(Key key)
ServiceValue.UnregisterTransientKey(key);
}

public static void Clear()
{
ServiceValue.Clear();
}

public static IReadOnlyList<Key> ClearTrackedKeys()
{
return ServiceValue.ClearTrackedKeys();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ internal sealed class MouseInputStateService
private Action? _pendingDeltaReset;
private Action? _pendingScrollReset;

public bool IsButtonHeld(RuntimeMouseButton button) => _heldButtons.Contains(button);

public void RegisterPlayModeCallbacks()
{
EditorApplication.playModeStateChanged -= OnPlayModeStateChanged;
Expand Down Expand Up @@ -237,8 +235,6 @@ internal static void InitializeForEditorStartup()
ServiceValue.RegisterPlayModeCallbacks();
}

public static bool IsButtonHeld(RuntimeMouseButton button) => ServiceValue.IsButtonHeld(button);

public static void SetButtonDown(RuntimeMouseButton button)
{
ServiceValue.SetButtonDown(button);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ internal static async Task<SimulateMouseUiResponse> ExecuteDragStart(
if (target == null)
{
SimulateMouseUiOverlayState.Update(
MouseAction.DragStart, inputPos, null, null, Handles.GetMainGameViewSize());
MouseAction.DragStart, inputPos, null, Handles.GetMainGameViewSize());
MouseUiFrameWaitOutcome noTargetExpandOutcome = await MouseUiOverlayAnimator.PlayExpandAnimation(ct).ConfigureAwait(false);
if (noTargetExpandOutcome == MouseUiFrameWaitOutcome.TimedOut)
{
Expand Down Expand Up @@ -102,7 +102,7 @@ internal static async Task<SimulateMouseUiResponse> ExecuteDragStart(

string targetName = target.name;
SimulateMouseUiOverlayState.Update(
MouseAction.DragStart, inputPos, inputPos, targetName, Handles.GetMainGameViewSize());
MouseAction.DragStart, inputPos, inputPos, Handles.GetMainGameViewSize());

bool animationCompleted = false;
try
Expand Down Expand Up @@ -183,7 +183,7 @@ internal static async Task<SimulateMouseUiResponse> ExecuteDragMove(
MouseAction.DragMove,
MouseUiCoordinateConverter.ScreenToInput(pointerData.position),
SimulateMouseUiOverlayState.DragStartPosition,
targetName, Handles.GetMainGameViewSize());
Handles.GetMainGameViewSize());

// Cancellation leaves drag state intact so the user can continue with DragMove/DragEnd
MouseUiFrameWaitOutcome dragOutcome = await MouseUiDragEventExecutor.InterpolateDragPosition(
Expand Down Expand Up @@ -261,7 +261,7 @@ internal static async Task<SimulateMouseUiResponse> ExecuteDragEnd(
MouseAction.DragEnd,
MouseUiCoordinateConverter.ScreenToInput(pointerData.position),
SimulateMouseUiOverlayState.DragStartPosition,
targetName, Handles.GetMainGameViewSize());
Handles.GetMainGameViewSize());

// Any Paused exit inside this try still runs FinalizeDrag + MouseDragState.Clear()
// in the finally below, so every in-try branch reports the drag as finalized early.
Expand Down Expand Up @@ -310,7 +310,7 @@ internal static async Task<SimulateMouseUiResponse> ExecuteDragEnd(
}

SimulateMouseUiOverlayState.Update(
MouseAction.DragEnd, inputEnd, null, targetName, Handles.GetMainGameViewSize());
MouseAction.DragEnd, inputEnd, null, Handles.GetMainGameViewSize());

MouseUiFrameWaitOutcome dissipateOutcome = await MouseUiOverlayAnimator.PlayDissipateAnimation(ct).ConfigureAwait(false);
if (dissipateOutcome == MouseUiFrameWaitOutcome.TimedOut)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ internal static async Task<SimulateMouseUiResponse> ExecuteDragOneShot(
if (target == null)
{
SimulateMouseUiOverlayState.Update(
MouseAction.Drag, inputStart, null, null, Handles.GetMainGameViewSize());
MouseAction.Drag, inputStart, null, Handles.GetMainGameViewSize());
MouseUiFrameWaitOutcome noTargetExpandOutcome = await MouseUiOverlayAnimator.PlayExpandAnimation(ct).ConfigureAwait(false);
if (noTargetExpandOutcome == MouseUiFrameWaitOutcome.TimedOut)
{
Expand Down Expand Up @@ -102,7 +102,7 @@ internal static async Task<SimulateMouseUiResponse> ExecuteDragOneShot(

string targetName = target.name;
SimulateMouseUiOverlayState.Update(
MouseAction.Drag, inputStart, inputStart, targetName, Handles.GetMainGameViewSize());
MouseAction.Drag, inputStart, inputStart, Handles.GetMainGameViewSize());

// Any Paused exit inside this try still runs FinalizeDrag in the finally below
// (pointerUp/drop/endDrag), so every branch reports the drag as finalized early
Expand Down Expand Up @@ -161,7 +161,7 @@ internal static async Task<SimulateMouseUiResponse> ExecuteDragOneShot(
}

SimulateMouseUiOverlayState.Update(
MouseAction.Drag, inputEnd, inputStart, targetName, Handles.GetMainGameViewSize());
MouseAction.Drag, inputEnd, inputStart, Handles.GetMainGameViewSize());

MouseUiFrameWaitOutcome dissipateOutcome = await MouseUiOverlayAnimator.PlayDissipateAnimation(ct).ConfigureAwait(false);
if (dissipateOutcome == MouseUiFrameWaitOutcome.TimedOut)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ internal static async Task<SimulateMouseUiResponse> ExecuteClick(
bool hitTarget = resolvedTargets.Target != null;
SimulateMouseUiOverlayState.Update(
MouseAction.Click, inputPos, null,
targetName, Handles.GetMainGameViewSize());
Handles.GetMainGameViewSize());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Restore the existing argument wrapping.

Line 51 and Line 133 only reformat SimulateMouseUiOverlayState.Update(...); the arguments and behavior are unchanged. Please preserve the prior layout so this surgical cleanup does not add unrelated formatting churn.

As per coding guidelines, “Do not reformat unrelated code; surgical edits must preserve existing wrapping and layout.”

Also applies to: 133-133

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@Packages/src/Editor/FirstPartyTools/SimulateMouseUi/MouseUiPressActionExecutor.cs`
at line 51, Restore the existing argument wrapping and layout for the
SimulateMouseUiOverlayState.Update calls at the affected locations in
MouseUiPressActionExecutor, without changing their arguments or behavior. Keep
the cleanup surgical and avoid unrelated formatting changes.

Source: Coding guidelines


MouseUiFrameWaitOutcome expandOutcome = await MouseUiOverlayAnimator.PlayExpandAnimation(ct).ConfigureAwait(false);
if (expandOutcome == MouseUiFrameWaitOutcome.TimedOut)
Expand Down Expand Up @@ -130,7 +130,7 @@ internal static async Task<SimulateMouseUiResponse> ExecuteLongPress(
bool shouldReleasePointer = resolvedTargets.RawTarget != null && resolvedTargets.Target != null;
SimulateMouseUiOverlayState.Update(
MouseAction.LongPress, inputPos, null,
targetName, Handles.GetMainGameViewSize());
Handles.GetMainGameViewSize());

MouseUiFrameWaitOutcome expandOutcome = await MouseUiOverlayAnimator.PlayExpandAnimation(ct).ConfigureAwait(false);
if (expandOutcome == MouseUiFrameWaitOutcome.TimedOut)
Expand Down
Loading