Ship the WeChat hot-update catalogs and the camp, TideWhale T2, UI atlas, and animation-lab work.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -319,6 +319,8 @@ namespace AIGame.EditorTools
|
||||
try
|
||||
{
|
||||
Dictionary<string, GameObject> map = new Dictionary<string, GameObject>();
|
||||
var spritePaths = root["assets"]?["sprites"]?.ToObject<Dictionary<string, string>>()
|
||||
?? new Dictionary<string, string>();
|
||||
List<Action> deferred = new List<Action>();
|
||||
|
||||
foreach (JToken node in nodes)
|
||||
@@ -343,7 +345,7 @@ namespace AIGame.EditorTools
|
||||
|
||||
foreach (JToken comp in (node["components"] as JArray) ?? new JArray())
|
||||
{
|
||||
ApplyComponent(go, comp as JObject, map, deferred, Path.GetFileName(jsonPath));
|
||||
ApplyComponent(go, comp as JObject, map, deferred, Path.GetFileName(jsonPath), spritePaths);
|
||||
}
|
||||
go.SetActive(active);
|
||||
}
|
||||
@@ -524,7 +526,7 @@ namespace AIGame.EditorTools
|
||||
}
|
||||
|
||||
// ---------- 组件 ----------
|
||||
private static void ApplyComponent(GameObject go, JObject comp, Dictionary<string, GameObject> map, List<Action> deferred, string fileName)
|
||||
private static void ApplyComponent(GameObject go, JObject comp, Dictionary<string, GameObject> map, List<Action> deferred, string fileName, Dictionary<string, string> spritePaths)
|
||||
{
|
||||
if (comp == null)
|
||||
{
|
||||
@@ -564,7 +566,7 @@ namespace AIGame.EditorTools
|
||||
{
|
||||
Image img = GetOrAdd<Image>(go);
|
||||
string spriteName = (string)comp["sprite"];
|
||||
Sprite sprite = ResolveSprite(spriteName, fileName);
|
||||
Sprite sprite = ResolveSprite(spriteName, fileName, spritePaths);
|
||||
img.sprite = sprite;
|
||||
string imageType = (string)comp["imageType"];
|
||||
if (string.IsNullOrEmpty(imageType) && sprite != null
|
||||
@@ -591,6 +593,20 @@ namespace AIGame.EditorTools
|
||||
img.color = ParseColor((string)comp["color"], Color.white);
|
||||
break;
|
||||
}
|
||||
case "RawImage":
|
||||
{
|
||||
RawImage image = GetOrAdd<RawImage>(go);
|
||||
string materialPath = (string)comp["material"];
|
||||
if (!string.IsNullOrEmpty(materialPath))
|
||||
{
|
||||
image.material = AssetDatabase.LoadAssetAtPath<Material>(materialPath);
|
||||
if (image.material == null)
|
||||
throw new InvalidOperationException("RawImage material not found: " + materialPath);
|
||||
}
|
||||
image.color = ParseColor((string)comp["color"], Color.white);
|
||||
image.raycastTarget = comp["raycastTarget"] != null && (bool)comp["raycastTarget"];
|
||||
break;
|
||||
}
|
||||
case "TextMeshProUGUI":
|
||||
{
|
||||
TextMeshProUGUI t = GetOrAdd<TextMeshProUGUI>(go);
|
||||
@@ -622,9 +638,9 @@ namespace AIGame.EditorTools
|
||||
{
|
||||
btn.transition = Selectable.Transition.SpriteSwap;
|
||||
SpriteState state = btn.spriteState;
|
||||
state.highlightedSprite = ResolveSprite((string)comp["spriteHighlighted"], fileName);
|
||||
state.pressedSprite = ResolveSprite((string)comp["spritePressed"], fileName);
|
||||
state.disabledSprite = ResolveSprite((string)comp["spriteDisabled"], fileName);
|
||||
state.highlightedSprite = ResolveSprite((string)comp["spriteHighlighted"], fileName, spritePaths);
|
||||
state.pressedSprite = ResolveSprite((string)comp["spritePressed"], fileName, spritePaths);
|
||||
state.disabledSprite = ResolveSprite((string)comp["spriteDisabled"], fileName, spritePaths);
|
||||
btn.spriteState = state;
|
||||
}
|
||||
else
|
||||
@@ -1027,12 +1043,19 @@ namespace AIGame.EditorTools
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Sprite ResolveSprite(string spriteName, string fileName)
|
||||
private static Sprite ResolveSprite(string spriteName, string fileName, Dictionary<string, string> spritePaths)
|
||||
{
|
||||
if (string.IsNullOrEmpty(spriteName))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (spritePaths.TryGetValue(spriteName, out string declaredPath))
|
||||
{
|
||||
var declaredSprite = AssetDatabase.LoadAssetAtPath<Sprite>(declaredPath);
|
||||
if (declaredSprite == null)
|
||||
throw new InvalidOperationException(fileName + ": declared Sprite is missing: " + spriteName + " (" + declaredPath + ")");
|
||||
return declaredSprite;
|
||||
}
|
||||
string[] guids = AssetDatabase.FindAssets(spriteName, new[] { TextureRoot });
|
||||
foreach (string guid in guids)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user