protected override void DrawBuildSettingListElement(Rect rect, int index, bool isActive, bool isFocused) { // Get all the properties SerializedProperty element = Property.GetArrayElementAtIndex(index); // Calculate position rect.height = EditorGUIUtility.singleLineHeight; rect.y += EditorHelpers.VerticalMargin; // Draw a toggle Rect fieldRect = rect; fieldRect.width = rect.height + EditorHelpers.VerticalMargin; HostArchiveSetting setting = (HostArchiveSetting)element.objectReferenceValue; setting.IsEnabled = EditorGUI.Toggle(fieldRect, setting.IsEnabled); // Check whether to enable the next set of UI bool originalEnabled = GUI.enabled; GUI.enabled = false; // Draw the object field fieldRect.x += fieldRect.width; fieldRect.width = rect.width - fieldRect.width; element.objectReferenceValue = EditorGUI.ObjectField(fieldRect, "", element.objectReferenceValue, typeof(IChildBuildSetting), false); GUI.enabled = originalEnabled; // Calculate position rect.y += rect.height; rect.y += EditorHelpers.VerticalMargin; // Draw Edit buttons DrawButtons(rect, element.objectReferenceValue); }
private string AppendDomainListLocation(string originalString, StringBuilder builder) { builder.Clear(); if (parentProperty.objectReferenceValue is WebGlBuildSetting) { // Get folder name int endIndex = originalString.LastIndexOf(Helpers.PathDivider); builder.Append(originalString.Substring(0, endIndex)); builder.Append(Helpers.PathDivider); // Get parent name WebGlBuildSetting setting = (WebGlBuildSetting)parentProperty.objectReferenceValue; builder.Append(setting.FileName.ToString(setting)); builder.Append(Helpers.PathDivider); // Get location from the host itself HostArchiveSetting targetSetting = (HostArchiveSetting)serializedObject.targetObject; builder.Append(targetSetting.LocalDomainListPath); } else { builder.Append("(Field 'Web Domain Verifier' is not set)"); } return(builder.ToString()); }
private void DrawDomainListLocation() { EditorHelpers.DrawBoldFoldout(domainListLocationAnimation, "Local Domain List Path"); // Draw the rest of the controls using (EditorGUILayout.FadeGroupScope fadeScope = new EditorGUILayout.FadeGroupScope(domainListLocationAnimation.faded)) { if (fadeScope.visible == true) { // Draw the rest of the controls DrawFileNamePreview(DrawDomainListLocationControls, AppendDomainListLocation); // Check whether to show custom path HostArchiveSetting targetSetting = (HostArchiveSetting)serializedObject.targetObject; domainListPathAnimation.target = (targetSetting.IsLocalPathInWebDomainVerifierDefined == false); // Animate showing this property using (EditorGUILayout.FadeGroupScope innerFadeScope = new EditorGUILayout.FadeGroupScope(domainListPathAnimation.faded)) { if (innerFadeScope.visible == true) { // Draw the option to fill your own path. EditorGUILayout.HelpBox("Web Domain Verifier does not define a local path to create a Domain List. Specify one below:", MessageType.Info); EditorGUILayout.PropertyField(domainListPath); } } } } }
private void DrawArchiveContents() { EditorHelpers.DrawBoldFoldout(contentAnimation, "Archive Contents"); // Draw the rest of the controls using (EditorGUILayout.FadeGroupScope fadeScope = new EditorGUILayout.FadeGroupScope(contentAnimation.faded)) { if (fadeScope.visible == true) { // Draw the rest of the controls EditorGUILayout.PropertyField(includeIndexHtml); domainList.DoLayoutList(); // Draw the import stuff EditorGUILayout.Space(); UnityEngine.Object testAsset = null; testAsset = EditorGUILayout.ObjectField("Import Domain List", testAsset, typeof(UnityEngine.Object), false); if (testAsset != null) { AssetBundle bundle = null; try { // Load the bundle, and convert it to a domain list bundle = AssetBundle.LoadFromFile(AssetDatabase.GetAssetPath(testAsset)); DomainList domainList = DomainList.Get(bundle); // Decrypt the domain list HostArchiveSetting setting = ((HostArchiveSetting)target); setting.AcceptedDomains = DomainList.Decrypt(domainList, setting.DomainEncrypter); } finally { if (bundle != null) { // Clean-up bundle.Unload(true); } } } } } }