void SetupServiceToggle(SingleService singleService)
        {
            m_MainServiceToggle.SetProperty(k_ServiceNameProperty, singleService.name);
            m_MainServiceToggle.SetValueWithoutNotify(singleService.IsServiceEnabled());
            SetupServiceToggleLabel(m_MainServiceToggle, singleService.IsServiceEnabled());
            m_MainServiceToggle.SetEnabled(false);
            if (m_GoToDashboard != null)
            {
                m_GoToDashboard.style.display = (singleService.IsServiceEnabled()) ? DisplayStyle.Flex : DisplayStyle.None;
            }

            if (singleService.displayToggle)
            {
                m_MainServiceToggle.RegisterValueChangedCallback(evt =>
                {
                    if (currentUserPermission != UserRole.Owner && currentUserPermission != UserRole.Manager)
                    {
                        SetupServiceToggleLabel(m_MainServiceToggle, evt.previousValue);
                        m_MainServiceToggle.SetValueWithoutNotify(evt.previousValue);
                        return;
                    }
                    SetupServiceToggleLabel(m_MainServiceToggle, evt.newValue);
                    singleService.EnableService(evt.newValue);
                    if (m_GoToDashboard != null)
                    {
                        m_GoToDashboard.style.display = (evt.newValue) ? DisplayStyle.Flex : DisplayStyle.None;
                    }
                });
            }
            else
            {
                m_MainServiceToggle.style.display = DisplayStyle.None;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds a new service in the services window list.
        /// Sorting and duplicates are already handled.
        /// Each service has the responsibility to add itself to this list.
        /// This should not be called by a service that isn't registering itself.
        /// </summary>
        /// <param name="singleService">Configuration for the service to add</param>
        public static void AddService(SingleService singleService)
        {
            if (k_Services.ContainsKey(singleService.name))
            {
                return;
            }

            k_Services.Add(singleService.name, singleService);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Adds a new service in the services window list.
        /// Sorting and duplicates are already handled.
        /// Each service has the responsibility to add itself to this list.
        /// This should not be called by a service that isn't registering itself.
        /// </summary>
        /// <param name="singleService">Configuration for the service to add</param>
        public static void AddService(SingleService singleService)
        {
            if (!CanAddService(singleService))
            {
                return;
            }

            k_Services.Add(singleService.name, singleService);
        }
Ejemplo n.º 4
0
        /// <remarks>General rule: do not double add; if Core package exists, do not add services
        /// Exception: Installed services which do not have a hard dependency to Core</remarks>
        static bool CanAddService(SingleService singleService)
        {
            var isServiceAlreadyAdded = k_Services.ContainsKey(singleService.name);

            var isCorePackageInstalled          = PackageHelper.IsCorePackageInstalled();
            var servicePackageInstalled         = PackageHelper.IsPackageInstalled(singleService.editorGamePackageName);
            var servicePackageHasCoreDependency = PackageHelper.HasCoreDependency(singleService.editorGamePackageName);

            return(!isServiceAlreadyAdded &&
                   (!isCorePackageInstalled || (servicePackageInstalled && !servicePackageHasCoreDependency)));
        }
Ejemplo n.º 5
0
        void SetupServiceStatusLabel(VisualElement serviceRoot, SingleService singleService)
        {
            var statusText = serviceRoot.Q <Label>(className: k_ServiceStatusClassName);

            m_StatusLabelByServiceName.Add(singleService.name, statusText);
            SetServiceStatusValue(singleService.name, singleService.IsServiceEnabled());

            if (singleService.displayToggle)
            {
                statusText.style.display = DisplayStyle.Flex;
            }
            else
            {
                statusText.style.display = DisplayStyle.None;
            }
        }
Ejemplo n.º 6
0
        void SetupServiceToggle(SingleService singleService)
        {
            m_MainServiceToggle.SetProperty(k_ServiceNameProperty, singleService.name);
            m_MainServiceToggle.SetValueWithoutNotify(singleService.IsServiceEnabled());
            SetupServiceToggleLabel(m_MainServiceToggle, singleService.IsServiceEnabled());
            m_MainServiceToggle.SetEnabled(false);
            if (m_GoToDashboard != null)
            {
                m_GoToDashboard.style.display = (singleService.IsServiceEnabled()) ? DisplayStyle.Flex : DisplayStyle.None;
            }

            if (singleService.displayToggle)
            {
                m_MainServiceToggle.RegisterValueChangedCallback(evt =>
                {
                    if (currentUserPermission != UserRole.Owner && currentUserPermission != UserRole.Manager)
                    {
                        m_MainServiceToggle.SetValueWithoutNotify(evt.previousValue);
                        SetupServiceToggleLabel(m_MainServiceToggle, evt.previousValue);
                        return;
                    }
                    singleService.EnableService(evt.newValue);
                    if (m_GoToDashboard != null)
                    {
                        m_GoToDashboard.style.display = (evt.newValue) ? DisplayStyle.Flex : DisplayStyle.None;
                    }

                    // When turning off the service, the game ids must be put to null and refetched when reenabled, but when entering the enabled state.
                    SetupServiceToggleLabel(m_MainServiceToggle, evt.newValue);
                    if (!evt.newValue)
                    {
                        m_AppleGameId   = null;
                        m_AndroidGameId = null;
                        SetUpGameId();
                    }
                });
            }
            else
            {
                m_MainServiceToggle.style.display = DisplayStyle.None;
            }
        }
Ejemplo n.º 7
0
        void SetupPackageInstall(VisualElement serviceRoot, SingleService singleService)
        {
            serviceRoot.AddManipulator(m_ClickableByServiceName[singleService.name]);

            var installButton          = serviceRoot.Q <Button>(className: k_ServicePackageInstallClassName);
            var installButtonContainer = serviceRoot.Q(className: k_ServicePackageInstallContainerClassName);

            installButtonContainer.style.display = DisplayStyle.None;

            if (singleService.isPackage && (singleService.packageId != null) && (m_PackageCollection != null))
            {
                SetServiceToUninstalledState(installButton, serviceRoot, singleService);
                bool packageFound = false;
                foreach (var info in m_PackageCollection)
                {
                    if (info.packageId.Contains(singleService.packageId))
                    {
                        packageFound = true;
                        SetServiceToInstalledState(installButton, serviceRoot, singleService);
                        break;
                    }
                }

                if (!packageFound)
                {
                    SetServiceToUninstalledState(installButton, serviceRoot, singleService);

                    installButtonContainer.style.display = DisplayStyle.Flex;
                    installButton.clicked += () =>
                    {
                        var packageId = singleService.packageId;
                        EditorAnalytics.SendOpenPackManFromServiceSettings(new ServicesProjectSettings.OpenPackageManager()
                        {
                            packageName = packageId
                        });
                        PackageManagerWindow.OpenPackageManager(packageId);
                    };
                }
            }
        }
        void SetupServiceToggle(SingleService singleService)
        {
            m_MainServiceToggle.SetProperty(k_ServiceNameProperty, singleService.name);
            m_MainServiceToggle.SetEnabled(false);
            UpdateServiceToggleAndDashboardLink(singleService.IsServiceEnabled());

            if (singleService.displayToggle)
            {
                m_MainServiceToggle.RegisterValueChangedCallback(evt =>
                {
                    if (currentUserPermission != UserRole.Owner && currentUserPermission != UserRole.Manager)
                    {
                        UpdateServiceToggleAndDashboardLink(evt.previousValue);
                        return;
                    }
                    singleService.EnableService(evt.newValue);
                });
            }
            else
            {
                m_MainServiceToggle.style.display = DisplayStyle.None;
            }
        }
Ejemplo n.º 9
0
        void SetupService(VisualElement scrollContainer, VisualTreeAsset serviceTemplate, SingleService singleService)
        {
            scrollContainer.Add(serviceTemplate.CloneTree().contentContainer);
            var serviceIconAsset = EditorGUIUtility.Load(singleService.pathTowardIcon) as Texture2D;
            var serviceRoot      = scrollContainer[scrollContainer.childCount - 1];

            serviceRoot.name = singleService.name;

            var serviceTitle = serviceRoot.Q <TextElement>(className: k_ServiceTitleClassName);

            serviceTitle.text = singleService.title;
            serviceRoot.Q <TextElement>(className: k_ServiceDescriptionClassName).text = singleService.description;
            serviceRoot.Q(className: k_ServiceIconClassName).style.backgroundImage     = serviceIconAsset;

            Action openServiceSettingsLambda = () =>
            {
                SettingsService.OpenProjectSettings(singleService.projectSettingsPath);
            };
            var clickable = new Clickable(openServiceSettingsLambda);

            serviceRoot.AddManipulator(clickable);

            SetupServiceStatusLabel(serviceRoot, singleService);
        }
Ejemplo n.º 10
0
 void SetServiceToInstalledState(Button installButton, VisualElement serviceRoot, SingleService singleService)
 {
     installButton.style.display = DisplayStyle.None;
     serviceRoot.AddManipulator(m_ClickableByServiceName[singleService.name]);
     serviceRoot[0].RemoveFromClassList(k_UninstalledEntryClassName);
     serviceRoot[0].AddToClassList(k_EntryClassName);
     if (singleService.displayToggle)
     {
         SetServiceStatusValue(singleService.name, singleService.IsServiceEnabled());
         m_StatusLabelByServiceName[singleService.name].style.display = DisplayStyle.Flex;
     }
 }
 public static void OpenServicesProjectSettings(SingleService singleService)
 {
     OpenServicesProjectSettings(singleService.projectSettingsPath, singleService.settingsProviderClassName);
 }