Beispiel #1
0
        private void OnGUI()
        {
            ValidateLicenseDirectory();

            using (GUI.AlignBlock.Center)
                GUILayout.Box(IconManager.GetAGXUnityLogo(),
                              GUI.Skin.customStyles[3],
                              GUILayout.Width(System.Math.Min(400.0f, position.width - 20.0f)),
                              GUILayout.Height(100));

            EditorGUILayout.LabelField("© " + System.DateTime.Now.Year + " Algoryx Simulation AB",
                                       InspectorEditor.Skin.LabelMiddleCenter);

            InspectorGUI.BrandSeparator(1, 6);

            m_scroll = EditorGUILayout.BeginScrollView(m_scroll);

            if (IsUpdatingLicenseInformation)
            {
                ShowNotification(GUI.MakeLabel("Reading..."));
            }
            else if (AGXUnity.LicenseManager.IsBusy)
            {
                ShowNotification(GUI.MakeLabel(AGXUnity.LicenseManager.IsActivating ?
                                               "Activating..." :
                                               "Refreshing..."));
            }

            using (new GUI.EnabledBlock(!IsUpdatingLicenseInformation && !AGXUnity.LicenseManager.IsBusy)) {
                for (int i = 0; i < m_licenseData.Count; ++i)
                {
                    var data = m_licenseData[i];
                    LicenseDataGUI(data);
                    if (i + 1 < m_licenseData.Count)
                    {
                        InspectorGUI.Separator(2, 6, InspectorGUISkin.BrandColorBlue);
                    }
                }

                if (m_licenseData.Count > 0)
                {
                    InspectorGUI.Separator(2, 6, InspectorGUISkin.BrandColorBlue);
                }

                ActivateLicenseGUI();
            }

            InspectorGUI.BrandSeparator(1, 6);

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

            if (InspectorGUI.Link(GUI.MakeLabel("License Manager",
                                                false,
                                                s_licenseManagerUrl)))
            {
                Application.OpenURL(s_licenseManagerUrl);
            }
            if (InspectorGUI.Link(GUI.MakeLabel("Licensing AGX Dynamics for Unity",
                                                false,
                                                s_licensingUrl)))
            {
                Application.OpenURL(s_licensingUrl);
            }
            if (InspectorGUI.Link(GUI.MakeLabel("Free Trial",
                                                false,
                                                s_freeTrialUrl)))
            {
                Application.OpenURL(s_freeTrialUrl);
            }

            EditorGUILayout.EndScrollView();

            if (AGXUnity.LicenseManager.IsBusy || IsUpdatingLicenseInformation)
            {
                Repaint();
            }
        }
