Esempio n. 1
0
    /// <summary>
    /// 编辑代码文件
    /// </summary>
    /// <param name="filePath"></param>
    private static void EditorCode(string filePath)
    {
        //读取UnityAppController.mm文件
        XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");

        //在指定代码后面增加一行代码
        //此方法在某一时刻才生效(2.0 < iOS Version < 9.0)
        UnityAppController.WriteBelow("@synthesize interfaceOrientation	= _curOrientation;",
                                      "- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{[[IapppayKit sharedInstance] handleOpenUrl:url];return YES;}");



        //此方法在某一时刻才生效(iOS Version > 9.0)
        UnityAppController.WriteBelow("@synthesize renderDelegate			= _renderDelegate;",
                                      "- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options{[[IapppayKit sharedInstance] handleOpenUrl:url];return YES;}");


        UnityAppController.WriteBelow("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);",
                                      "[[IapppayKit sharedInstance] handleOpenUrl:url];");

        //声明头文件
        UnityAppController.WriteBelow("#import <OpenGLES/ES2/glext.h>",
                                      "#import <IapppayKit/IapppayKit.h>");

        //在指定代码中替换一行
        //UnityAppController.Replace(@"return YES;",codeAdd2);
    }
Esempio n. 2
0
    private static void EditorCode(string filePath)
    {
        //读取UnityAppController.mm文件
        XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");
//SDK_JYIOS
        //在指定代码后面增加一行代码
//		UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"","#import <NdComPlatform/NdComPlatform.h>");
//		//在指定代码后面增加一行
//		UnityAppController.WriteBelow("- (void)applicationDidEnterBackground:(UIApplication *)application\n{","[[NdComPlatform defaultPlatform] NdPause];\n");

//SDK_TONGBU
//		have no EditorCode
//SDK_XY
//		UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"","#import <XYPlatform/XYPlatform.h>");
//		UnityAppController.WriteBelow ("- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions\n{","[XYPlatform defaultPlatform];");
//		UnityAppController.WriteBelow ("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);","[[XYPlatform defaultPlatform] XYHandleOpenURL:url];\n");
//		UnityAppController.WriteBelow ("- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window\n{","[[XYPlatform defaultPlatform] application:application supportedInterfaceOrientationsForWindow:window];\n");
//		UnityAppController.WriteBelow ("UnitySendRemoteNotificationError(error);\n}","-(BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url\n{\n[[XYPlatform defaultPlatform] XYHandleOpenURL:url];\nreturn YES;\n}");

//SDK_ZSY
//		UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"","#import <Cmge/Cmge.h>\n#import \"ZSYSDKTools.h\"");
//		UnityAppController.WriteBelow ("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);","[[CmgePlatform defaultPlatform] application:application openURL:url sourceApplication:sourceApplication annotation:annotation];\n");
//		UnityAppController.WriteBelow ("UnityInitApplicationNoGraphics([[[NSBundle mainBundle] bundlePath]UTF8String]);","[[ZSYSDKTools alloc] ZSYInit:launchOptions];");

//SDK_HM
//		UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"","#import <IPAYiAppPay.h>");
//		UnityAppController.WriteBelow ("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);","[[IPAYiAppPay sharediAppPay] handleOpenurl:url];\n");
//		UnityAppController.WriteBelow ("UnitySendRemoteNotificationError(error);\n}","-(BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url\n{\n[[IPAYiAppPay sharediAppPay] handleOpenurl:url];\nreturn YES;\n}");

//SDK_I4
//		UnityAppController.WriteBelow ("#include \"PluginBase/AppDelegateListener.h\"","#import \"AsInfoKit.h\"");
//		UnityAppController.WriteBelow ("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);","if ([sourceApplication isEqualToString:@\"com.alipay.iphoneclient\"])\n{\n [[AsInfoKit sharedInstance] alixPayResult:url];\n}\nelse if ([sourceApplication isEqualToString:@\"com.alipay.safepayclient\"])\n{\n[[AsInfoKit sharedInstance] alixPayResult:url];\n}\nelse if ([sourceApplication isEqualToString:@\"com.tencent.xin\"])\n{\n[[AsInfoKit sharedInstance] weChatPayResult:url];\n}\n");

//SDK_itools
        //		have no EditorCode

//SDK_KUAIYONG
//		UnityAppController.WriteBelow ("#include \"PluginBase/AppDelegateListener.h\"","#import <AlipaySDK/AlipaySDK.h>");
//		UnityAppController.WriteBelow ("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);"," if ([url.host isEqualToString:@\"safepay\"]) {\n[[AlipaySDK defaultService] processOderWithPaymentResult:url];\n}");

//SDK_PP
//		UnityAppController.WriteBelow ("#include \"PluginBase/AppDelegateListener.h\"","#import <PPAppPlatformKit/PPAppPlatformKit.h>");
//		UnityAppController.WriteBelow ("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);","[[PPAppPlatformKit sharedInstance] alixPayResult:url];\n");



        //在指定代码中替换一行
//        UnityAppController.Replace("return YES;","return [ShareSDK handleOpenURL:url sourceApplication:sourceApplication annotation:annotation wxDelegate:nil];");

        XClass UnityViewControllerBase = new XClass(filePath + "/Classes/UI/UnityViewControllerBase.h");

        UnityViewControllerBase.WriteBelow("#import <UIKit/UIKit.h>", "#import \"MBProgressHUD.h\"");
        UnityViewControllerBase.WriteBelow("- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation;", "-(void)showSimple;");

        XClass UnityViewControllerBasem = new XClass(filePath + "/Classes/UI/UnityViewControllerBase.mm");

        UnityViewControllerBasem.WriteBelow("AddStatusBarSupportDefaultImpl(targetClass);\n}", "@interface UnityViewControllerBase () <MBProgressHUDDelegate> {\r  MBProgressHUD *HUD;\r long long expectedLength;\r long long currentLength;\r}\r@end");
        UnityViewControllerBasem.WriteBelow("[UIView setAnimationsEnabled:YES];\n}", "-(void)showSimple \r{\r HUD = [[MBProgressHUD alloc] initWithView:UnityGetGLView()];\r [UnityGetGLView() addSubview:HUD];\r [UnityGetGLView() bringSubviewToFront:HUD];\r // Regiser for HUD callbacks so we can remove it from the window at the right time \r HUD.delegate = self;\r // Show the HUD while the provided method executes in a new thread \r [HUD showWhileExecuting:@selector(myTask) onTarget:self withObject:nil animated:YES];\r}\r - (void)myTask {\r // Do something usefull in here instead of sleeping ... \r sleep(1);\r}");
    }
