示例#1
0
    private void SwitchAdPlatform(UM_AdPlatform platfrom)
    {
        Debug.Log(platfrom + " Selected.");
        m_adsClient = UM_AdvertisementService.GetClient(platfrom);

        if (m_adsClient == null)
        {
            ShowMessage("Error", "Cleint not configured");
            SetInteractable(false);
        }
        else
        {
            if (m_adsClient.IsInitialized)
            {
                SetInteractable(true);
                ShowMessage(platfrom.ToString(), platfrom.ToString() + " advertesment platfrom is ready to be used.");
            }
            else
            {
                SetInteractable(false);
                m_adsClient.Initialize((result) => {
                    if (result.IsSucceeded)
                    {
                        SetInteractable(true);
                        ShowMessage(platfrom.ToString(), platfrom.ToString() + " advertesment platfrom is ready to be used.");
                    }
                    else
                    {
                        ShowMessage(platfrom.ToString() + " failed to init", result.Error.FullMessage);
                    }
                });
            }
        }
    }
示例#2
0
    private void SwitchAdPlatform(int index)
    {
        string platfromName = m_adCleintsList[index];

        if (platfromName.Equals(NONE_CLIENT_OPTION))
        {
            return;
        }

        UM_AdPlatform platfrom = SA_EnumUtil.ParseEnum <UM_AdPlatform>(platfromName);

        SwitchAdPlatform(platfrom);
    }
示例#3
0
        /// <summary>
        /// Returns ads client based on platfrom.
        /// </summary>
        /// <param name="platfrom">Advertisment platfrom.</param>
        public static UM_iAdsClient GetClient(UM_AdPlatform platfrom)
        {
            if (s_createdClients.ContainsKey(platfrom))
            {
                return(s_createdClients[platfrom]);
            }

            var client = CreateClient(platfrom);

            s_createdClients.Add(platfrom, client);

            return(client);
        }
示例#4
0
        private static UM_iAdsClient CreateClient(UM_AdPlatform platfrom)
        {
            if (Application.isEditor)
            {
                return(new UM_EditorAdsClient());
            }

            switch (platfrom)
            {
            case UM_AdPlatform.Google:
                return(UM_GoogleAdsClientProxy.CreateAdsClient());

            case UM_AdPlatform.Unity:
                return(new UM_UnityAdsClient());
            }

            return(null);
        }