|
@@ -55,21 +55,71 @@ public class NewBehaviourScript
|
|
|
PlistDocument plist = new PlistDocument();
|
|
|
|
|
|
plist.ReadFromFile(plistPath);
|
|
|
-
|
|
|
+
|
|
|
plist.root.SetString("Bundle display name", "${CFBundleDisplayName }");
|
|
|
|
|
|
- var infoDirs = Directory.GetDirectories(Application.dataPath + "/AppleDependency/");
|
|
|
+ var infoDirs = Directory.GetDirectories(Application.dataPath + "\\AppleDependency");
|
|
|
for (var i = 0; i < infoDirs.Length; ++i)
|
|
|
{
|
|
|
var files = Directory.GetFiles(infoDirs[i], "*.strings");
|
|
|
project.AddLocalization(files[0], "InfoPlist.strings", "InfoPlist.strings");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
//修改UnityAppController.mm
|
|
|
string scriptPath = buildPath + "/Classes/UnityAppController.mm";
|
|
|
|
|
|
+ List<string> lines = new List<string>();
|
|
|
+
|
|
|
+ StreamReader streamReader = new StreamReader(scriptPath);
|
|
|
+
|
|
|
+ string line = "";
|
|
|
|
|
|
+ while (!string.IsNullOrEmpty(line = streamReader.ReadLine()))
|
|
|
+ {
|
|
|
+ lines.Add(line);
|
|
|
+ }
|
|
|
+
|
|
|
+ streamReader.Close();
|
|
|
+
|
|
|
+ lines.Insert
|
|
|
+ (
|
|
|
+ 0,
|
|
|
+ "#import <AlipaySDK/AlipaySDK.h>"
|
|
|
+ );
|
|
|
+
|
|
|
+ lines.Insert
|
|
|
+ (
|
|
|
+ 231,
|
|
|
+ "if ([url.host isEqualToString:@\"safepay\"]) {\n" +
|
|
|
+ "//跳转支付宝钱包进行支付,处理支付结果\n" +
|
|
|
+ "[[AlipaySDK defaultService] processOrderWithPaymentResult: url standbyCallback:^ (NSDictionary * resultDic) {\n" +
|
|
|
+ "NSLog(@\"result 1 = % @\", resultDic);\n" +
|
|
|
+ " }];\n" +
|
|
|
+ "}\n"
|
|
|
+ );
|
|
|
+
|
|
|
+ lines.Insert
|
|
|
+ (
|
|
|
+ 247,
|
|
|
+ "// NOTE: 9.0以后使用新API接口\n" +
|
|
|
+ "-(BOOL)application:(UIApplication*)app openURL: (NSURL*)url options: (NSDictionary<NSString*, id>*)options\n" +
|
|
|
+ "{\n" +
|
|
|
+ "if ([url.host isEqualToString: @\"safepay\"])\n" +
|
|
|
+ "{\n" +
|
|
|
+ "//跳转支付宝钱包进行支付,处理支付结果\n" +
|
|
|
+ "[[AlipaySDK defaultService]\n" +
|
|
|
+ "processOrderWithPaymentResult:url standbyCallback:^(NSDictionary* resultDic) {\n" +
|
|
|
+ "NSLog(@\"result 2 = % @\", resultDic);\n" +
|
|
|
+ "}];\n" +
|
|
|
+ "}\n" +
|
|
|
+ "return YES;\n" +
|
|
|
+ "}\n"
|
|
|
+ );
|
|
|
+
|
|
|
+ StreamWriter streamWriter = new StreamWriter(scriptPath);
|
|
|
+
|
|
|
+ streamWriter.Close();
|
|
|
|
|
|
|
|
|
//添加URLScheme
|
|
@@ -81,7 +131,7 @@ public class NewBehaviourScript
|
|
|
PlistElementArray urlInnerArray = urlDict.CreateArray("TestScheme");
|
|
|
urlInnerArray.AddString("TestValue");
|
|
|
|
|
|
-
|
|
|
+
|
|
|
//保存Plist
|
|
|
plist.WriteToFile(plistPath);
|
|
|
|