| Assets/Editor/Tool/ClientPackage.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Assets/Editor/XCodeProjectMod.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Assets/Launch/SkipUnityLogo/Script/Editor/SplashScreenSetting.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Assets/Launch/UI/LaunchWins/LaunchExWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Assets/Editor/Tool/ClientPackage.cs
@@ -1143,15 +1143,42 @@ projectSettings.FindProperty("iOSLaunchScreeniPadType").intValue = 1; // 设置 iPad 启动图 projectSettings.FindProperty("iOSLaunchScreeniPadImage").objectReferenceValue = splashImage.texture; // 关键修复:Unity 闪屏背景色设为黑色,与 LaunchScreen 黑色背景一致 // iPhone / iPad 启动屏底色设为白色(0xFFFFFFFF,纯白不透明) // XCodeProjectMod.BuildPlist 里已用 Info.plist 的 UILaunchScreen 把系统启动屏改成白底, // 这里同步把 Unity 生成的 storyboard 底色也改成白色,保证两条路径表现一致。 SetPackedColorWhite(projectSettings, "iOSLaunchScreenBackgroundColor"); SetPackedColorWhite(projectSettings, "iOSLaunchScreeniPadBackgroundColor"); // 关键修复:Unity 闪屏背景色设为白色,与白色启动屏一致 // iOS 16 上 SkipUnityLogo 的 Task.Run 可能无法及时执行 SplashScreen.Stop(), // Unity 闪屏会短暂露出背景色。设为黑色后即便露出也跟 LaunchScreen 无缝衔接。 projectSettings.FindProperty("m_SplashScreenBackgroundColor").boxedValue = Color.black; // Unity 闪屏会短暂露出背景色。设为白色后即便露出也跟启动屏无缝衔接,不会闪黑。 projectSettings.FindProperty("m_SplashScreenBackgroundColor").boxedValue = Color.white; projectSettings.ApplyModifiedProperties(); Debug.Log($"[ClientPackage] iOS LaunchScreen 已设置,version: {_versionName}"); } } /// <summary> /// 将 ProjectSettings 中按 rgba 打包存储的 Color 属性设为纯白不透明(0xFFFFFFFF) /// </summary> private static void SetPackedColorWhite(SerializedObject projectSettings, string propertyPath) { SerializedProperty colorProp = projectSettings.FindProperty(propertyPath); if (colorProp == null) { Debug.LogWarning($"[ClientPackage] 未找到属性: {propertyPath},跳过设白"); return; } SerializedProperty rgbaProp = colorProp.FindPropertyRelative("rgba"); if (rgbaProp == null) { Debug.LogWarning($"[ClientPackage] 属性 {propertyPath} 下未找到 rgba 字段,跳过设白"); return; } rgbaProp.longValue = 4294967295L; } public static void SetCreateRoleAnimation() { var from = "Assets/Editor/Video/CreateRoleMovie.mp4"; Assets/Editor/XCodeProjectMod.cs
@@ -160,6 +160,24 @@ _rootDict.SetString("CFBundleDevelopmentRegion", "english"); _rootDict.SetString("Localization native development region", "english"); // ===== 启动屏白底(Info.plist 方式:UILaunchScreen -> Background color)===== // iOS 13+ 支持用 Info.plist 的 UILaunchScreen 字典描述启动屏,无需 storyboard。 // 注意:UILaunchStoryboardName 优先级高于 UILaunchScreen,必须移除 Unity 生成的 // LaunchScreen storyboard 引用,否则下面的配置不会生效。 if (_rootDict.values.ContainsKey("UILaunchStoryboardName")) { _rootDict.values.Remove("UILaunchStoryboardName"); } // UIColorName 只能引用 asset catalog 中的「命名颜色」,这里在 Unity 生成的 // Images.xcassets 中创建一个纯白的 Color Set(folder 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 文件 Assets/Launch/SkipUnityLogo/Script/Editor/SplashScreenSetting.cs
@@ -12,7 +12,7 @@ [MenuItem(BlackMenuPath)] static void BlackSplashScreen() { Sprite background = AssetDatabase.LoadAssetAtPath("Assets/SkipUnityLogo/img/BlackSplashScreenMask.png", typeof(Sprite)) as Sprite; Sprite background = AssetDatabase.LoadAssetAtPath("Assets/Launch/SkipUnityLogo/img/BlackSplashScreenMask.png", typeof(Sprite)) as Sprite; PlayerSettings.SplashScreen.background = background; PlayerSettings.SplashScreen.unityLogoStyle = PlayerSettings.SplashScreen.UnityLogoStyle.LightOnDark; PlayerSettings.SplashScreen.animationMode = PlayerSettings.SplashScreen.AnimationMode.Static; @@ -25,7 +25,7 @@ [MenuItem(WhiteMenuPath)] static void WhiteSplashScreen() { Sprite background = AssetDatabase.LoadAssetAtPath("Assets/SkipUnityLogo/img/WhiteSplashScreenMask.png", typeof(Sprite)) as Sprite; Sprite background = AssetDatabase.LoadAssetAtPath("Assets/Launch/SkipUnityLogo/img/WhiteSplashScreenMask.png", typeof(Sprite)) as Sprite; PlayerSettings.SplashScreen.background = background; PlayerSettings.SplashScreen.unityLogoStyle = PlayerSettings.SplashScreen.UnityLogoStyle.DarkOnLight; PlayerSettings.SplashScreen.animationMode = PlayerSettings.SplashScreen.AnimationMode.Static; Assets/Launch/UI/LaunchWins/LaunchExWin.cs
@@ -137,7 +137,7 @@ DestroyImmediate(BackgroundWin); UpdateProgress(); } string loadingStr = ""; private void OnEnable() { if (m_NetworkContainer != null) @@ -145,8 +145,11 @@ m_NetworkContainer.gameObject.SetActive(false); } var languageShowDict = JsonMapper.ToObject<Dictionary<string, string>>(InitialFunctionConfigEx.Get("Language").Numerical2); var id = string.IsNullOrEmpty(LocalResManager.Id) ? "zh" : LocalResManager.Id; // 默认中文 var loadingStrDict = JsonMapper.ToObject<Dictionary<string, string>>(InitialFunctionConfigEx.Get("Language").Numerical1); loadingStr = loadingStrDict[id]; var languageShowDict = JsonMapper.ToObject<Dictionary<string, string>>(InitialFunctionConfigEx.Get("Language").Numerical2); m_NetworkTip.text = languageShowDict[id]; var AppleCheck = InitialFunctionConfigEx.Get("CheckTime").Numerical1; @@ -232,7 +235,7 @@ // 进度只增不减 displayedProgress = Mathf.Clamp01(Mathf.Max(displayedProgress, value)); var text = StringUtility.Concat(((int)(displayedProgress * 100)).ToString(), "%"); var text = StringUtility.Concat(loadingStr, ((int)(displayedProgress * 100)).ToString(), "%"); if (ShowCircleView) { m_IosProgressTip.text = text;