コード例 #1
0
    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);
    }
コード例 #2
0
ファイル: AdsService.cs プロジェクト: Mu-L/UnityCsReference
        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();
            }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
ファイル: GameIdsUi.cs プロジェクト: scarletknight11/OperatAR
        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);
        }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
 public string GetAndroidGameId()
 {
     return(AdvertisementSettings.GetGameId(RuntimePlatform.Android));
 }
コード例 #8
0
 public string GetIOSGameId()
 {
     return(AdvertisementSettings.GetGameId(RuntimePlatform.IPhonePlayer));
 }
コード例 #9
0
 public string GetAndroidGameId() =>
 AdvertisementSettings.GetGameId(RuntimePlatform.Android);
コード例 #10
0
 public string GetAppleTVGameId()
 {
     return(AdvertisementSettings.GetGameId(RuntimePlatform.tvOS));
 }