Exemplo n.º 1
0
            public static void InitAndroidFiles(BuildTarget buildTarget, string path)
            {
                if (buildTarget == BuildTarget.Android)
                {
                    YCConfig ycConfig         = YCConfig.Create();
                    string   destManifestPath = Path.Combine(Application.dataPath, "Plugins/Android/AndroidManifest.xml");


                    string content = File.ReadAllText(destManifestPath);
                    System.Text.RegularExpressions.Regex regex1           = new System.Text.RegularExpressions.Regex("<meta-data android:name=\"com\\.facebook\\.sdk\\.ApplicationId\".*");
                    System.Text.RegularExpressions.Regex regex2           = new System.Text.RegularExpressions.Regex("<provider android:name=\"com\\.facebook\\.FacebookContentProvider\" android:authorities=\"com\\.facebook\\.app\\.FacebookContentProvider.*");
                    System.Text.RegularExpressions.Regex regexApplication = new System.Text.RegularExpressions.Regex("</application>");

                    content = regex1.Replace(content, "");
                    content = regex2.Replace(content, "");

                    string newId = "<meta-data android:name=\"com.facebook.sdk.ApplicationId\" android:value=\"fb" + ycConfig.FbAppId + "\" />" + Environment.NewLine +
                                   "<provider android:name=\"com.facebook.FacebookContentProvider\" android:authorities=\"com.facebook.app.FacebookContentProvider" + ycConfig.FbAppId + "\" android:exported=\"true\" />" + Environment.NewLine +
                                   "</application>";

                    content = regexApplication.Replace(content, newId);

                    File.WriteAllText(destManifestPath, content);
                }
            }
Exemplo n.º 2
0
            public void OnPreprocessBuild(BuildReport report)
            {
                YCConfig ycConfig = YCConfig.Create();

                if (ycConfig.gameYcId == "")
                {
                    throw new Exception("[GameUtils] Empty Game Yc Id");
                }
                if (ycConfig.FbAppId == "")
                {
                    throw new Exception("[GameUtils] Empty Fb App Id");
                }
#if UNITY_IOS
                if (ycConfig.AdMobIosAppId == "")
                {
                    throw new Exception("[GameUtils] Empty AdMob IOS Id");
                }
#endif
#if UNITY_ANDROID
                if (ycConfig.AdMobAndroidAppId == "")
                {
                    throw new Exception("[GameUtils] Empty AdMob Android Id");
                }
#endif
                this.SetAppIdFromAppLovinSettings(ycConfig.AdMobIosAppId, ycConfig.AdMobAndroidAppId);
            }
            public static void ChangeXcodePlist(BuildTarget buildTarget, string path)
            {
                if (buildTarget == BuildTarget.iOS)
                {
#if UNITY_IOS
                    YCConfig      ycConfig  = YCConfig.Create();
                    string        plistPath = path + "/Info.plist";
                    PlistDocument plist     = new PlistDocument();
                    plist.ReadFromFile(plistPath);
                    PlistElementDict rootDict = plist.root;

                    PlistElementArray rootCapacities = (PlistElementArray)rootDict.values["UIRequiredDeviceCapabilities"];
                    rootCapacities.values.RemoveAll((PlistElement elem) => {
                        return(elem.AsString() == "metal");
                    });

                    rootDict.SetString("NSCalendarsUsageDescription", "Used to deliver better advertising experience");
                    rootDict.SetString("NSLocationWhenInUseUsageDescription", "Used to deliver better advertising experience");
                    rootDict.SetString("NSPhotoLibraryUsageDescription", "Used to deliver better advertising experience");
                    rootDict.SetString("NSAdvertisingAttributionReportEndpoint", "https://tenjin-skan.com");
                    rootDict.values.Remove("UIApplicationExitsOnSuspend");
                    File.WriteAllText(plistPath, plist.WriteToString());
#endif
                }
            }
            public void OnPreprocessBuild(BuildReport report)
            {
                YCConfig ycConfig = YCConfig.Create();

                if (ycConfig.gameYcId == "")
                {
                    throw new Exception("[GameUtils] Empty Game Yc Id");
                }
                if (ycConfig.FbAppId == "")
                {
                    throw new Exception("[GameUtils] Empty Fb App Id");
                }
                if (Directory.Exists("Assets/MaxSdk/Mediation/Google"))
                {
#if UNITY_IOS
                    if (ycConfig.AdMobIosAppId == "")
                    {
                        throw new Exception("[GameUtils] Empty AdMob IOS Id");
                    }
#elif UNITY_ANDROID
                    if (ycConfig.AdMobAndroidAppId == "")
                    {
                        throw new Exception("[GameUtils] Empty AdMob Android Id");
                    }
#endif
                }
                ycConfig.InitFacebook();
                ycConfig.InitMax();
            }
Exemplo n.º 5
0
            public static void SetFacebook(BuildTarget buildTarget, string path)
            {
                YCConfig ycConfig = YCConfig.Create();

                FacebookSettings.AppIds = new List <string> {
                    ycConfig.FbAppId
                };
                FacebookSettings.AppLabels = new List <string> {
                    Application.productName
                };
            }
Exemplo n.º 6
0
            public void OnPreprocessBuild(BuildReport report)
            {
                YCConfig ycConfig = YCConfig.Create();

                if (ycConfig.gameYcId == "")
                {
                    throw new Exception("[GameUtils] Empty Game Yc Id");
                }
                if (ycConfig.FbAppId == "")
                {
                    throw new Exception("[GameUtils] Empty Fb App Id");
                }
                ycConfig.InitFacebook();
            }