chore(bridge): 删除桥接包的提交记录和Git属性配置

删除了 .codely-bridge-commit 文件中存储的提交哈希值
移除了 .gitattributes 文件中的行结束符配置规则
```
This commit is contained in:
huadexuan committed 2026-09-24 21:41:14 +08:00
1 parent d26d323912
commit 13d0c80335
392 files changed
+1814 -1895

No files matched your search

@@ -1,16 +0,0 @@
{
"name": "Codely.Common",
"rootNamespace": "UnityTcp.Editor.Helpers",
"references": [],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: ed2d2dedded8472da942c504f0ce5986
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,154 +0,0 @@
using System;
using UnityEditor;
using UnityEngine;
namespace UnityTcp.Editor.Helpers
{
/// <summary>
/// Centralized logger for the Codely Bridge package.
///
/// All package logging is routed through here so it can be globally
/// enabled/disabled and consistently branded. This is the ONLY place in the
/// package that is allowed to call <see cref="UnityEngine.Debug"/> directly;
/// every other type should log through CodelyLogger.
///
/// Toggle logging via the menu (AI/Logging/Enable Codely Logs) or
/// programmatically through <see cref="Enabled"/>.
/// </summary>
public static class CodelyLogger
{
private const string Prefix = "<b><color=#2EA3FF>Codely Bridge</color></b>:";
// Master on/off switch. Persisted so the choice survives domain reloads.
private const string EnabledKey = "Codely.Logging.Enabled";
// Verbose/diagnostic toggle. Reuses the pre-existing key so the legacy
// "UnityTcp.DebugLogs" preference keeps working unchanged.
private const string VerboseKey = "UnityTcp.DebugLogs";
private const string EnabledMenu = "AI/Logging/Enable Codely Logs";
private const string VerboseMenu = "AI/Logging/Enable Verbose Logs";
// Cached copies of the persisted prefs. Logs are emitted both from background
// threads (IPC loops, ThreadPool callbacks) and from [InitializeOnLoad] static
// constructors during domain reload — in neither case can we rely on EditorPrefs
// being readable: off the main thread it throws, and constructor ordering across
// assemblies is undefined, so a separate init method may not have run yet.
//
// Instead we lazily read the prefs on first access (EnsureLoaded). The first
// access happens on the main thread (the bridge's static constructor), where
// EditorPrefs works; the result is cached in volatile fields that any thread can
// then read. InitializeOnLoadMethod is kept only as an early best-effort warm-up.
private static volatile bool s_enabled = false;
private static volatile bool s_verbose = false;
private static volatile bool s_loaded = false;
[InitializeOnLoadMethod]
private static void Init() => EnsureLoaded();
private static void EnsureLoaded()
{
if (s_loaded) return;
try
{
// Throws if called off the main thread; we keep defaults and retry on
// the next access until a main-thread caller succeeds.
s_enabled = EditorPrefs.GetBool(EnabledKey, false);
s_verbose = EditorPrefs.GetBool(VerboseKey, false);
s_loaded = true;
}
catch { /* not on the main thread yet */ }
}
/// <summary>
/// Master switch. When false, no package log is emitted regardless of
/// severity. Defaults to false — logging is opt-in.
/// </summary>
public static bool Enabled
{
get { EnsureLoaded(); return s_enabled; }
set
{
s_enabled = value;
s_loaded = true;
try { EditorPrefs.SetBool(EnabledKey, value); } catch { /* ignore */ }
}
}
/// <summary>
/// Verbose/diagnostic logging. Gates <see cref="Verbose"/>; has no effect
/// unless <see cref="Enabled"/> is also true.
/// </summary>
public static bool VerboseEnabled
{
get { EnsureLoaded(); return s_verbose; }
set
{
s_verbose = value;
s_loaded = true;
try { EditorPrefs.SetBool(VerboseKey, value); } catch { /* ignore */ }
}
}
/// <summary>Informational log. Suppressed when logging is disabled.</summary>
public static void Log(object message)
{
if (!Enabled) return;
Debug.Log($"{Prefix} {message}");
}
/// <summary>Warning log. Suppressed when logging is disabled.</summary>
public static void LogWarning(object message)
{
if (!Enabled) return;
Debug.LogWarning($"<color=#cc7a00>{Prefix} {message}</color>");
}
/// <summary>Error log. Suppressed when logging is disabled.</summary>
public static void LogError(object message)
{
if (!Enabled) return;
Debug.LogError($"<color=#cc3333>{Prefix} {message}</color>");
}
/// <summary>Exception log. Suppressed when logging is disabled.</summary>
public static void LogException(Exception exception)
{
if (!Enabled) return;
Debug.LogException(exception);
}
/// <summary>
/// Diagnostic log. Only emitted when both <see cref="Enabled"/> and
/// <see cref="VerboseEnabled"/> are true. Use for high-frequency or
/// detailed traces that should be off by default.
/// </summary>
public static void Verbose(object message)
{
if (!Enabled || !VerboseEnabled) return;
Debug.Log($"{Prefix} {message}");
}
// ---- Editor menu toggles ------------------------------------------------
[MenuItem(EnabledMenu, priority = 1000)]
private static void ToggleEnabled() => Enabled = !Enabled;
[MenuItem(EnabledMenu, true)]
private static bool ToggleEnabledValidate()
{
Menu.SetChecked(EnabledMenu, Enabled);
return true;
}
[MenuItem(VerboseMenu, priority = 1001)]
private static void ToggleVerbose() => VerboseEnabled = !VerboseEnabled;
[MenuItem(VerboseMenu, true)]
private static bool ToggleVerboseValidate()
{
Menu.SetChecked(VerboseMenu, VerboseEnabled);
return Enabled;
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 18b1e4d484054fe7aa4a104063914bde
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,118 +0,0 @@
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
namespace UnityTcp.Editor.Helpers
{
/// <summary>
/// Central compatibility surface for Unity's instance-id → <c>EntityId</c>
/// migration (Unity 6000.5 / Unity 6.5).
///
/// Unity 6.5 deprecated every <see cref="int"/>-based identity API with an
/// error-level obsolete attribute (CS0619) in favour of 64-bit <c>EntityId</c>
/// overloads that do not exist on earlier versions:
/// Object.GetInstanceID() -> Object.GetEntityId()
/// Selection.activeInstanceID -> Selection.activeEntityId
/// EditorUtility.InstanceIDToObject(int) -> EditorUtility.EntityIdToObject(EntityId)
/// InternalEditorUtility.GetObjectFromInstanceID(int)
/// -> InternalEditorUtility.GetObjectFromEntityId(EntityId)
/// AssetDatabase.GetAssetPath(int) -> AssetDatabase.GetAssetPath(EntityId)
///
/// These helpers speak <see cref="long"/> so the full 64-bit EntityId value is
/// carried losslessly and can be reconstructed exactly (no 32-bit truncation).
/// On pre-6.5 Unity the legacy <c>int</c> instance id widens implicitly to
/// <c>long</c>, so call sites see a single consistent type across versions. The
/// only version-specific code lives in the two conversion helpers at the bottom.
/// </summary>
public static class InstanceIdExtensions
{
// ---- producers: Object / Selection -> long id -------------------------
/// <summary>
/// Returns the object's stable instance id as a <see cref="long"/>, or 0 if
/// the object is null/destroyed. Prefer this over <c>GetInstanceID()</c>.
/// </summary>
public static long GetStableInstanceId(this Object obj)
{
if (obj == null) return 0;
#if UNITY_6000_5_OR_NEWER
return ToLong(obj.GetEntityId());
#else
return obj.GetInstanceID();
#endif
}
/// <summary>Active selection instance id, or 0 if nothing is selected.</summary>
public static long ActiveSelectionInstanceId()
{
#if UNITY_6000_5_OR_NEWER
return ToLong(Selection.activeEntityId);
#else
#pragma warning disable CS0618
return Selection.activeInstanceID;
#pragma warning restore CS0618
#endif
}
// ---- consumers: long id -> Object / path ------------------------------
/// <summary>Resolves an instance id to its <see cref="Object"/>, or null.</summary>
public static Object InstanceIdToObject(long instanceId)
{
#if UNITY_6000_5_OR_NEWER
return EditorUtility.EntityIdToObject(ToEntityId(instanceId));
#else
#pragma warning disable CS0618
return EditorUtility.InstanceIDToObject((int)instanceId);
#pragma warning restore CS0618
#endif
}
/// <summary>
/// Resolves an instance id via <c>InternalEditorUtility</c> (used for objects
/// that <see cref="EditorUtility"/> will not return, e.g. some scene objects).
/// </summary>
public static Object ObjectFromInstanceId(long instanceId)
{
#if UNITY_6000_5_OR_NEWER
return InternalEditorUtility.GetObjectFromEntityId(ToEntityId(instanceId));
#else
#pragma warning disable CS0618
return InternalEditorUtility.GetObjectFromInstanceID((int)instanceId);
#pragma warning restore CS0618
#endif
}
/// <summary>Asset path for an instance id, or "" if it is not an asset.</summary>
public static string AssetPathFromInstanceId(long instanceId)
{
#if UNITY_6000_5_OR_NEWER
return AssetDatabase.GetAssetPath(ToEntityId(instanceId));
#else
#pragma warning disable CS0618
return AssetDatabase.GetAssetPath((int)instanceId);
#pragma warning restore CS0618
#endif
}
#if UNITY_6000_5_OR_NEWER
// ---- the ONLY version-specific conversions ----------------------------
// Both are pure 64-bit bit reinterpretations of EntityId.ToULong (the
// canonical numeric form of an EntityId, which this project already uses),
// so ToEntityId is an exact inverse of ToLong with no loss of information.
/// <summary>Reinterprets an <c>EntityId</c> as a 64-bit <see cref="long"/>.</summary>
internal static long ToLong(EntityId entityId)
=> unchecked((long)EntityId.ToULong(entityId));
/// <summary>
/// Exact inverse of <see cref="ToLong"/>: rebuilds the <c>EntityId</c> from
/// its 64-bit numeric form via <c>EntityId.FromULong</c> (the counterpart of
/// <c>EntityId.ToULong</c>), so an id survives a round-trip through storage or
/// the wire without loss.
/// </summary>
internal static EntityId ToEntityId(long instanceId)
=> EntityId.FromULong(unchecked((ulong)instanceId));
#endif
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 5517e1536a7543169690ccfb62d87b53
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: