Example #1
0
        // 3D Touch相关
        public static void AddExtCode_UIView(string path2BuildProject)
        {
            XClass UnityAppController = new XClass(path2BuildProject + "/Classes/UI/UnityView.mm");

            // 在指定代码后面添加一行
            // 引入头文件
            UnityAppController.WriteBelow("#include \"Unity/UnityMetalSupport.h\"", "#import \"" + url_handle_filename + "\"");

            // touchesMoved接口
            string pos_line = "UnitySendTouchesMoved(touches, event);";
            string content  = "\n\t[SDKProcess touchesMoved:touches withEvent:event];";

            UnityAppController.WriteBelow(pos_line, content);
        }
Example #2
0
        public static void AddExtCode_supportOrientation(string path2BuildProject)
        {
            XClass UnityAppController = new XClass(path2BuildProject + "/Classes/UnityAppController.mm");
            string pos_line           = "// Anyway this is intersected with values provided from UIViewController, so we are good";
            string content            = "\t[SDKProcess application:application supportedInterfaceOrientationsForWindow:window];";

            UnityAppController.WriteBelow(pos_line, content);
        }
Example #3
0
        public static void AddExtCode_HandleURL_Modify(string pathToBuiltProject)
        {
            XClass UnityAppController = new XClass(pathToBuiltProject + "/Classes/UnityAppController.mm");

            // 在指定代码后面添加一行
            // 引入头文件
            UnityAppController.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#import \"" + url_handle_filename + "\"");

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

            // openURL接口
            UnityAppController.WriteBelow("AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);",
                                          "\t[SDKProcess application:application openURL:url sourceApplication:sourceApplication annotation:annotation];");

            // didFinishLaunchingWithOptions接口
            UnityAppController.WriteBelow("::printf(\"-> applicationDidFinishLaunching()\\n\");",
                                          "\t[SDKProcess application:application didFinishLaunchingWithOptions:launchOptions];");

            // applicationDidEnterBackground接口
            UnityAppController.WriteBelow("::printf(\"-> applicationDidEnterBackground()\\n\");",
                                          "\t[SDKProcess applicationDidEnterBackground:application];");

            // applicationWillEnterForeground接口
            UnityAppController.WriteBelow("::printf(\"-> applicationWillEnterForeground()\\n\");",
                                          "\t[SDKProcess applicationWillEnterForeground:application];");

            // applicationDidBecomeActive接口
            UnityAppController.WriteBelow("_didResignActive = false;",
                                          "\t[SDKProcess applicationDidBecomeActive:application];");
        }
Example #4
0
        public static void AddExtCode_HandleURL_Extend(string pathToBuiltProject)
        {
            XClass UnityAppController = new XClass(pathToBuiltProject + "/Classes/UnityAppController.mm");

            UnityAppController.WriteBelow("SensorsCleanup();\n}",
                                          @"
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
	// [SDKProcess application:application handleOpenURL:url];
	[SDKProcess application:application openURL:url sourceApplication:nil annotation:(id)0];

	return YES;
}");
        }