private void OnGUI() { using (GUI.AlignBlock.Center) GUILayout.Box(IconManager.GetAGXUnityLogo(), GUI.Skin.customStyles[3], GUILayout.Width(400), GUILayout.Height(100)); EditorGUILayout.LabelField("© " + System.DateTime.Now.Year + " Algoryx Simulation AB", InspectorEditor.Skin.LabelMiddleCenter); InspectorGUI.BrandSeparator(1, 6); var agxLfxColor = Color.Lerp(Color.green, Color.black, 0.35f); var encryptedFilename = $"agx{AGXUnity.LicenseManager.GetRuntimeActivationExtension()}".Color(agxLfxColor); var serviceFilename = $"agx{AGXUnity.LicenseManager.GetLicenseExtension( AGXUnity.LicenseInfo.LicenseType.Service )}".Color(agxLfxColor); InspectorGUI.ToolDescription("Generate an AGX Dynamics for Unity runtime activation file containing " + "encrypted License Id and Activation Code bound to the application. The " + "generated runtime activation file (" + encryptedFilename + ") will be replaced " + "with a hardware locked " + serviceFilename + " if the activation is successful.\n\n" + "<b>Internet access is required during the activation on the target hardware.</b>"); InspectorGUI.Separator(1, 6); InspectorGUI.SelectFolder(GUI.MakeLabel("Build directory"), BuildDirectory, "Build directory", newBuildDirectory => { if (!Directory.Exists(newBuildDirectory)) { Debug.LogWarning($"Ignoring given build path {newBuildDirectory} doesn't exist."); return; } BuildDirectory = newBuildDirectory; // Reset reference file if it doesn't exist in the new build directory hierarchy. if (!File.Exists(ReferenceFileInBuildFull)) { m_referenceFileInBuild = string.Empty; } }); InspectorGUI.SelectFile(GUI.MakeLabel("Reference file"), ReferenceFileInBuild, "Select reference file in build", BuildDirectory, newFilename => { ReferenceFileInBuild = newFilename; }); m_idPassword.Id = EditorGUILayout.TextField(GUI.MakeLabel("Runtime License Id"), m_idPassword.Id, InspectorEditor.Skin.TextField); if (m_idPassword.Id.Any(c => !char.IsDigit(c))) { m_idPassword.Id = new string( m_idPassword.Id.Where(c => char.IsDigit(c)).ToArray()); } m_idPassword.Password = EditorGUILayout.PasswordField(GUI.MakeLabel("Runtime Activation Code"), m_idPassword.Password); var generateToolTip = string.Empty; using (new GUI.EnabledBlock(ValidateGenerate(ref generateToolTip))) { GUILayout.Space(3); if (GUILayout.Button(GUI.MakeLabel("Generate", false, generateToolTip))) { var generatedFilename = string.Empty; if (AGXUnity.LicenseManager.GenerateEncryptedRuntime(System.Convert.ToInt32(m_idPassword.Id), m_idPassword.Password, BuildDirectory, ReferenceFileInBuild, filename => generatedFilename = filename)) { EditorUtility.DisplayDialog("Encrypted Runtime License", $"Encrypted runtime successfully written to: {generatedFilename}", "Ok"); Close(); } } } }