private static UnityAdsSettings CreateUnityAdsSettings() { UnityAdsSettings settings = (UnityAdsSettings)ScriptableObject.CreateInstance(typeof(UnityAdsSettings)); if (settings != null) { if (!System.IO.Directory.Exists(Application.dataPath + "/Resources")) { AssetDatabase.CreateFolder("Assets", "Resources"); } AssetDatabase.CreateAsset(settings, "Assets/Resources/" + _settingsFile + _settingsFileExtension); #if UNITY_ADS settings.iosGameId = AdvertisementSettings.GetGameId(RuntimePlatform.IPhonePlayer); settings.androidGameId = AdvertisementSettings.GetGameId(RuntimePlatform.Android); settings.overrideAdsServiceInit = !AdvertisementSettings.initializeOnStartup; #endif AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } return(settings); }
void InitializeService() { var iPhoneGameId = AdvertisementSettings.GetGameId(RuntimePlatform.IPhonePlayer); var androidGameId = AdvertisementSettings.GetGameId(RuntimePlatform.Android); //Make sure that the service was enabled as expected, if not refresh the information if (IsServiceEnabled() && (string.IsNullOrEmpty(iPhoneGameId) || string.IsNullOrEmpty(androidGameId))) { RefreshGameIds(); } }
void SetUpGameId() { var unavailableGameId = L10n.Tr("N/A"); // Getting the textfield for updates with the actual GameId values... var appleGameId = AdvertisementSettings.GetGameId(RuntimePlatform.IPhonePlayer); var androidGameId = AdvertisementSettings.GetGameId(RuntimePlatform.Android); var scrollContainer = rootVisualElement.Q(className: k_ServiceScrollContainerClassName); scrollContainer.Q <TextField>(name: k_AppleGameIdName)?.SetValueWithoutNotify(appleGameId ?? unavailableGameId); scrollContainer.Q <TextField>(name: k_AndroidGameIdName)?.SetValueWithoutNotify(androidGameId ?? unavailableGameId); }
public AdsProjectSettings(string path, SettingsScope scopes, IEnumerable <string> keywords = null) : base(path, scopes, k_ServiceName, keywords) { m_StateMachine = new SimpleStateMachine <AdsEvent>(); m_StateMachine.AddEvent(AdsEvent.Enabling); m_StateMachine.AddEvent(AdsEvent.Disabling); m_EnabledState = new EnabledState(m_StateMachine, this); m_DisabledState = new DisabledState(m_StateMachine, this); m_AppleGameId = AdvertisementSettings.GetGameId(RuntimePlatform.IPhonePlayer); m_AndroidGameId = AdvertisementSettings.GetGameId(RuntimePlatform.Android); m_StateMachine.AddState(m_EnabledState); m_StateMachine.AddState(m_DisabledState); }
void SetUpGameIdFor(RuntimePlatform platform, string fieldName) { var gameIdField = m_Container.Q <TextField>(fieldName); if (gameIdField is null) { return; } var gameId = AdvertisementSettings.GetGameId(platform) ?? UiConstants.LocalizedStrings.Unavailable; gameIdField.SetValueWithoutNotify(gameId); }
void FetchMissingGameIdsIfPossible() { if (!AdvertisementSettings.enabled || string.IsNullOrEmpty(CloudProjectSettings.projectId)) { return; } var iosGameId = AdvertisementSettings.GetGameId(RuntimePlatform.IPhonePlayer); var androidGameId = AdvertisementSettings.GetGameId(RuntimePlatform.Android); if (string.IsNullOrEmpty(iosGameId) || string.IsNullOrEmpty(androidGameId)) { new RequestGameIds().SendWithRetry(OnRequestGameIdsCompletedSuccess, OnRequestGameIdsCompletedError); } }
public string GetAndroidGameId() { return(AdvertisementSettings.GetGameId(RuntimePlatform.Android)); }
public string GetIOSGameId() { return(AdvertisementSettings.GetGameId(RuntimePlatform.IPhonePlayer)); }
public string GetAndroidGameId() => AdvertisementSettings.GetGameId(RuntimePlatform.Android);
public string GetAppleTVGameId() { return(AdvertisementSettings.GetGameId(RuntimePlatform.tvOS)); }