Beispiel #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);
        }
        private void OnGUI()
        {
            AboutWindow.AGXDynamicsForUnityLogoGUI();

            EditorGUILayout.LabelField(GUI.MakeLabel("Current version"),
                                       GUI.MakeLabel(m_currentVersion.IsValid ?
                                                     m_currentVersion.VersionStringShort :
                                                     "git checkout",
                                                     Color.white));
            using (new EditorGUILayout.HorizontalScope()) {
                var newVersionAvailable = m_serverVersion.IsValid && m_serverVersion > m_currentVersion;
                EditorGUILayout.LabelField(GUI.MakeLabel("Latest version"),
                                           GUI.MakeLabel(m_serverVersion.IsValid ?
                                                         m_serverVersion.VersionStringShort :
                                                         "...",
                                                         newVersionAvailable ?
                                                         Color.Lerp(Color.green, Color.black, 0.35f) :
                                                         Color.white),
                                           InspectorEditor.Skin.Label);
                GUILayout.FlexibleSpace();
                if (newVersionAvailable && InspectorGUI.Link(GUI.MakeLabel("Changelog")))
                {
                    Application.OpenURL(TopMenu.AGXUnityChangelogURL);
                }
                else if (!newVersionAvailable)
                {
                    GUILayout.Label("", InspectorEditor.Skin.Label);
                }
            }

            InspectorGUI.Separator(1, 4);

            var isUpToDate = m_currentVersion.IsValid &&
                             m_serverVersion.IsValid &&
                             m_currentVersion >= m_serverVersion;

            if (isUpToDate)
            {
                EditorGUILayout.LabelField(GUI.MakeLabel("The version of AGX Dynamics for Unity is up to date.",
                                                         Color.Lerp(Color.green, Color.black, 0.35f)),
                                           InspectorEditor.Skin.TextAreaMiddleCenter);
            }
            else if (m_status == Status.Passive)
            {
                if (Web.RequestHandler.Get(@"https://us.download.algoryx.se/AGXUnity/latest.php",
                                           OnPackageNameRequest))
                {
                    m_status = Status.CheckingForUpdate;
                }
            }
            else if (m_status == Status.CheckingForUpdate)
            {
                Repaint();
            }
            else
            {
                if (m_serverVersion.IsValid)
                {
                    HandleDownloadInstall();
                    if (m_status == Status.Downloading)
                    {
                        Repaint();
                    }
                }
            }

            var manualPackageButtonSize = new Vector2(110, EditorGUIUtility.singleLineHeight);
            var manualPackageRect       = new Rect(maxSize - manualPackageButtonSize - new Vector2(2.0f * EditorGUIUtility.standardVerticalSpacing,
                                                                                                   2.0f * EditorGUIUtility.standardVerticalSpacing),
                                                   manualPackageButtonSize);
            var manualSelectPressed = false;

            using (new GUI.EnabledBlock(m_status != Status.Installing && m_status != Status.Downloading))
                manualSelectPressed = UnityEngine.GUI.Button(manualPackageRect,
                                                             GUI.MakeLabel("Manual select..."),
                                                             InspectorEditor.Skin.Button);
            if (manualSelectPressed)
            {
                if (!Directory.Exists(GetManualPackageDirectoryData().String))
                {
                    GetManualPackageDirectoryData().String = "Assets";
                }
                var manualPackageFilename = EditorUtility.OpenFilePanelWithFilters("AGX Dynamics for Unity package",
                                                                                   GetManualPackageDirectoryData().String,
                                                                                   new string[]
                {
                    "AGXUnity package",
                    "*.*.*unitypackage"
                });
                if (!string.IsNullOrEmpty(manualPackageFilename))
                {
                    var manualTargetFileInfo = new FileInfo(manualPackageFilename);
                    GetManualPackageDirectoryData().String = manualTargetFileInfo.Directory.FullName;

                    if (!manualTargetFileInfo.Exists)
                    {
                        Debug.LogWarning($"The target package \"{manualTargetFileInfo.FullName}\" doesn't exist. Aborting.");
                    }
                    else if (!VersionInfo.Parse(manualTargetFileInfo.Name).IsValid)
                    {
                        Debug.LogWarning($"Unable to parse version from package name \"{manualTargetFileInfo.Name}\". Aborting.");
                    }
                    else if (!manualTargetFileInfo.Name.StartsWith("AGXDynamicsForUnity-"))
                    {
                        Debug.LogWarning($"Package name \"{manualTargetFileInfo.Name}\" doesn't seems to be an AGX Dynamics for Unity package. Aborting.");
                    }
                    else if (EditorUtility.DisplayDialog("AGX Dynamics for Unity update",
                                                         "AGX Dynamics for Unity is about to be updated/downgraded " +
                                                         "to version " +
                                                         VersionInfo.Parse(manualTargetFileInfo.Name).VersionString +
                                                         ".\n\nDo you want to continue with the update/downgrade?",
                                                         "Continue",
                                                         "Cancel"))
                    {
                        Target   = manualTargetFileInfo.FullName;
                        m_status = Status.AwaitInstall;
                        InstallTarget();
                    }
                }
            }
        }
Beispiel #4
0
        private void OnGUI()
        {
            GUILayout.BeginHorizontal(GUILayout.Width(570));
            GUILayout.Box(IconManager.GetAGXUnityLogo(),
                          GUI.Skin.customStyles[3],
                          GUILayout.Width(400),
                          GUILayout.Height(100));
            GUILayout.EndHorizontal();

            EditorGUILayout.LabelField("© " + System.DateTime.Now.Year + " Algoryx Simulation AB",
                                       InspectorEditor.Skin.LabelMiddleCenter);

            InspectorGUI.BrandSeparator(1, 6);

            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 fieldOkColor = Color.Lerp(Color.green,
                                          Color.black,
                                          0.35f);
            var fieldWarningColor = Color.Lerp(Color.yellow,
                                               Color.black,
                                               0.45f);

            var versionInfo = PackageUpdateHandler.FindCurrentVersion();

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

            string agxDynamicsVersion = s_agxInfo.Version;

            if (string.IsNullOrEmpty(agxDynamicsVersion))
            {
                agxDynamicsVersion = GUI.AddColorTag("Unknown",
                                                     fieldErrorColor);
            }
            else
            {
                agxDynamicsVersion = GUI.AddColorTag(agxDynamicsVersion,
                                                     fieldColor);
            }
            EditorGUILayout.LabelField(GUI.MakeLabel("AGX Dynamics version"),
                                       GUI.MakeLabel(agxDynamicsVersion),
                                       InspectorEditor.Skin.Label);

            EditorGUILayout.LabelField(GUI.MakeLabel(s_agxInfo.LicenseExpired ?
                                                     "License expired" :
                                                     "License expires"),
                                       s_agxInfo.ValidEndDate ?
                                       GUI.MakeLabel(s_agxInfo.EndDate.ToString("yyyy-MM-dd") +
                                                     GUI.AddColorTag($" ({s_agxInfo.DiffString} {(s_agxInfo.LicenseExpired ? "ago" : "remaining")})",
                                                                     s_agxInfo.LicenseExpired ?
                                                                     fieldErrorColor :
                                                                     s_agxInfo.IsLicenseAboutToBeExpired(10) ?
                                                                     fieldWarningColor :
                                                                     fieldOkColor),
                                                     fieldColor) :
                                       GUI.MakeLabel("License not found", fieldErrorColor),
                                       InspectorEditor.Skin.Label);

            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);
        }