From 77a4ed277c8d33cc748f57b91fb23f0dc54b63ed Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期二, 19 二月 2019 11:28:32 +0800
Subject: [PATCH] 3335 整理ui资源。
---
Assets/Editor/XCodeProjectMod.cs | 70 +++++++++++++++++++++++++++-------
1 files changed, 55 insertions(+), 15 deletions(-)
diff --git a/Assets/Editor/XCodeProjectMod.cs b/Assets/Editor/XCodeProjectMod.cs
index d978fa9..05c1f74 100644
--- a/Assets/Editor/XCodeProjectMod.cs
+++ b/Assets/Editor/XCodeProjectMod.cs
@@ -2,18 +2,18 @@
using System.IO;
using UnityEditor;
using UnityEditor.iOS.Xcode.Custom;
+using UnityEditor.iOS.Xcode.Custom.Extensions;
using UnityEngine;
public class XCodeProjectMod
{
-
+#if UNITY_IOS
private const string CODE_SIGN_DEVELOPER = "";
private const string CODE_SIGN_DISTRIBUTION = "";
private const string PROVISIONING_DEVELOPER = "";
private const string PROVISIONING_DISTRIBUTION = "";
private const string TEAM = "5X26T385YZ";
-#if UNITY_IOS
[UnityEditor.Callbacks.PostProcessBuild(999)]
public static void OnPostprocessBuild(BuildTarget buildTarget, string path)
{
@@ -64,6 +64,12 @@
_project.AddFileToBuild(_targetGUID, _project.AddFile("/usr/lib/libiconv.tbd", "Frameworks/libiconv.tbd", PBXSourceTree.Sdk));
_project.AddFileToBuild(_targetGUID, _project.AddFile("/usr/lib/libresolv.tbd", "Frameworks/libresolv.tbd", PBXSourceTree.Sdk));
+ // mr_sdk
+ HandleMrSDK(_project, _targetGUID);
+
+ // sp_sdk
+ HandleSpSDK(_project, _targetGUID);
+
File.WriteAllText(_projectPath, _project.WriteToString());
var _capabilityMgr = new ProjectCapabilityManager(_projectPath, "game003.entitlements", PBXProject.GetUnityTargetName());
@@ -78,7 +84,6 @@
ModifyFile(path);
}
}
-#endif
private static void BuildPlist(string path)
{
@@ -96,7 +101,7 @@
_dict.SetBoolean("NSExceptionAllowsInsecureHTTPLoads", true);
_rootDict.SetString("NSMicrophoneUsageDescription", "浣跨敤楹﹀厠椋庢潈闄�");
- _rootDict.SetString("NSPhotoLibraryAddUsageDescription", "浣跨敤鐩稿唽鏉冮檺");
+ _rootDict.SetString("NSPhotoLibraryAddUsageDescription", "浣跨敤鐩稿唽鏉冮檺,鐢ㄤ互瀛樺偍鎴睆鐨勮处鍙蜂俊鎭�,浠ラ槻蹇樿璐﹀彿瀵嗙爜");
_rootDict.SetString("YLChannelId", "1000");
_rootDict.SetString("YLPlatformId", "1000");
@@ -106,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" +
@@ -127,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";
@@ -232,19 +259,10 @@
public static void BuildIOSProject_Replace()
{
- string _buildPath = GetBuildPath();
- UnityEngine.Debug.Log(_buildPath);
- if (string.IsNullOrEmpty(_buildPath))
- {
- return;
- }
-
s_IsAppend = false;
-
- BuildPipeline.BuildPlayer(ClientPackage.baseLevels, _buildPath, BuildTarget.iOS, BuildOptions.Il2CPP);
+ BuildPipeline.BuildPlayer(ClientPackage.baseLevels, GetBuildPath(), BuildTarget.iOS, BuildOptions.Il2CPP);
}
-#if UNITY_IOS
[MenuItem("Build/ipa")]
public static void BuildIPA()
{
@@ -259,5 +277,27 @@
_p.Start();
_p.WaitForExit();
}
+
+ private static void HandleMrSDK(PBXProject project, string targetGUID)
+ {
+ string _mrPlistPath = Application.dataPath + "/Plugins/iOS/MyMRSDK/MRSDKInfo.plist";
+ if (File.Exists(_mrPlistPath))
+ {
+ string _fileGUID = project.AddFile(_mrPlistPath, "Frameworks/Plugins/iOS/MyMRSDK/MRSDKInfo.plist");
+ project.AddFileToBuild(targetGUID, _fileGUID);
+ }
+ }
+
+ private static void HandleSpSDK(PBXProject project, string targetGUID)
+ {
+ string _filePath = Application.dataPath + "/Plugins/iOS/SPYOUSDK/GDTActionSDK.framework";
+ if (Directory.Exists(_filePath))
+ {
+ string _frameworkGUID = project.FindFileGuidByProjectPath("Frameworks/Plugins/iOS/SPYOUSDK/GDTActionSDK.framework");
+ PBXProjectExtensions.AddFileToEmbedFrameworks(project, targetGUID, _frameworkGUID);
+ }
+ }
+
#endif
+
}
--
Gitblit v1.8.0