Esempio n. 3
0
    private static void EditorCodeYaya(string filePath)
    {
        // UnityAppController.mm
        XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");

        UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import <GameUser_framwork/YvGameUserAPIManage.h>\n#define SDK_APPID    @\"1438496089\"");
        UnityAppController.WriteBelow("[KeyboardDelegate Initialize];", "[[YvGameUserAPIManage shareInstance] initWithAppId:SDK_APPID channelId:@\"xxsg001\" urlScheme:@\"com.xxsg.zhangm1438496089\" isTest:NO];");
    }
Esempio n. 4
0
    private static void EditorCodeLvke(string filePath)
    {
        // UnityAppController.mm
        XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");

        UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import <GameFramework/GameFramework.h>");
        UnityAppController.WriteBelow("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);", "[Game_Api Game_application:application openURL:url sourceApplication:sourceApplication annotation:annotation];");
    }
Esempio n. 5
0
    private static void EditorCodeLsqxz(string filePath)
    {
        // UnityAppController.mm
        XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");

        UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import <FBSDKCoreKit/FBSDKCoreKit.h>");
        UnityAppController.WriteBelow("_didResignActive = false;", "[FBSDKAppEvents activateApp];");
        UnityAppController.WriteBelow("[KeyboardDelegate Initialize];", "[[FBSDKApplicationDelegate sharedInstance] application:application\n                           didFinishLaunchingWithOptions:launchOptions];");
        UnityAppController.Replace("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);\n    return YES;", "AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);\n    return [[FBSDKApplicationDelegate sharedInstance] application:application\n                                                         openURL:url\n                                               sourceApplication:sourceApplication\n                                                      annotation:annotation];;");
    }
