From 85c3133883ef1e5e368e3fad731b854aebc68667 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期四, 24 九月 2026 14:51:37 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_client
---
Assets/Editor/XCodeProjectMod.cs | 67 +++++++++++++++++++++++++++++++++
1 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/Assets/Editor/XCodeProjectMod.cs b/Assets/Editor/XCodeProjectMod.cs
index 6e4e690..8f22f56 100644
--- a/Assets/Editor/XCodeProjectMod.cs
+++ b/Assets/Editor/XCodeProjectMod.cs
@@ -160,6 +160,24 @@
_rootDict.SetString("CFBundleDevelopmentRegion", "english");
_rootDict.SetString("Localization native development region", "english");
+ // ===== 鍚姩灞忕櫧搴曪紙Info.plist 鏂瑰紡锛歎ILaunchScreen -> Background color锛�=====
+ // iOS 13+ 鏀寔鐢� Info.plist 鐨� UILaunchScreen 瀛楀吀鎻忚堪鍚姩灞忥紝鏃犻渶 storyboard銆�
+ // 娉ㄦ剰锛歎ILaunchStoryboardName 浼樺厛绾ч珮浜� UILaunchScreen锛屽繀椤荤Щ闄� Unity 鐢熸垚鐨�
+ // LaunchScreen storyboard 寮曠敤锛屽惁鍒欎笅闈㈢殑閰嶇疆涓嶄細鐢熸晥銆�
+ if (_rootDict.values.ContainsKey("UILaunchStoryboardName"))
+ {
+ _rootDict.values.Remove("UILaunchStoryboardName");
+ }
+
+ // UIColorName 鍙兘寮曠敤 asset catalog 涓殑銆屽懡鍚嶉鑹层�嶏紝杩欓噷鍦� Unity 鐢熸垚鐨�
+ // Images.xcassets 涓垱寤轰竴涓函鐧界殑 Color Set锛坒older reference 浼氳嚜鍔ㄨ缂栬瘧锛�
+ string launchScreenColorName = "LaunchScreenBackground";
+ CreateLaunchScreenColorSet(path, launchScreenColorName);
+
+ PlistElementDict launchScreenDict = _rootDict.CreateDict("UILaunchScreen");
+ launchScreenDict.SetString("UIColorName", launchScreenColorName);
+ // =====================================================================
+
PlistElementArray nsURLTypes = _rootDict.CreateArray("CFBundleURLTypes");
var dict0 = nsURLTypes.AddDict();
dict0.SetString("CFBundleTypeRole", "Editor");
@@ -178,6 +196,55 @@
+ /// <summary>
+ /// 鍦� Unity 鐢熸垚鐨� Images.xcassets 涓垱寤虹函鐧界殑 Color Set锛�
+ /// 渚� Info.plist 鐨� UILaunchScreen.UIColorName 寮曠敤銆�
+ /// </summary>
+ private static void CreateLaunchScreenColorSet(string projectPath, string colorName)
+ {
+ string[] xcassetsDirs = Directory.GetDirectories(projectPath, "*.xcassets", SearchOption.AllDirectories);
+ if (xcassetsDirs == null || xcassetsDirs.Length == 0)
+ {
+ Debug.LogWarning("[XCodeProjectMod] 鏈壘鍒� *.xcassets锛屾棤娉曞垱寤哄惎鍔ㄥ睆鐧借壊 Color Set");
+ return;
+ }
+
+ string contentsJson = "{\n" +
+ " \"colors\" : [\n" +
+ " {\n" +
+ " \"color\" : {\n" +
+ " \"color-space\" : \"srgb\",\n" +
+ " \"components\" : {\n" +
+ " \"alpha\" : \"1.000\",\n" +
+ " \"blue\" : \"1.000\",\n" +
+ " \"green\" : \"1.000\",\n" +
+ " \"red\" : \"1.000\"\n" +
+ " }\n" +
+ " },\n" +
+ " \"idiom\" : \"universal\"\n" +
+ " }\n" +
+ " ],\n" +
+ " \"info\" : {\n" +
+ " \"author\" : \"xcode\",\n" +
+ " \"version\" : 1\n" +
+ " }\n" +
+ "}\n";
+
+ foreach (var xcassets in xcassetsDirs)
+ {
+ // 璺宠繃 Pods 绛夌涓夋柟鐩綍
+ if (xcassets.Replace("\\", "/").Contains("/Pods/"))
+ {
+ continue;
+ }
+
+ string colorSetDir = Path.Combine(xcassets, colorName + ".colorset");
+ Directory.CreateDirectory(colorSetDir);
+ File.WriteAllText(Path.Combine(colorSetDir, "Contents.json"), contentsJson);
+ Debug.Log("[XCodeProjectMod] LaunchScreen 鐧借壊 Color Set 宸茬敓鎴�: " + colorSetDir);
+ }
+ }
+
private static void ModifyFile(string projectPath)
{
//淇敼UnityAppController.mm 鏂囦欢
--
Gitblit v1.8.0