void LoadWindow() { rootVisualElement.Clear(); var mainTemplate = EditorGUIUtility.Load(k_ServicesWindowUxmlPath) as VisualTreeAsset; var serviceTemplate = EditorGUIUtility.Load(k_ServiceTemplateUxmlPath) as VisualTreeAsset; rootVisualElement.AddStyleSheetPath(ServicesUtils.StylesheetPath.servicesWindowCommon); rootVisualElement.AddStyleSheetPath(EditorGUIUtility.isProSkin ? ServicesUtils.StylesheetPath.servicesWindowDark : ServicesUtils.StylesheetPath.servicesWindowLight); mainTemplate.CloneTree(rootVisualElement, new Dictionary <string, VisualElement>(), null); notificationSubscriber = new UIElementsNotificationSubscriber(rootVisualElement); notificationSubscriber.Subscribe( Notification.Topic.AdsService, Notification.Topic.AnalyticsService, Notification.Topic.BuildService, Notification.Topic.CollabService, Notification.Topic.CoppaCompliance, Notification.Topic.CrashService, Notification.Topic.ProjectBind, Notification.Topic.PurchasingService ); var scrollContainer = rootVisualElement.Q(className: k_ScrollContainerClassName); var settingsClickable = new Clickable(() => { SettingsService.OpenProjectSettings(GeneralProjectSettings.generalProjectSettingsPath); }); rootVisualElement.Q(k_ProjectSettingsLinkName).AddManipulator(settingsClickable); var dashboardClickable = new Clickable(() => { if (UnityConnect.instance.projectInfo.projectBound) { Application.OpenURL( string.Format(ServicesConfiguration.instance.GetCurrentProjectDashboardUrl(), UnityConnect.instance.projectInfo.organizationId, UnityConnect.instance.projectInfo.projectGUID)); } else { NotificationManager.instance.Publish(Notification.Topic.ProjectBind, Notification.Severity.Warning, L10n.Tr(k_ProjectNotBoundMessage)); SettingsService.OpenProjectSettings(GeneralProjectSettings.generalProjectSettingsPath); } }); rootVisualElement.Q(k_DashboardLinkName).AddManipulator(dashboardClickable); var sortedServices = new SortedList <string, SingleService>(); foreach (var service in ServicesRepository.GetServices()) { sortedServices.Add(service.title, service); } var footer = scrollContainer.Q(k_FooterName); scrollContainer.Remove(footer); foreach (var singleCloudService in sortedServices.Values) { SetupService(scrollContainer, serviceTemplate, singleCloudService); } scrollContainer.Add(footer); var privacyClickable = new Clickable(() => { Application.OpenURL(k_PrivacyPolicyUrl); }); scrollContainer.Q(k_PrivacyPolicyLinkName).AddManipulator(privacyClickable); }
void LoadWindow() { rootVisualElement.Clear(); var mainTemplate = EditorGUIUtility.Load(k_ServicesWindowUxmlPath) as VisualTreeAsset; rootVisualElement.AddStyleSheetPath(ServicesUtils.StylesheetPath.servicesWindowCommon); rootVisualElement.AddStyleSheetPath(EditorGUIUtility.isProSkin ? ServicesUtils.StylesheetPath.servicesWindowDark : ServicesUtils.StylesheetPath.servicesWindowLight); mainTemplate.CloneTree(rootVisualElement, new Dictionary <string, VisualElement>(), null); notificationSubscriber = new UIElementsNotificationSubscriber(rootVisualElement); notificationSubscriber.Subscribe( Notification.Topic.AdsService, Notification.Topic.AnalyticsService, Notification.Topic.BuildService, Notification.Topic.CollabService, Notification.Topic.CoppaCompliance, Notification.Topic.CrashService, Notification.Topic.ProjectBind, Notification.Topic.PurchasingService ); rootVisualElement.Q <Button>(k_ProjectSettingsBtnName).clicked += () => { SettingsService.OpenProjectSettings(GeneralProjectSettings.generalProjectSettingsPath); }; var dashboardClickable = new Clickable(() => { if (UnityConnect.instance.projectInfo.projectBound) { EditorAnalytics.SendOpenDashboardForService(new ServicesProjectSettings.OpenDashboardForService() { serviceName = k_WindowTitle, url = ServicesConfiguration.instance.baseDashboardUrl, organizationId = UnityConnect.instance.projectInfo.organizationId, projectId = UnityConnect.instance.projectInfo.projectId }); Application.OpenURL(ServicesConfiguration.instance.GetCurrentProjectDashboardUrl()); } else { NotificationManager.instance.Publish(Notification.Topic.ProjectBind, Notification.Severity.Warning, L10n.Tr(k_ProjectNotBoundMessage)); SettingsService.OpenProjectSettings(GeneralProjectSettings.generalProjectSettingsPath); } }); rootVisualElement.Q(k_DashboardLinkName).AddManipulator(dashboardClickable); m_SortedServices = new SortedList <string, SingleService>(); bool needProjectListOfPackage = false; foreach (var service in ServicesRepository.GetServices()) { m_SortedServices.Add(service.title, service); if (service.isPackage && service.packageId != null) { needProjectListOfPackage = true; } } // Only launch the listing if a service really needs the packages list... m_PackageCollection = null; if (needProjectListOfPackage) { m_ListRequestOfPackage = Client.List(); EditorApplication.update += ListingCurrentPackageProgress; } else { FinalizeServiceSetup(); } }