Esempio n. 6
0
    private static void EditorCodeZaya(string filePath)
    {
        // UnityAppController.mm
        XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");

        UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import <ZAYAGame/ZaYaGameHeader.h>");
        UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import <ZayaSdkConector.h>");
        UnityAppController.WriteBelow("[GetAppController().unityView recreateGLESSurfaceIfNeeded];", "[[ZaYaGame sharedInstance] setSDKEnterForeground];");
        UnityAppController.WriteBelow("[KeyboardDelegate Initialize];", "[[ZaYaGame sharedInstance]\n     setAppID:9002\n     AppKey:@\"18b33bcedf1b2c907611c7305e8dcdb3\"\n     UmengKey:@\"579c09afe0f55a498a002028\"\n     TalkingDataAdTracking:@\"76047EF6A58B87AE5CF4C86E61FCDF19\"\n     GameOrientation:GAMEInterfaceOrientationPortrait\n     LaunchOptions:launchOptions];");
    }
Esempio n. 7
0
//	private static void xyEditorCode(string filePath)
//	{
//		//读取UnityAppController.mm文件
//		XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");
//
//		//在指定代码后面增加一行代码
//		UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"","#import  <XYPlatform/XYPlatform.h>");
//
//		//在指定代码后面增加一行代码
//		UnityAppController.WriteBelow("- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{","return [[XYPlatform defaultPlatform] application:application supportedInterfaceOrientationsForWindow:window];" );
//
//
//	}

    private static void kuaiyongEditorCode(string filePath)
    {
        //读取UnityAppController.mm文件
        XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");

        //在指定代码后面增加一行代码
        UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import <xsdkFramework/XSDK.h>");

        //在指定代码后面增加一行代码
        UnityAppController.WriteBelow("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);", "if ([[XSDK instanceXSDK]handleApplication:application openURL:url sourceApplication:sourceApplication annotation:annotation]) {NSLog(@\"第三方处理\");}");
    }
Esempio n. 8
0
    private static void aibeiPayEditorCode(string filePath)
    {
        //读取UnityAppController.mm文件
        XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");

        //在指定代码后面增加一行代码
        UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import <IapppayKit/IapppayKit.h>");

        //在指定代码后面增加一行代码
        UnityAppController.WriteBelow("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);", " [[IapppayKit sharedInstance] handleOpenUrl:url];");
    }
Esempio n. 9
0
    private static void aisiEditorCode(string filePath)
    {
        //读取UnityAppController.mm文件
        XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");

        //在指定代码后面增加一行代码
        UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import \"AsInfoKit.h\"");

        //在指定代码后面增加一行代码
        UnityAppController.WriteBelow("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);", "[[AsInfoKit sharedInstance] payResult:url sourceApplication:sourceApplication];");
    }
Esempio n. 10
0
//	private static void haimaEditorCode(string filePath)
//	{
//		//读取UnityAppController.mm文件
//		XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");
//
//		//在指定代码后面增加一行代码
//		UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"","#import \"IPAYiAppPay.h\"");
//
//		//在指定代码后面增加一行代码
//		UnityAppController.WriteBelow("- (void)preStartUnity				{}","- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {[[IPAYiAppPay sharediAppPay] handleOpenurl: url];return YES;}" );
//
//		UnityAppController.WriteBelow ("NSMutableArray* values	= [NSMutableArray arrayWithCapacity:3];", "[[IPAYiAppPay sharediAppPay] handleOpenurl: url];");
//
//	}

    private static void downjoyEditorCode(string filePath)
    {
        //读取UnityAppController.mm文件
        XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");

        //在指定代码后面增加一行代码
        UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import <DownjoySDK/DJPlatformNotification.h>");

        //在指定代码后面增加一行代码
        UnityAppController.WriteBelow("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);", "[[NSNotificationCenter defaultCenter] postNotificationName:kDJPlatfromAlixQuickPayEnd object:url];");
    }
Esempio n. 11
0
    private static void pphelperEditorCode(string filePath)
    {
        //读取UnityAppController.mm文件
        XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");

        //在指定代码后面增加一行代码
        UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import <PPAppPlatformKit/PPAppPlatformKit.h>");

        //在指定代码后面增加一行代码
        UnityAppController.WriteBelow("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);", "[[PPAppPlatformKit share] alixPayResult:url];");
    }
