Exemple #1
0
        private void LicenseDataGUI(LicenseData data)
        {
            var highlight = m_licenseData.Count > 1 &&
                            !IsUpdatingLicenseInformation &&
                            !AGXUnity.LicenseManager.IsBusy &&
                            data.LicenseInfo.UniqueId == AGXUnity.LicenseManager.LicenseInfo.UniqueId;

            if (highlight && m_activeLicenseStyle == null)
            {
                m_activeLicenseStyle = new GUIStyle(InspectorEditor.Skin.Label);
            }
            // The texture is deleted when hitting stop in the editor while
            // m_activeLicenseStyle != null.
            if (m_activeLicenseStyle != null && m_activeLicenseStyle.normal.background == null)
            {
                m_activeLicenseStyle.normal.background = GUI.CreateColoredTexture(1,
                                                                                  1,
                                                                                  Color.Lerp(InspectorGUI.BackgroundColor,
                                                                                             Color.green,
                                                                                             0.025f));
            }

            var licenseFileButtons = new InspectorGUI.MiscButtonData[]
            {
                InspectorGUI.MiscButtonData.Create(MiscIcon.Update,
                                                   () =>
                {
                    RefreshLicense(data);
                },
                                                   UnityEngine.GUI.enabled &&
                                                   data.LicenseInfo.Type == AGXUnity.LicenseInfo.LicenseType.Service,
                                                   "Refresh license from server."),
                InspectorGUI.MiscButtonData.Create(MiscIcon.EntryRemove,
                                                   () =>
                {
                    var deactivateDelete = EditorUtility.DisplayDialog("Deactivate and erase license.",
                                                                       "Would you like to deactivate the current license " +
                                                                       "and remove the license file from this project?\n\n" +
                                                                       "It's possible to activate the license again in this " +
                                                                       "License Manager and/or download the license file again " +
                                                                       "from the license portal.",
                                                                       "Yes",
                                                                       "Cancel");
                    if (deactivateDelete)
                    {
                        AGXUnity.LicenseManager.DeactivateAndDelete(data.Filename);
                        StartUpdateLicenseInformation();
                    }
                },
                                                   UnityEngine.GUI.enabled,
                                                   "Deactivate and erase license file from project.")
            };

            var highlightScope = highlight ? new EditorGUILayout.VerticalScope(m_activeLicenseStyle) : null;

            InspectorGUI.SelectableTextField(GUI.MakeLabel("License file"),
                                             data.Filename,
                                             licenseFileButtons);
            InspectorGUI.SelectableTextField(GUI.MakeLabel("License type"), data.LicenseInfo.TypeDescription);

            InspectorGUI.Separator(1, 6);

            InspectorGUI.LicenseEndDateField(data.LicenseInfo);

            EditorGUILayout.EnumFlagsField(GUI.MakeLabel("Enabled modules",
                                                         false,
                                                         data.LicenseInfo.EnabledModules.ToString()),
                                           data.LicenseInfo.AllModulesEnabled ?
                                           AGXUnity.LicenseInfo.Module.All :
                                           data.LicenseInfo.EnabledModules,
                                           false,
                                           InspectorEditor.Skin.Popup);

            InspectorGUI.SelectableTextField(GUI.MakeLabel("User"), data.LicenseInfo.User);

            InspectorGUI.SelectableTextField(GUI.MakeLabel("Contact"), data.LicenseInfo.Contact);
            highlightScope?.Dispose();
        }
Exemple #2
0
        private void OnGUI()
        {
            AGXDynamicsForUnityLogoGUI();

            EditorGUILayout.LabelField(GUI.MakeLabel("Thank you for using AGX Dynamics for Unity!", true),
                                       InspectorEditor.Skin.LabelMiddleCenter);

            GUILayout.Space(6);

            var fieldColor = EditorGUIUtility.isProSkin ?
                             Color.white :
                             Color.black;
            var fieldErrorColor = Color.Lerp(Color.red,
                                             Color.black,
                                             0.25f);

            var versionInfo = PackageUpdateHandler.FindCurrentVersion();

            InspectorGUI.SelectableTextField(GUI.MakeLabel("Version"),
                                             (versionInfo.IsValid ?
                                              versionInfo.VersionString :
                                              "git checkout").Color(fieldColor),
                                             InspectorEditor.Skin.Label);

            string agxDynamicsVersion = s_agxInfo.Version;

            if (string.IsNullOrEmpty(agxDynamicsVersion))
            {
                agxDynamicsVersion = GUI.AddColorTag("Unknown",
                                                     fieldErrorColor);
            }
            else
            {
                agxDynamicsVersion = GUI.AddColorTag(agxDynamicsVersion,
                                                     fieldColor);
            }

            InspectorGUI.SelectableTextField(GUI.MakeLabel("AGX Dynamics version"),
                                             agxDynamicsVersion,
                                             InspectorEditor.Skin.Label);

            InspectorGUI.LicenseEndDateField(s_agxInfo);

            InspectorGUI.BrandSeparator(1, 8);

            GUILayout.Label(GUI.MakeLabel("Online Documentation", true), InspectorEditor.Skin.Label);

            using (new EditorGUILayout.HorizontalScope(GUILayout.Width(200))) {
                if (InspectorGUI.Link(GUI.MakeLabel("AGX Dynamics for Unity")))
                {
                    Application.OpenURL(TopMenu.AGXDynamicsForUnityManualURL);
                }
                GUILayout.Label(" - ", InspectorEditor.Skin.Label);
                if (InspectorGUI.Link(GUI.MakeLabel("Examples")))
                {
                    Application.OpenURL(TopMenu.AGXDynamicsForUnityExamplesURL);
                }
            }

            using (new EditorGUILayout.HorizontalScope(GUILayout.Width(200))) {
                if (InspectorGUI.Link(GUI.MakeLabel("AGX Dynamics user manual")))
                {
                    Application.OpenURL(TopMenu.AGXUserManualURL);
                }
                GUILayout.Label(" - ", InspectorEditor.Skin.Label);
                if (InspectorGUI.Link(GUI.MakeLabel("AGX Dynamics API Reference")))
                {
                    Application.OpenURL(TopMenu.AGXAPIReferenceURL);
                }
            }

            InspectorGUI.BrandSeparator(1, 8);

            GUILayout.Label("Support", EditorStyles.boldLabel);
            EditorGUILayout.SelectableLabel("Please refer to the information received when purchasing your license for support contact information.",
                                            InspectorEditor.Skin.LabelWordWrap);
        }