Esempio n. 1
0
 void BindProject(ProjectInfoData projectInfo)
 {
     UnityConnect.instance.BindProject(projectInfo.guid, projectInfo.name, projectInfo.organizationId);
     EditorAnalytics.SendProjectServiceBindingEvent(new ProjectBindState()
     {
         bound = true, projectName = projectInfo.name
     });
     NotificationManager.instance.Publish(Notification.Topic.ProjectBind, Notification.Severity.Info, L10n.Tr(k_ProjectLinkSuccessMessage));
 }
Esempio n. 2
0
        protected override void ActivateAction(string searchContext)
        {
            // Must reset properties every time this is activated
            rootVisualElement.Add(m_GeneralTemplate.CloneTree().contentContainer);

            //If we haven't received new bound info, fetch them
            var projectInfoOnBind = new ProjectInfoData(UnityConnect.instance.projectInfo.organizationId,
                                                        UnityConnect.instance.projectInfo.organizationName,
                                                        UnityConnect.instance.projectInfo.projectName,
                                                        UnityConnect.instance.projectInfo.projectGUID,
                                                        UnityConnect.instance.projectInfo.projectId);
            var generalTemplate = EditorGUIUtility.Load(k_TemplatePath) as VisualTreeAsset;
            var scrollContainer = rootVisualElement.Q(className: k_ScrollContainerClassName);

            scrollContainer.Clear();
            scrollContainer.Add(generalTemplate.CloneTree().contentContainer);
            SetupCoppaManager(scrollContainer);

            //Collect Field Blocks entry points and initialize them
            var projectNameFieldBlock  = rootVisualElement.Q(k_ProjectNameBlockName);
            var organizationFieldBlock = rootVisualElement.Q(k_OrganizationBlockName);
            var projectIdFieldBlock    = rootVisualElement.Q(k_ProjectIdBlockName);
            var dashboardFieldBlock    = rootVisualElement.Q(k_DashboardBlockName);

            InitializeFieldBlock(projectNameFieldBlock, projectInfoOnBind.name);
            InitializeFieldBlock(organizationFieldBlock, projectInfoOnBind.organizationName);
            InitializeFieldBlock(projectIdFieldBlock, projectInfoOnBind.guid);
            InitializeFieldBlock(dashboardFieldBlock);

            //Setup dashboard link
            var dashboardClickable = new Clickable(() =>
            {
                var dashboardUrl = ServicesConfiguration.instance.GetCurrentProjectDashboardUrl();
                EditorAnalytics.SendOpenDashboardForService(new OpenDashboardForService()
                {
                    serviceName = (serviceInstance != null) ? serviceInstance.name : k_GeneralLabel, url = dashboardUrl
                });
                Application.OpenURL(dashboardUrl);
            });

            rootVisualElement.Q(k_DashboardBlockName).AddManipulator(dashboardClickable);

            projectIdFieldBlock.Q <Button>(k_ProjectIdSubmitButtonName).clicked += UnbindProject;
            HandlePermissionRestrictedControls();
        }
Esempio n. 3
0
        protected override void ActivateAction(string searchContext)
        {
            // Must reset properties every time this is activated
            rootVisualElement.Add(m_GeneralTemplate.CloneTree().contentContainer);
            rootVisualElement.AddStyleSheetPath(ServicesUtils.StylesheetPath.servicesWindowCommon);
            rootVisualElement.AddStyleSheetPath(EditorGUIUtility.isProSkin ? ServicesUtils.StylesheetPath.servicesWindowDark : ServicesUtils.StylesheetPath.servicesWindowLight);
            rootVisualElement.AddStyleSheetPath(ServicesUtils.StylesheetPath.servicesCommon);
            rootVisualElement.AddStyleSheetPath(EditorGUIUtility.isProSkin ? ServicesUtils.StylesheetPath.servicesDark : ServicesUtils.StylesheetPath.servicesLight);

            //If we haven't received new bound info, fetch them
            var projectInfoOnBind = new ProjectInfoData(UnityConnect.instance.projectInfo.organizationId,
                                                        UnityConnect.instance.projectInfo.projectName,
                                                        UnityConnect.instance.projectInfo.projectGUID);
            var generalTemplate = EditorGUIUtility.Load(k_TemplatePath) as VisualTreeAsset;
            var scrollContainer = rootVisualElement.Q(className: k_ScrollContainerClassName);

            scrollContainer.Clear();
            scrollContainer.Add(generalTemplate.CloneTree().contentContainer);
            SetupCoppaManager(scrollContainer);

            //Collect Field Blocks entry points and initialize them
            var projectNameFieldBlock  = rootVisualElement.Q(k_ProjectNameBlockName);
            var organizationFieldBlock = rootVisualElement.Q(k_OrganizationBlockName);
            var projectIdFieldBlock    = rootVisualElement.Q(k_ProjectIdBlockName);
            var dashboardFieldBlock    = rootVisualElement.Q(k_DashboardBlockName);

            InitializeFieldBlock(projectNameFieldBlock, projectInfoOnBind.name);
            InitializeFieldBlock(organizationFieldBlock, projectInfoOnBind.organizationId);
            InitializeFieldBlock(projectIdFieldBlock, projectInfoOnBind.guid);
            InitializeFieldBlock(dashboardFieldBlock);

            //Setup dashboard link
            var dashboardClickable = new Clickable(() =>
            {
                Application.OpenURL(
                    string.Format(ServicesConfiguration.instance.GetCurrentProjectDashboardUrl(),
                                  UnityConnect.instance.projectInfo.organizationId,
                                  UnityConnect.instance.projectInfo.projectGUID));
            });

            rootVisualElement.Q(k_DashboardBlockName).AddManipulator(dashboardClickable);

            projectIdFieldBlock.Q <Button>(k_ProjectIdSubmitButtonName).clicked += UnbindProject;
            HandlePermissionRestrictedControls();
        }