Esempio n. 12
0
    private static void xxEditorCode(string filePath)
    {
        //读取UnityAppController.mm文件
        XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");

        //在指定代码后面增加一行代码

        UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import \"GPGameSDK_Pay.h\"");

        //在指定代码后面增加一行代码
        UnityAppController.WriteBelow("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);", "[[GPGameSDK_Pay defaultGPGamePay] openUrlResponse:url];");
    }
Esempio n. 13
0
    private static void iiappleEditorCode(string filePath)
    {
        //读取UnityAppController.mm文件
        XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");

        //在指定代码后面增加一行代码

        UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import \"IIApple.h\"");

        //在指定代码后面增加一行代码
        UnityAppController.WriteBelow("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);", "[IIApple application:application openURL:url sourceApplication:sourceApplication annotation:annotation];");
    }
Esempio n. 14
0
    /// <summary>
    /// 修改快用渠道的打包需求, 修改UnityAppController.mm文件,屏蔽部分代码来控制SDK的横竖控制
    /// </summary>
    /// <param name="filePath">File path.</param>
    private static void EditorCodeForKuaiyong(string filePath)
    {
        //读取UnityAppController.mm文件
        XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");

        //在指定代码后面增加一行代码
        UnityAppController.WriteBelow("\t[_unityView didRotate];\n}", "/*");

        //在指定代码中替换一行
        //UnityAppController.Replace("return YES;","return [ShareSDK handleOpenURL:url sourceApplication:sourceApplication annotation:annotation wxDelegate:nil];");

        //在指定代码后面增加一行
        UnityAppController.WriteBelow("\t\t   | (1 << UIInterfaceOrientationLandscapeRight) | (1 << UIInterfaceOrientationLandscapeLeft);\n}", "*/");
    }
Esempio n. 15
0
    private static void yundingEditorCode(string filePath)
    {
        //读取UnityAppController.mm文件
        XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");

        //在指定代码后面增加一行代码

        UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import <IDS/IDSHeader.h>");

        //在指定代码后面增加一行代码
        UnityAppController.WriteBelow("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);", "[[idsPP sharedInstance] parseURL:url application:application];");
        //在指定代码后面增加一行代码
        UnityAppController.WriteBelow("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);", "[[idsPP sharedInstance] trackByOpenUrl:url fromApplication:sourceApplication];");
    }
    // 修改OC代码
    static void ModifyOC(string path)
    {
        // .mm文件
        XClass mm = new XClass(path + "/Libraries/UnityARKitPlugin/Plugins/iOS/UnityARKit/NativeInterface/ARSessionNative.mm");

        // 在指定代码后面增加一行代码
        mm.WriteBelow("#include \"UnityAppController.h\"", "VNSequenceRequestHandler *sequenceRequestHandler;");
        mm.WriteBelow("#include \"UnityAppController.h\"", "VNRequest *visionCoreMLRequest;");
        mm.WriteBelow("#include \"UnityAppController.h\"", "#import \"MobileNet.h\"");
        mm.WriteBelow("#include \"UnityAppController.h\"", "#import <Vision/Vision.h>");

        mm.WriteBelow("_classToCallbackMap = [[NSMutableDictionary alloc] init];",
                      "[self setupVisionRequests];\n[self loopCoreMLUpdate];");
    }
Esempio n. 17
0
    private static void EditorCode(string filePath)
    {
        //读取UnityAppController.mm文件
        XClass UnityAppController = new XClass(filePath + "/Libraries/Plugins/iOS/UpdateExpirationDate.mm");

        //在指定代码后面增加一行代码
        UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import <ShareSDK/ShareSDK.h>");

        //在指定代码中替换一行
        UnityAppController.Replace("@\"https://sandbox.itunes.apple.com/verifyReceipt\"", "@\"https://buy.itunes.apple.com/verifyReceipt\"");

        //在指定代码后面增加一行
        UnityAppController.WriteBelow("UnityCleanup();\n}", "- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url\r{\r    return [ShareSDK handleOpenURL:url wxDelegate:nil];\r}");
    }
