Files
daluandou/.codely.packages/cn.tuanjie.codely.bridge@1.0.85-785dea6a/Editor/Bridge/Tools/ManageDialog.cs
T
huadexuan c09e15dd0e ```
feat(Materials): 更新CoreBattleGround材质贴图和缩放参数

更换了CoreBattleGround材质的主纹理,将纹理GUID从73e4d6cf089824c0cadfcefa5b15d306
更新为c6af6f473739fb546ac7775e5c957da1,并调整纹理缩放参数从{x: 3, y: 4}修改为
{x: 1, y: 1},同时移除了多余的_MetallicGlossMap配置项。
```
2026-09-28 17:58:15 +08:00

51 lines
2.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections.Generic;
using Codely.Newtonsoft.Json.Linq;
using UnityTcp.Editor.Helpers;
namespace UnityTcp.Editor.Tools
{
/// <summary>
/// <c>manage_dialog</c>: clicks a button on a native modal editor dialog.
///
/// Single action:
/// click – Params: button (regex over button labels), optional title (regex over dialog
/// titles). Clicks the first open modal dialog whose title/button match.
///
/// The command runs on the <see cref="BackgroundCommandPump"/> worker thread, which is the
/// point: a native modal dialog holds the editor main thread captive inside its message
/// pump, so this is the only way a client can answer one. The click itself is thread-safe
/// on Windows (Win32 cross-thread post); on macOS <see cref="DialogWatcher"/> marshals
/// it onto the common-modes run-loop probe, which keeps firing on the main thread even
/// during a modal session.
///
/// When such a dialog is detected, <see cref="DialogWatcher"/> detaches every
/// in-flight job with a reason that names the dialog and its buttons and points at this
/// command — the client picks a button, clicks it here, and then collects the detached
/// jobs' results via <c>manage_job.status</c>.
/// </summary>
public static class ManageDialog
{
private static readonly Dictionary<string, Func<JObject, object>> ActionHandlers =
new Dictionary<string, Func<JObject, object>>
{
{ "click", Click },
};
public static object HandleCommand(JObject @params)
=> ActionRouter.Route(@params, ActionHandlers);
private static object Click(JObject @params)
{
string button = @params["button"]?.ToString();
string title = @params["title"]?.ToString();
string failure = DialogWatcher.ClickOpenDialog(title, button,
out string clickedTitle, out string clickedButton);
return failure != null
? Response.Error(failure)
: Response.Success($"Clicked '{clickedButton}' on dialog '{clickedTitle}'.");
}
}
}