From f274decb21f0b51aa26454581aa55412e37394e2 Mon Sep 17 00:00:00 2001
From: lwb <q3213421wrwqr>
Date: 星期五, 15 一月 2021 10:42:52 +0800
Subject: [PATCH] 9527 打包修改

---
 Assets/Editor/XCodeProjectMod.cs |   31 +++++++++++++++++++++++++++----
 1 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/Assets/Editor/XCodeProjectMod.cs b/Assets/Editor/XCodeProjectMod.cs
index ee9253a..7fe6d30 100644
--- a/Assets/Editor/XCodeProjectMod.cs
+++ b/Assets/Editor/XCodeProjectMod.cs
@@ -111,12 +111,24 @@
 
     private static void ModifyFile(string projectPath)
     {
+        bool _isMr = false;
+        string _mrPlistPath = Application.dataPath + "/Plugins/iOS/MyMRSDK/MRSDKInfo.plist";
+        if (File.Exists(_mrPlistPath))
+        {
+            _isMr = true;
+        }
+
         // -------------- UnityAppController.mm
         //璇诲彇UnityAppController.mm鏂囦欢
         var _xclass = new XClass(projectPath + "/Classes/UnityAppController.mm");
 
         //鍦ㄦ寚瀹氫唬鐮佸悗闈㈠鍔犱竴琛屼唬鐮�
-        _xclass.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#include \"UniversalSDK.h\"\n#include \"JPushService.h\"");
+        _xclass.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#include \"UniversalSDK.h\"\n#include \"JPushService.h\"\n");
+
+        if (_isMr)
+        {
+            _xclass.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#include \"IAPManager.h\"\n");
+        }
 
         string newCode = "\n" +
                          "extern \"C\" void IOSMessageHandle(const char* jsonString) {\n" +
@@ -132,7 +144,17 @@
         //鍦ㄦ寚瀹氫唬鐮佸悗闈㈠鍔犱竴澶ц浠g爜
         _xclass.WriteBelow("[KeyboardDelegate Initialize];", newCode);
 
+        if (_isMr)
+        {
+            _xclass.WriteBelow("[KeyboardDelegate Initialize];", "    [[IAPManager shared] startManager];\n");
+        }
+
         _xclass.WriteBelow("UnitySendDeviceToken(deviceToken);", "    [JPUSHService registerDeviceToken:deviceToken];");
+
+        if (_isMr)
+        {
+            _xclass.WriteBelow("SensorsCleanup();", "    [[IAPManager shared] stopManager];");
+        }
 
         newCode = "UnitySendRemoteNotification(userInfo);\n" +
             "    [JPUSHService handleRemoteNotification:userInfo];\n";
@@ -231,14 +253,15 @@
         }
 
         s_IsAppend = true;
-
-        BuildPipeline.BuildPlayer(ClientPackage.baseLevels, _buildPath, BuildTarget.iOS, BuildOptions.Il2CPP | BuildOptions.AcceptExternalModificationsToPlayer);
+        PlayerSettings.SetScriptingBackend(BuildTargetGroup.iOS, ScriptingImplementation.IL2CPP);
+        BuildPipeline.BuildPlayer(ClientPackage.baseLevels, _buildPath, BuildTarget.iOS, BuildOptions.AcceptExternalModificationsToPlayer);
     }
 
     public static void BuildIOSProject_Replace()
     {
         s_IsAppend = false;
-        BuildPipeline.BuildPlayer(ClientPackage.baseLevels, GetBuildPath(), BuildTarget.iOS, BuildOptions.Il2CPP);
+        PlayerSettings.SetScriptingBackend(BuildTargetGroup.iOS, ScriptingImplementation.IL2CPP);
+        BuildPipeline.BuildPlayer(ClientPackage.baseLevels, GetBuildPath(), BuildTarget.iOS, BuildOptions.None);
     }
 
     [MenuItem("Build/ipa")]

--
Gitblit v1.8.0