Land Explorer in HomeCamp with boot loading, journal UI, and CDN publish tooling.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -11,6 +11,12 @@ namespace AIGame.EditorTools
|
||||
public static class UiSpriteNineSliceRules
|
||||
{
|
||||
private const string CommonRoot = "Assets/Bundles/UI/Texture/Common/";
|
||||
private const string JournalRoot = "Assets/Bundles/UI/Texture/Journal/";
|
||||
private static readonly HashSet<string> JournalControls = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
"journal_card", "journal_hero", "journal_gold_card", "journal_primary_normal", "journal_primary_pressed",
|
||||
"journal_secondary_normal", "journal_secondary_pressed", "journal_disabled", "journal_progress_bg", "journal_progress_fill"
|
||||
};
|
||||
// W,H,L,R,T,B:设计尺寸与边界;实际切图按尺寸换算,并包含 2px 透明留边。
|
||||
private static readonly Dictionary<string, int[]> Rules = new Dictionary<string, int[]>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
@@ -46,6 +52,8 @@ namespace AIGame.EditorTools
|
||||
{
|
||||
if (string.IsNullOrEmpty(path)) return false;
|
||||
path = path.Replace('\\', '/');
|
||||
if (string.Equals(Path.GetDirectoryName(path)?.Replace('\\', '/'), JournalRoot.TrimEnd('/'), StringComparison.OrdinalIgnoreCase))
|
||||
return JournalControls.Contains(Path.GetFileNameWithoutExtension(path));
|
||||
return path.StartsWith(CommonRoot, StringComparison.OrdinalIgnoreCase)
|
||||
&& string.Equals(Path.GetDirectoryName(path)?.Replace('\\', '/'), CommonRoot.TrimEnd('/'), StringComparison.OrdinalIgnoreCase)
|
||||
&& Rules.ContainsKey(Path.GetFileNameWithoutExtension(path));
|
||||
@@ -53,6 +61,8 @@ namespace AIGame.EditorTools
|
||||
|
||||
public static Vector4 GetBorder(string path, int width, int height)
|
||||
{
|
||||
if (JournalControls.Contains(Path.GetFileNameWithoutExtension(path)))
|
||||
return new Vector4(30f * width / 128, 32f * height / 128, 30f * width / 128, 28f * height / 128);
|
||||
int[] rule = Rules[Path.GetFileNameWithoutExtension(path)];
|
||||
float sx = Mathf.Max(1, width - 4) / (float)rule[0];
|
||||
float sy = Mathf.Max(1, height - 4) / (float)rule[1];
|
||||
@@ -106,6 +116,13 @@ namespace AIGame.EditorTools
|
||||
importer.SaveAndReimport();
|
||||
changed++;
|
||||
}
|
||||
foreach (string name in JournalControls)
|
||||
{
|
||||
var importer = AssetImporter.GetAtPath(JournalRoot + name + ".png") as TextureImporter;
|
||||
if (importer == null || !Configure(importer)) continue;
|
||||
importer.SaveAndReimport();
|
||||
changed++;
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user