public override void EnterState()
            {
                var generalTemplate = EditorGUIUtility.Load(k_AdsDisabledUxmlPath) as VisualTreeAsset;
                var scrollContainer = provider.rootVisualElement.Q(null, k_ServiceScrollContainerClassName);

                scrollContainer.Clear();
                if (generalTemplate != null)
                {
                    var newVisual = generalTemplate.CloneTree().contentContainer;
                    ServicesUtils.TranslateStringsInTree(newVisual);
                    scrollContainer.Add(newVisual);

                    var gettingStarted = scrollContainer.Q(k_GettingStartedLink);
                    if (gettingStarted != null)
                    {
                        var clickable = new Clickable(() =>
                        {
                            Application.OpenURL(ServicesConfiguration.instance.adsGettingStartedUrl);
                        });
                        gettingStarted.AddManipulator(clickable);
                    }
                    provider.UpdateServiceToggleAndDashboardLink(provider.serviceInstance.IsServiceEnabled());
                }
                scrollContainer.Add(ServicesUtils.SetupSupportedPlatformsBlock(ServicesUtils.GetAdsSupportedPlatforms()));
                provider.HandlePermissionRestrictedControls();
            }
Example #2
0
            public override void EnterState()
            {
                // Just get the latest state of the asset store package installation...
                VerifyAssetStorePackageInstallation();

                if (assetStorePackageInstalled && !m_AssetStoreWarningHasBeenShown)
                {
                    NotificationManager.instance.Publish(Notification.Topic.AdsService, Notification.Severity.Warning, L10n.Tr(k_AdsAssetStorePackageInstalledWarning));
                    m_AssetStoreWarningHasBeenShown = true;
                }

                // If we haven't received new bound info, fetch them
                var generalTemplate = EditorGUIUtility.Load(k_AdsEnabledUxmlPath) as VisualTreeAsset;
                var scrollContainer = provider.rootVisualElement.Q(null, k_ServiceScrollContainerClassName);

                if (generalTemplate != null)
                {
                    var newVisual = generalTemplate.CloneTree().contentContainer;
                    ServicesUtils.TranslateStringsInTree(newVisual);
                    scrollContainer.Clear();
                    scrollContainer.Add(newVisual);
                    var learnMore = scrollContainer.Q(k_LearnMoreLink);
                    if (learnMore != null)
                    {
                        var clickable = new Clickable(() =>
                        {
                            Application.OpenURL(ServicesConfiguration.instance.adsLearnMoreUrl);
                        });
                        learnMore.AddManipulator(clickable);
                    }
                    var toggleTestMode = scrollContainer.Q <Toggle>(k_ToggleTestModeName);
                    if (toggleTestMode != null)
                    {
                        toggleTestMode.SetValueWithoutNotify(AdvertisementSettings.testMode);
                        toggleTestMode.RegisterValueChangedCallback(evt =>
                        {
                            AdvertisementSettings.testMode = evt.newValue;
                        });
                    }

                    // Prepare the package section and update the package information
                    PreparePackageSection(scrollContainer);
                    UpdatePackageInformation();

                    // Getting the textfield for updates with the actual GameId values...
                    m_AppleGameIdTextField   = scrollContainer.Q <TextField>(k_AppleGameIdName);
                    m_AndroidGameIdTextField = scrollContainer.Q <TextField>(k_AndroidGameIdName);
                    provider.SetUpGameId();
                    scrollContainer.Add(ServicesUtils.SetupSupportedPlatformsBlock(ServicesUtils.GetAdsSupportedPlatforms()));

                    provider.HandlePermissionRestrictedControls();
                }
                // Refresh the game Id when entering the ON state...
                provider.RequestAdsGameIds();
            }