Esempio n. 18
0
    private static void EditorCode(string filePath)
    {
        //读取UnityAppController.mm文件
        XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");

        //在指定代码后面增加一行代码
        UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import <ShareSDK/ShareSDK.h>");

        //在指定代码中替换一行
        UnityAppController.Replace("return YES;", "return [ShareSDK handleOpenURL:url sourceApplication:sourceApplication annotation:annotation wxDelegate:nil];");

        //在指定代码后面增加一行
        UnityAppController.WriteBelow("UnityCleanup();\n}", "- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url\r{\r    return [ShareSDK handleOpenURL:url wxDelegate:nil];\r}");
    }
Esempio n. 19
0
    //修正代码
    private static void EditorCode(string filePath)
    {
        //读取UnityAppController.mm文件
        XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");

        //在指定代码后面增加一行代码
        UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import \"HTGameProxy.h\"");


        //调用 SDK 初始化
        //在指定代码后面增加一行

        /*
         *  HTGameInfo *gameInfo = [[HTGameInfo alloc] init];
         *  gameInfo.direction = Landscape;
         *  gameInfo.shortName = @"dragonball";
         *  gameInfo.name = @"七龙珠";
         *
         *  [HTGameProxy setLogEnable:YES];
         *  [HTGameProxy setDebugEnable:YES];
         *  [HTGameProxy setShowFunctionMenu:YES];
         *  [HTGameProxy initWithGameInfo:gameInfo];
         */

        string code = "\tHTGameInfo *gameInfo = [[HTGameInfo alloc] init];\n\tgameInfo.direction = Landscape;\n\tgameInfo.shortName = @\"qlz\";\n\tgameInfo.name = @\"七龙珠\";\n\t[HTGameProxy setLogEnable:YES];\n\t[HTGameProxy setDebugEnable:NO];\n\t[HTGameProxy setShowFunctionMenu:YES];\n\t[HTGameProxy initWithGameInfo:gameInfo];";

        UnityAppController.WriteBelow("UnityInitApplicationNoGraphics([[[NSBundle mainBundle] bundlePath]UTF8String]);", code);


        //在游戏 AppDelegate 对应的生命周期方法中调用对应的黑桃 SDK 方法
        //在指定代码后面增加一行
        string bgCode = "\t[HTGameProxy applicationDidEnterBackground];";

        UnityAppController.WriteBelow("printf_console(\"-> applicationDidEnterBackground()\\n\");}", bgCode);


        string foregroundCode = "\t[HTGameProxy applicationWillEnterForeground];";

        UnityAppController.WriteBelow("[GetAppController().unityView recreateGLESSurfaceIfNeeded];", foregroundCode);

        string HandleURLCode = "\t[HTGameProxy application:application handleOpenURL:url];";

        UnityAppController.WriteBelow("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);", HandleURLCode);


        ///
        ///  在游戏主视图控制器对应的生命周期方法中调用对应的黑桃 SDK 方法
        ///
    }
Esempio n. 20
0
    private static void EditorCodeXtby(string filePath)
    {
        // UnityAppController.mm
        XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");

        UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import <FBSDKCoreKit/FBSDKCoreKit.h>\n#import <AppsFlyerLib/AppsFlyerTracker.h>");
        UnityAppController.WriteBelow("_didResignActive = false;", "[FBSDKAppEvents activateApp];");
        UnityAppController.WriteBelow("[KeyboardDelegate Initialize];", @"[AppsFlyerTracker sharedTracker].appsFlyerDevKey = @""dz2eqVEhio3jEBLnTwkUw4"";
    [AppsFlyerTracker sharedTracker].appleAppID = @""1441275954"";
    //[AppsFlyerTracker sharedTracker].delegate = self;
    [[FBSDKApplicationDelegate sharedInstance] application:application
                           didFinishLaunchingWithOptions:launchOptions];");
        UnityAppController.Replace("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);\n    return YES;", "AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);\n    return [[FBSDKApplicationDelegate sharedInstance] application:application\n                                                         openURL:url\n                                               sourceApplication:sourceApplication\n                                                      annotation:annotation];;");
        UnityAppController.WriteBelow("::printf(\"-> applicationDidBecomeActive()\\n\");", "[[AppsFlyerTracker sharedTracker] trackAppLaunch];");
    }
Esempio n. 21
0
    private static void itoolsEditorCode(string filePath)
    {
        //读取UnityAppController.mm文件
        XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");

        //在指定代码后面增加一行代码
        UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import <AlipaySDK/AlipaySDK.h>");

        UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import \"HXAppPlatformKitPro.h\"");

        //在指定代码后面增加一行代码
        UnityAppController.WriteBelow("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);", "    if ([url.host isEqualToString:@\"safepay\"]) {"
                                      + " [[AlipaySDK defaultService] processOrderWithPaymentResult:url standbyCallback:^(NSDictionary *resultDic) {"
                                      + "NSLog(@\"result = %@\", resultDic);"
                                      + "[HXAppPlatformKitPro alipayCallBack:resultDic];}];}");
    }
