Add prototype gameplay loop with character/battlefield assets and server game APIs.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>Delete explicitly retired UI assets through Unity, after checking retained dependencies.</summary>
|
||||
public static class RemoveAlternateUi
|
||||
{
|
||||
static readonly string[] Targets = {
|
||||
"Assets/Bundles/UI/Prefab/UI_MainHUD_Studio.prefab",
|
||||
"Assets/Bundles/UI/Prefab/UI_ConfirmDialog_Studio.prefab",
|
||||
"Assets/Bundles/UI/Prefab/UI_MainHUD_Mint.prefab",
|
||||
"Assets/Bundles/UI/Prefab/UI_ConfirmDialog_Mint.prefab",
|
||||
"Assets/Bundles/UI/Prefab/UI_ThemeSwitcher.prefab",
|
||||
"Assets/Bundles/UI/Texture/Studio",
|
||||
"Assets/Bundles/UI/Texture/Mint",
|
||||
"Assets/HotUpdate/Scripts/UI/ThemeSwitcherView.cs"
|
||||
};
|
||||
static bool Retired(string path) => Targets.Any(t => path == t || path.StartsWith(t + "/", StringComparison.Ordinal));
|
||||
|
||||
public static string Audit()
|
||||
{
|
||||
var owners = AssetDatabase.GetAllAssetPaths().Where(p => p.StartsWith("Assets/", StringComparison.Ordinal) && !Retired(p) &&
|
||||
new[] { ".prefab", ".unity", ".asset", ".mat", ".controller" }.Any(e => p.EndsWith(e, StringComparison.Ordinal))).ToArray();
|
||||
var conflicts = owners.SelectMany(p => AssetDatabase.GetDependencies(p, true).Where(Retired).Select(d => p + " -> " + d)).ToArray();
|
||||
if (conflicts.Length > 0) throw new Exception("Retained assets reference retired UI:\n" + string.Join("\n", conflicts));
|
||||
return "No retained serialized asset depends on retired UI; checked " + owners.Length + " assets.";
|
||||
}
|
||||
|
||||
public static string Remove()
|
||||
{
|
||||
if (EditorApplication.isPlaying) throw new Exception("Exit Play Mode before deleting assets.");
|
||||
Audit();
|
||||
int count = 0;
|
||||
foreach (var target in Targets)
|
||||
{
|
||||
if (AssetDatabase.LoadMainAssetAtPath(target) == null && !AssetDatabase.IsValidFolder(target)) continue;
|
||||
if (!AssetDatabase.DeleteAsset(target)) throw new Exception("Unity could not delete " + target);
|
||||
count++;
|
||||
}
|
||||
AssetDatabase.Refresh();
|
||||
return "Deleted " + count + " retired UI assets/folders via AssetDatabase, including their Unity metadata.";
|
||||
}
|
||||
|
||||
public static string FinalizeRemoval()
|
||||
{
|
||||
foreach (var target in Targets)
|
||||
if (AssetDatabase.LoadMainAssetAtPath(target) != null || AssetDatabase.IsValidFolder(target)) throw new Exception("Retired asset still exists: " + target);
|
||||
var result = AIGame.EditorTools.SetupUiBundleCollector.Setup();
|
||||
var package = YooAsset.Editor.BundleCollectorSettingData.Setting.GetPackage("Art");
|
||||
var group = package.Groups.Single(g => g.GroupName == "UI");
|
||||
if (group.GroupDesc != "Candy UI") throw new Exception("Collector still advertises retired themes.");
|
||||
foreach (var name in new[] { "UI_MainHUD", "UI_ConfirmDialog" })
|
||||
{
|
||||
var path = "Assets/Bundles/UI/Prefab/" + name + ".prefab";
|
||||
if (AssetDatabase.LoadAssetAtPath<GameObject>(path) == null) throw new Exception("Candy prefab missing: " + name);
|
||||
if (AssetDatabase.GetDependencies(path, true).Any(Retired)) throw new Exception("Candy still depends on retired themes.");
|
||||
}
|
||||
if (HotUpdate.UI.UiThemeCatalog.Normalize("studio") != "candy" || HotUpdate.UI.UiThemeCatalog.Normalize("mint") != "candy")
|
||||
throw new Exception("Legacy theme fallback broken.");
|
||||
foreach (var driver in Resources.FindObjectsOfTypeAll<AOT.Boot.BootDriver>().Where(d => d.gameObject.scene.IsValid()))
|
||||
{
|
||||
var settings = new SerializedObject(driver).FindProperty("settings.UiTheme");
|
||||
if (settings != null && settings.stringValue != "candy") throw new Exception("Boot still selects a retired theme.");
|
||||
}
|
||||
return "8 retired targets absent; Candy HUD/dialog and dependencies intact; collector updated; old theme config falls back to Candy. " + result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user