示例#1
0
        internal void Apply()
        {
            if (on)
            {
                DefineSymbolsHelper.Add(DefineSymbolsHelper.SMARTADS);
            }
            else
            {
                DefineSymbolsHelper.Remove(DefineSymbolsHelper.SMARTADS);
            }

            if (debugNotifications)
            {
                DefineSymbolsHelper.Add(DefineSymbolsHelper.DEBUG_NOTIFICATIONS);
            }
            else
            {
                DefineSymbolsHelper.Remove(DefineSymbolsHelper.DEBUG_NOTIFICATIONS);
            }

            foreach (var handler in handlers)
            {
                var networks = getEnabled(handler);

                if (handler.IsEnabled() != on ||
                    !handler.GetNetworks().SequenceEqual(networks) ||
                    handler.AreDebugNotificationsEnabled() != debugNotifications ||
                    handler.AreDownloadsStale())
                {
                    handler.ApplyChanges(on, networks, debugNotifications);
                }
            }
        }
        static void Update()
        {
            bool refresh = false;

            if (EditorUserBuildSettings.development != isDevelopment)
            {
                isDevelopment = EditorUserBuildSettings.development;
                refresh       = true;
            }

            #if UNITY_5_5_OR_NEWER
            var newVersion = PlayerSettings.iOS.targetOSVersionString.ToString();
            #elif UNITY_5_OR_NEWER
            var newVersion = PlayerSettings.iOS.targetOSVersionString.ToString().Substring(4).Replace('_', '.');
            #else
            var newVersion = PlayerSettings.iOS.targetOSVersion.ToString().Substring(4).Replace('_', '.');
            #endif
            if (!newVersion.Equals(iosMinTargetVersion))
            {
                iosMinTargetVersion = newVersion;
                refresh             = true;
            }

            if (refresh)
            {
                Networks instance = new AndroidNetworks();
                instance.ApplyChanges(
                    instance.IsEnabled(),
                    instance.GetNetworks(),
                    isDevelopment && instance.AreDebugNotificationsEnabled());

                var smartAdsOn = instance.IsEnabled();
                isDebugNotifications = isDevelopment && instance.AreDebugNotificationsEnabled();

                instance = new IosNetworks();
                instance.ApplyChanges(
                    instance.IsEnabled(),
                    instance.GetNetworks(),
                    isDevelopment && instance.AreDebugNotificationsEnabled());

                smartAdsOn           = smartAdsOn && instance.IsEnabled();
                isDebugNotifications = isDebugNotifications && instance.AreDebugNotificationsEnabled();

                if (smartAdsOn)
                {
                    DefineSymbolsHelper.Add(DefineSymbolsHelper.SMARTADS);
                }
                else
                {
                    DefineSymbolsHelper.Remove(DefineSymbolsHelper.SMARTADS);
                }

                if (isDevelopment)
                {
                    if (isDebugNotifications)
                    {
                        DefineSymbolsHelper.Add(DefineSymbolsHelper.DEBUG_NOTIFICATIONS);
                    }
                    else
                    {
                        DefineSymbolsHelper.Remove(DefineSymbolsHelper.DEBUG_NOTIFICATIONS);
                    }
                }
                else
                {
                    DefineSymbolsHelper.Remove(DefineSymbolsHelper.DEBUG_NOTIFICATIONS);
                }
            }
        }