Esempio n. 22
0
    // www url 缓存
    public static void EditWWWCacheCode(string path)
    {
        //插入代码
        XClass UnityAppController = new XClass(path + "/Classes/Unity/WWWConnection.mm");

        UnityAppController.WriteBelow("[request setAllHTTPHeaderFields: headers];", "request.cachePolicy = NSURLRequestReloadIgnoringLocalCacheData;\n    [request setHTTPShouldHandleCookies:NO];");
    }
Esempio n. 23
0
    /// <summary>
    /// 编辑代码
    /// </summary>
    /// <param name="filePath"></param>
    public static void EditCode(string filePath)
    {
        string.Format("{0}", "ken");
        XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");

        if (_curChannel.symbol != null && _curChannel.symbol.Contains("ENABLE_XINGE"))
        {
            UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import \"XinGeIOSSDK.h\"");
            UnityAppController.WriteBelow("[KeyboardDelegate Initialize];", @"
    [XinGeIOSSDK handleLaunching];
    [XinGeIOSSDK registerAPNS];
");
            UnityAppController.WriteBelow("UnitySendDeviceToken(deviceToken);", @"    
    [XinGeIOSSDK saveDeviceToken:deviceToken];
");
        }
    }
Esempio n. 24
0
    //修改指定代码文件
    private static void EditorCode(string projectName)
    {
        string sdk_name          = SDKManager.CurSDK;
        string unity_full_screen = project_path + "/Classes/Unity/FullScreenVideoPlayer.mm";
        //string unity_full_screen_new = project_path + "/Libraries/Plugins/iOS/FullScreenVideoPlayer.mm";
        string path = Application.dataPath;
        string unity_full_screen_new = path.Replace("/Assets", "/FullScreenVideoPlayer.mm");

        if (System.IO.File.Exists(unity_full_screen) && System.IO.File.Exists(unity_full_screen_new))
        {
            System.IO.File.SetAttributes(unity_full_screen, FileAttributes.Normal);
            System.IO.File.Delete(unity_full_screen);
            System.IO.File.Copy(unity_full_screen_new, unity_full_screen);
        }
        CopyToDir("IOS_BAKE/Xib", project_path);
        CopyToDir("IOS_BAKE/Unity-iPhone", project_path + "/Unity-iPhone");
        CopyToDir("IOS_BAKE/ShareSDK", project_path + "/ShareSDK");

        if (sdk_name == "version_war3g_ios_quick")
        {
            //读取UnityAppController.mm文件
            XClass UnityAppController = new XClass(project_path + "/Classes/UnityAppController.mm");

            //在指定代码后面增加一行代码
            UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import <SMPCQuickSDK/SMPCQuickSDK.h>");
            UnityAppController.WriteBelow("#import <SMPCQuickSDK/SMPCQuickSDK.h>", "#import \"QuickSDK_ios.h\"");

            //在指定代码中替换一行
            //UnityAppController.Replace("return YES;", "return [ShareSDK handleOpenURL:url sourceApplication:sourceApplication annotation:annotation wxDelegate:nil];");

            //在指定代码后面增加一行
            UnityAppController.WriteBelow("[KeyboardDelegate Initialize];", "    //注册事件监听\n [[QuickSDK_ios shareInstance] addNotifications];\n  //初始化\n     SMPCQuickSDKInitConfigure *cfg = [[SMPCQuickSDKInitConfigure alloc] init];\n    cfg.productKey = @\"18725305\";\n   cfg.productCode = @\"05351757016130194037017341621541\";\n  int error = [[SMPCQuickSDK defaultInstance] initWithConfig:cfg application:application didFinishLaunchingWithOptions:launchOptions];\n  if (error != 0) {\n     NSLog(@\"不能启动初始化: %d\", error);\n   }\n float sysVersion=[[UIDevice currentDevice]systemVersion].floatValue;\n  if (sysVersion>=8.0) {\n    UIUserNotificationType type=UIUserNotificationTypeBadge | UIUserNotificationTypeAlert | UIUserNotificationTypeSound;\n  UIUserNotificationSettings *setting=[UIUserNotificationSettings settingsForTypes:type categories:nil];\n    [[UIApplication sharedApplication]registerUserNotificationSettings:setting];    }");
            UnityAppController.WriteBelow("::printf(\"-> applicationWillEnterForeground()\\n\");", "[[UIApplication sharedApplication]setApplicationIconBadgeNumber:0];//进入前台取消应用消息图标");



            //读取UnityAppController.mm文件
            XClass PlistController = new XClass(project_path + "/Info.plist");
            PlistController.Replace("<key>System.Collections.Hashtable</key>", "<key>NSAppTransportSecurity</key>");
        }

        EditInfoPlist(project_path);
    }
Esempio n. 25
0
    public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject)
    {
        if (target != BuildTarget.iOS)
        {
            Debug.LogWarning("Target is not iPhone. XCodePostProcess will not run");
            return;
        }

        //得到xcode工程的路径
        string path = Path.GetFullPath(pathToBuiltProject);

        string     projPath = PBXProject.GetPBXProjectPath(pathToBuiltProject);
        PBXProject proj     = new PBXProject();

        proj.ReadFromString(File.ReadAllText(projPath));
        string targetGUID = proj.GetUnityMainTargetGuid();

        proj.SetBuildProperty(targetGUID, "ENABLE_BITCODE", "NO");
        proj.SetBuildProperty(targetGUID, "ARCHS", "arm64");
        proj.SetBuildProperty(targetGUID, "VALID_ARCHS", "arm64");
        proj.SetBuildProperty(targetGUID, "GCC_OPTIMIZATION_LEVEL", "s");
        proj.SetBuildProperty(targetGUID, "DEBUG_INFORMATION_FORMAT", "dwarf-with-dsym");


        string        plistPath = Path.Combine(pathToBuiltProject, "Info.plist");
        PlistDocument plist     = new PlistDocument();

        plist.ReadFromFile(plistPath);

        //plist.root.SetString("GADApplicationIdentifier", "ca-app-pub-0000000000000000~0000000000");
        plist.root.SetBoolean("Application has localized display name", true);
        //plist.root.SetString("AppLovinSdkKey", "Fs-cUqJfRU6DI-3nHAtCUubM2g2mHMT4kl_2_v9IyohMfXicNfA0eEwvSJ6gvrtpXtmu2TpTdL-QrLAMqwaXPS");
        plist.WriteToFile(plistPath);

        string unityappControllerPath = pathToBuiltProject + "/Classes/UnityAppController.mm";
        XClass UnityAppController     = new XClass(unityappControllerPath);

        UnityAppController.WriteBelow("#import \"UnityAppController.h\"", "#import <AdSupport/AdSupport.h>");
        //afid获取添加
        UnityAppController.WriteBelow("@end\n", "extern \"C\" const char * Getidfa(){\n NSString *idfa = [[[ASIdentifierManager sharedManager]advertisingIdentifier]UUIDString];\nreturn strdup([idfa UTF8String]);\n}\n");

        File.WriteAllText(projPath, proj.WriteToString());
    }
