Esempio n. 1
0
 // constructorと同じ役割
 private void OnEnable()
 {
     this.setting                 = UAdsSettingHelper.LoadOrCreateUAdsSettings();
     this.adcolonySymbol          = new ScriptDefineSymbol(groups, UAdsSettingHelper.ADCOLONY_DEFINE);
     this.unityMonetizationSymbol = new ScriptDefineSymbol(groups, UAdsSettingHelper.UNITY_MONETIZATION);
     this.enableAdColony          = this.adcolonySymbol.HasDefine();
     this.enableUnityMonetization = this.unityMonetizationSymbol.HasDefine();
 }
Esempio n. 2
0
        public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject)
        {
            if (target != BuildTarget.iOS)
            {
                return;
            }

            var plistPath = pathToBuiltProject + "/Info.plist";
            var plist     = new PlistDocument();

            plist.ReadFromString(File.ReadAllText(plistPath));

            // SKAdNetworkIdentifierのListを取得
            var xml = AssetDatabase.LoadAssetAtPath <TextAsset>("Assets/UAds/Editor/skadnetworks.plist.xml").text;
            var unityAdsSkAdNetworkItems = UnityAdsSKAdNetworkXmlParser.Parse(xml);
            var adcolonySkAdNetworkItems = new HashSet <string>()
            {
                // adcolony
                // https://support.adcolony.com/helpdesk/network-ids-for-skadnetwork-ios-only/
                "4pfyvq9l8r.skadnetwork",
                "yclnxrl5pm.skadnetwork",
                "v72qych5uu.skadnetwork",
                "tl55sbb4fm.skadnetwork",
                "t38b2kh725.skadnetwork",
                "prcb7njmu6.skadnetwork",
                "ppxm28t8ap.skadnetwork",
                "mlmmfzh3r3.skadnetwork",
                "klf5c3l5u5.skadnetwork",
                "hs6bdukanm.skadnetwork",
                "c6k4g5qg8m.skadnetwork",
                "9t245vhmpl.skadnetwork",
                "9rd848q2bz.skadnetwork",
                "8s468mfl3y.skadnetwork",
                "7ug5zh24hu.skadnetwork",
                "4fzdc2evr5.skadnetwork",
                "4468km3ulz.skadnetwork",
                "3rd42ekr43.skadnetwork",
                "2u9pt9hc89.skadnetwork",
                "m8dbw4sv7c.skadnetwork",
                "7rz58n8ntl.skadnetwork",
                "ejvt5qm6ak.skadnetwork",
                "5lm9lj6jb7.skadnetwork",
                "44jx6755aq.skadnetwork",
                "mtkv5xtk9e.skadnetwork",
            };

            // UAdsの設定を取得する
            var settings = UAdsSettingHelper.LoadOrCreateUAdsSettings();

            // 有効になっているものだけ追加するようにする
            var res = new HashSet <string>();

            if (settings.enableUnityMonetization)
            {
                res.UnionWith(unityAdsSkAdNetworkItems.Select(v => v.skAdNetworkIdentifier));
            }
            if (settings.enableAdcolony)
            {
                res.UnionWith(adcolonySkAdNetworkItems);
            }

            // plistに追加
            var rootDict = plist.root;
            var array    = rootDict.CreateArray("SKAdNetworkItems");

            foreach (var item in res)
            {
                var dic = array.AddDict();
                // 小文字じゃないとだめなそうなのでToLowerで小文字化.
                dic.SetString("SKAdNetworkIdentifier", item.ToLower());
            }
            File.WriteAllText(plistPath, plist.WriteToString());
        }