Add hot-update boot pipeline, UI bundles/atlas assets, and design docs.
Ignore AIClient/Library and AIClient/HybridCLRData permanently; include HybridCLR/YooAsset project setup and UI tooling. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
#if UNITY_EDITOR
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AIGame.EditorTools
|
||||
{
|
||||
/// <summary>
|
||||
/// Unity 获得焦点时自动转换 Doc/UIPrefabCreater 中变更的 UI JSON。
|
||||
/// </summary>
|
||||
[InitializeOnLoad]
|
||||
public static class JsonUIAutoConvert
|
||||
{
|
||||
private const string PrefKey = "AIGame.UI.AutoConvertJsonOnFocus";
|
||||
private static bool s_Busy;
|
||||
private static double s_LastTime;
|
||||
|
||||
static JsonUIAutoConvert()
|
||||
{
|
||||
EditorApplication.focusChanged += OnFocusChanged;
|
||||
}
|
||||
|
||||
private static void OnFocusChanged(bool focused)
|
||||
{
|
||||
if (!focused)
|
||||
{
|
||||
return;
|
||||
}
|
||||
AutoConvertOnFocus();
|
||||
}
|
||||
|
||||
[MenuItem("Tools/UI/Convert Changed JSON Prefabs Now", false, 200)]
|
||||
public static void ConvertChangedNow()
|
||||
{
|
||||
ConvertChanged(false, "manual");
|
||||
}
|
||||
|
||||
[MenuItem("Tools/UI/Auto Convert JSON On Focus", false, 202)]
|
||||
public static void ToggleAutoConvert()
|
||||
{
|
||||
bool enabled = !IsEnabled();
|
||||
EditorPrefs.SetBool(PrefKey, enabled);
|
||||
Menu.SetChecked("Tools/UI/Auto Convert JSON On Focus", enabled);
|
||||
Debug.Log("[UIGen] Auto convert JSON on focus: " + (enabled ? "enabled" : "disabled"));
|
||||
}
|
||||
|
||||
[MenuItem("Tools/UI/Auto Convert JSON On Focus", true)]
|
||||
public static bool ToggleAutoConvertValidate()
|
||||
{
|
||||
Menu.SetChecked("Tools/UI/Auto Convert JSON On Focus", IsEnabled());
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void AutoConvertOnFocus()
|
||||
{
|
||||
if (!IsEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
ConvertChanged(false, "focus");
|
||||
}
|
||||
|
||||
private static bool IsEnabled()
|
||||
{
|
||||
if (EditorPrefs.HasKey(PrefKey))
|
||||
{
|
||||
return EditorPrefs.GetBool(PrefKey, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void ConvertChanged(bool force, string reason)
|
||||
{
|
||||
if (s_Busy)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!force && EditorApplication.timeSinceStartup - s_LastTime < 1.0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (EditorApplication.isCompiling || EditorApplication.isUpdating || EditorApplication.isPlayingOrWillChangePlaymode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
s_Busy = true;
|
||||
s_LastTime = EditorApplication.timeSinceStartup;
|
||||
try
|
||||
{
|
||||
string jsonRoot = JsonUIPrefabBuilder.ResolveDefaultJsonRoot();
|
||||
JsonUIPrefabBuilder.BuildChanged(jsonRoot, reason, force);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogException(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
s_Busy = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf0a5bf71c3566f4688e2aa6fdd7b230
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a7519c9fb16ec144ebe9339123b49c5b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user