Esempio n. 26
0
    public override void EditScriptCode(string projPath)
    {
        /****************/
        //暂时不知道具体作用,等待归档
        /****************/
        //读取UnityAppController.mm文件
        XClass UnityAppController = new XClass(projPath + "/Classes/UnityAppController.mm");

        //在指定代码后面增加一行代码
        UnityAppController.WriteBelow("#import <OpenGLES/ES2/glext.h>", "#import \"WXApiManager.h\"");

        //在指定代码中替换一行
        UnityAppController.Replace("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);\n    return YES;",
                                   "AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);\n\treturn [WXApi handleOpenURL:url delegate:[WXApiManager sharedManager]];");

        UnityAppController.WriteBelow("[KeyboardDelegate Initialize];",
                                      "[WXApi registerApp:@\"wx031f3469ef4d952b\"];\n    UInt64 typeFlag = MMAPP_SUPPORT_TEXT | MMAPP_SUPPORT_PICTURE | MMAPP_SUPPORT_LOCATION | MMAPP_SUPPORT_VIDEO |MMAPP_SUPPORT_AUDIO | MMAPP_SUPPORT_WEBPAGE | MMAPP_SUPPORT_DOC | MMAPP_SUPPORT_DOCX | MMAPP_SUPPORT_PPT | MMAPP_SUPPORT_PPTX | MMAPP_SUPPORT_XLS | MMAPP_SUPPORT_XLSX | MMAPP_SUPPORT_PDF;\n    \n    [WXApi registerAppSupportContentFlag:typeFlag];");
        UnityAppController.WriteBelow("_didResignActive = false;", "[[WXApiManager sharedManager] test];");
    }
Esempio n. 27
0
    public override void EditScriptCode(string projPath)
    {
        XClass UnityAppController = new XClass(projPath + "/Classes/UnityAppController.mm");

        UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"",
                                      "#import <ShareSDK/ShareSDK.h>\n#import <ShareSDKConnector/ShareSDKConnector.h>\n" +
                                      "#import \"WXApi.h\"\n");
        UnityAppController.WriteBelow("::printf(\"-> applicationDidFinishLaunching()\\n\");",
                                      "[ShareSDK registerActivePlatforms:\n@[\n@(SSDKPlatformTypeWechat)]\nonImport:^ (SSDKPlatformType platformType)\n" +
                                      "{\nswitch (platformType)\n{\ncase SSDKPlatformTypeWechat:\n[ShareSDKConnector connectWeChat:[WXApi class]];\nbreak;" +
                                      "\t\ndefault:\nbreak;\n}\n}\nonConfiguration:^(SSDKPlatformType platformType, NSMutableDictionary * appInfo) \n" +
                                      "{\nswitch (platformType)\n{\ncase SSDKPlatformTypeWechat:\n" +
                                      "[appInfo SSDKSetupWeChatByAppId:@\"" + "wechatappid" + "\"\nappSecret:@\"" +
                                      "wechatsecrectkey" + "\"];\nbreak;\n" +
                                      "\n}\n}];");
        UnityAppController.WriteBelow("::printf(\"-> applicationDidEnterBackground()\\n\");\n}",
                                      "\n - (BOOL)application:(UIApplication *)app\n            openURL:(NSURL *)url\n            " +
                                      "options:(NSDictionary<NSString *,id> *)options\n{\n    " +
                                      "return [WXApi handleOpenURL:url delegate:[WXApiManager sharedManager]];\n}");
    }
Esempio n. 28
0
 public void EditCode(XClass code)
 {
     if (type == EditType.WriteBelow)
     {
         code.WriteBelow(key, value);
     }
     else if (type == EditType.Replace)
     {
         code.Replace(key, value);
     }
 }
Esempio n. 29
0
        private static void EditorCode(string filePath)
        {
            // load UnityAppController.mm
            UnityEngine.Debug.Log("EditorCode: " + filePath);
            XClass unityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");

            // add codes
            string codes = "#include \"AllLifecycleRegister.h\"";//add_flag

            unityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", codes);

            if (!unityAppController.isExist("continueUserActivity:"))
            {
            #if (UNITY_5 || UNITY_5_3_OR_NEWER)
                unityAppController.WriteBelow("SensorsCleanup();\n}", "- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler\r{\r    return YES;\r}");
            #else
                unityAppController.WriteBelow("UnityCleanup();\n}", "- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler\r{\r    return YES;\r}");
            #endif
            }
        }
Esempio n. 30
0
    private static void EditorCode(string filePath)
    {
        XClass UnityAppController = new XClass(filePath + "/Classes/UnityAppController.mm");

        //Add header
        UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#include <E758SdkFramework/ThirdPartyLoginController.h>");


        UnityAppController.AddInFunction("(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions", "[ThirdPartyLoginController ThirdPartyLoginInit:application :launchOptions];");

        UnityAppController.ChangeFunctionReturn("(BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation", "return [ThirdPartyLoginController ThirdPartyLoginCallback :application :url :sourceApplication :annotation ];");
    }