public float CalculateHeight(Dictionary <string, int> frequencyInKeyAppearance) { // Calculate the key height float height = VerticalMargin; height += EditorGUIUtility.singleLineHeight; height += VerticalSpace; // Check if we're showing a warning if ((ShowHelpBox.target == true) || (ShowHelpBox.isAnimating == true)) { // If so, calculate the height of this warning height += EditorUiUtility.GetHelpBoxHeight(LastMessage, Width) * ShowHelpBox.faded; height += VerticalSpace; } // Add one for the fold-out height += EditorGUIUtility.singleLineHeight; // Check if we're showing the translations if ((ShowAllTranslationsList.target == true) || (ShowAllTranslationsList.isAnimating == true)) { // If so, calculate the height of translations height += (translationsList.GetHeight() + VerticalMargin) * ShowAllTranslationsList.faded; } height += VerticalMargin; return(height); }
public float CalculateHeight(Dictionary <int, int> frequencyInLanguageAppearance) { // Calculate the key height float height = VerticalMargin; height += EditorGUIUtility.singleLineHeight; height += VerticalSpace; // Check if we're showing a warning if ((ShowHelpBox.target == true) || (ShowHelpBox.isAnimating == true)) { // If so, calculate the height of this warning height += EditorUiUtility.GetHelpBoxHeight(LastMessage, Width) * ShowHelpBox.faded; height += VerticalSpace; } // Add one for the fold-out height += EditorGUIUtility.singleLineHeight; // If so, calculate the height of translations bool isExpandable; height += GetTextAreaHeight(TextProperty.stringValue, Width, ExpandToggle.faded, out isExpandable); //height += VerticalMargin; height += VerticalMargin; return(height); }
private bool DrawWarningMessage(ref Rect rect, Dictionary <int, int> frequencyInLanguageAppearance) { // Adjust the bools LastMessage = GetWarning(frequencyInLanguageAppearance); ShowHelpBox.target = (string.IsNullOrEmpty(LastMessage) == false); bool isShown = ((ShowHelpBox.target == true) || (ShowHelpBox.isAnimating == true)); if (isShown == true) { // Calculate range of warning float helpBoxHeight = EditorUiUtility.GetHelpBoxHeight(LastMessage, rect.width); rect.height = helpBoxHeight * ShowHelpBox.faded; // Show warning GUI.BeginGroup(rect); Rect helpBox = new Rect(0, 0, rect.width, helpBoxHeight); EditorGUI.HelpBox(helpBox, LastMessage, MessageType.Warning); GUI.EndGroup(); // Adjust the rectangle rect.y += rect.height; } return(isShown); }
protected void DrawDevelopmentSettings() { EditorUiUtility.DrawBoldFoldout(developmentAnimation, "Development Settings"); using (EditorGUILayout.FadeGroupScope scope = new EditorGUILayout.FadeGroupScope(developmentAnimation.faded)) { if (scope.visible == true) { // Show the enabled bool debugEnable.boolValue = EditorGUILayout.Toggle("Enable Debugging", debugEnable.boolValue); debugAnimation.target = debugEnable.boolValue; // Draw the rest of the controls using (new EditorGUI.IndentLevelScope()) using (EditorGUILayout.FadeGroupScope fadeScope = new EditorGUILayout.FadeGroupScope(debugAnimation.faded)) { if (fadeScope.visible == true) { debugEnableScriptDebugging.boolValue = EditorGUILayout.Toggle("Debug Script", debugEnableScriptDebugging.boolValue); debugBuildScriptOnly.boolValue = EditorGUILayout.Toggle("Build Scripts Only", debugBuildScriptOnly.boolValue); } } // Draw checkboxes EditorGUILayout.PropertyField(enableStrictMode); EditorGUILayout.PropertyField(enableAssertions); } } }
protected override void DrawPlatformSpecificSettings() { IStandaloneBuildSetting targetSetting = (IStandaloneBuildSetting)target; EditorUiUtility.DrawEnum(architecture, targetSetting.SupportedArchitectures, targetSetting.DefaultArchitecture, targetSetting.ArchitectureToBuild, "\"{0}\" is not supported for this build platform; \"{1}\" will be used instead."); EditorGUILayout.PropertyField(compression); EditorUiUtility.DrawEnum(scriptingBackend, targetSetting.SupportedScriptingBackends, targetSetting.DefaultScriptingBackend, targetSetting.ScriptingBackend, "\"{0}\" is not supported for this build platform, on this editor; \"{1}\" will be used instead."); }
public void OnEnable() { objectsToPreload = serializedObject.FindProperty("objectsToPreload"); objectsToPreloadList = new ReorderableList(serializedObject, objectsToPreload, true, true, true, true); objectsToPreloadList.drawHeaderCallback = DrawObjectsToPreloadListHeader; objectsToPreloadList.drawElementCallback = DrawObjectsToPreloadListElement; objectsToPreloadList.elementHeight = EditorUiUtility.SingleLineHeight(VerticalMargin); }
public override void OnInspectorGUI() { // Update the serialized object serializedObject.Update(); // Display all fields EditorGUILayout.PropertyField(passwordHash); EditorGUILayout.PropertyField(saltKey); EditorGUILayout.PropertyField(viKey); // Display a button to randomize all fields EditorGUILayout.Space(); if (GUILayout.Button("Randomize all fields") == true) { passwordHash.stringValue = StringCryptographer.GetRandomPassword(RandomPasswordLength); saltKey.stringValue = StringCryptographer.GetRandomPassword(RandomPasswordLength); viKey.stringValue = StringCryptographer.GetRandomPassword(StringCryptographer.ViKeyBlockSize); } // Display test encryption EditorGUILayout.Space(); EditorUiUtility.DrawBoldFoldout(encryptionGroup, "Test Encryption"); using (EditorGUILayout.FadeGroupScope scope = new EditorGUILayout.FadeGroupScope(encryptionGroup.faded)) { if (scope.visible == true) { testEncryption = EditorGUILayout.DelayedTextField("Input", testEncryption); string output = null; if (string.IsNullOrEmpty(testEncryption) == false) { output = ((StringCryptographer)target).Encrypt(testEncryption); } EditorGUILayout.TextField("Output", output); } } // Display test decryption EditorGUILayout.Space(); EditorUiUtility.DrawBoldFoldout(decryptionGroup, "Test Decryption"); using (EditorGUILayout.FadeGroupScope scope = new EditorGUILayout.FadeGroupScope(decryptionGroup.faded)) { if (scope.visible == true) { testDecryption = EditorGUILayout.DelayedTextField("Input", testDecryption); string output = null; if (string.IsNullOrEmpty(testDecryption) == false) { output = ((StringCryptographer)target).Decrypt(testDecryption); } EditorGUILayout.TextField("Output", output); } } // Apply modifications serializedObject.ApplyModifiedProperties(); }
private void OnDisable() { EditorUiUtility.DestroyBool(this, ref showErrorMessage); EditorUiUtility.DestroyBool(this, ref showDefaultConfigurations); EditorUiUtility.DestroyBool(this, ref showPresetMessageForKeyNotFound); EditorUiUtility.DestroyBool(this, ref showDefaultLanguageForTranslationNotFound); EditorUiUtility.DestroyBool(this, ref showPresetMessageForTranslationNotFound); translationStatus.Clear(); frequencyInKeyAppearance.Clear(); }
public TranslationCollectionEditor(Editor editor, SerializedProperty element, SupportedLanguages supportedLanguages) { // Setup member variables this.editor = editor; Element = element; this.supportedLanguages = supportedLanguages; // Setup the bools EditorUiUtility.CreateBool(editor, ref showHelpBox); EditorUiUtility.CreateBool(editor, ref showAllTranslationsList); }
public LanguageTextPairEditor(Editor editor, SerializedProperty element, SupportedLanguages supportedLanguages) { // Setup member variables this.editor = editor; this.SupportedLanguages = supportedLanguages; Element = element; // Setup the bools EditorUiUtility.CreateBool(editor, ref showHelpBox); EditorUiUtility.CreateBool(editor, ref expandToggle); }
internal static float GetHeight(SerializedProperty translatedDisplayNameProperty, GUIContent label = null) { float returnHeight = EditorUiUtility.GetHeight(label, 2, EditorUiUtility.VerticalMargin); if (translatedDisplayNameProperty != null) { returnHeight += EditorUiUtility.VerticalMargin; returnHeight += EditorGUI.GetPropertyHeight(translatedDisplayNameProperty); } return(returnHeight); }
private void CreateList(SerializedProperty property) { if ((list == null) || (this.property.serializedObject != property.serializedObject)) { this.property = property; list = new UnityEditorInternal.ReorderableList(property.serializedObject, property); list.headerHeight = EditorUiUtility.VerticalMargin; list.drawElementCallback += DrawScene; list.elementHeight = EditorUiUtility.SingleLineHeight(EditorUiUtility.VerticalMargin); } }
protected void DrawBuildFile(System.Action drawPath, AdjustText adjustPreviewPath, string foldoutLabel) { // Draw the build folder EditorUiUtility.DrawBoldFoldout(folderAnimation, foldoutLabel); using (EditorGUILayout.FadeGroupScope scope = new EditorGUILayout.FadeGroupScope(folderAnimation.faded)) { if (scope.visible == true) { DrawFileNamePreview(drawPath, adjustPreviewPath); } } }
private void DrawInterruptions() { EditorUiUtility.DrawBoldFoldout(interruptionsAnimation, "Interruptions"); using (EditorGUILayout.FadeGroupScope scope = new EditorGUILayout.FadeGroupScope(interruptionsAnimation.faded)) { if (scope.visible == true) { EditorGUILayout.PropertyField(onBuildFailed); EditorGUILayout.PropertyField(onBuildCancelled); } } }
void OnEnable() { // Setup toggle toggleGenerateArea = true; toggleTestArea = true; // Setup Reordable list allDomainsField = new ReorderableList(allDomains, typeof(string), true, true, true, true); allDomainsField.drawHeaderCallback = DrawLevelListHeader; allDomainsField.drawElementCallback = DrawLevelListElement; allDomainsField.onAddCallback = OnAddDomain; allDomainsField.elementHeight = EditorUiUtility.SingleLineHeight(VerticalMargin); }
private void DrawArchiveSettings() { EditorUiUtility.DrawBoldFoldout(archiveAnimation, "Archive File Name"); // Draw the rest of the controls using (EditorGUILayout.FadeGroupScope fadeScope = new EditorGUILayout.FadeGroupScope(archiveAnimation.faded)) { if (fadeScope.visible == true) { // Draw the rest of the controls DrawFileNamePreview(DrawArchiveControls, AppendArchiveFileName); } } }
private void DrawDomainListLocation() { EditorUiUtility.DrawBoldFoldout(domainListLocationAnimation, "Domain List Location"); // 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); } } }
private void DrawBuildSettingList() { // Draw foldout EditorUiUtility.DrawBoldFoldout(buildSettingsAnimation, "Platforms"); // Draw the list using (EditorGUILayout.FadeGroupScope scope = new EditorGUILayout.FadeGroupScope(buildSettingsAnimation.faded)) { if (scope.visible == true) { childBuildSettingsList.List.DoLayoutList(); } } }
protected void DrawCustomSettings() { // Draw foldout EditorUiUtility.DrawBoldFoldout(customSettingsAnimation, "Custom Build Settings"); using (EditorGUILayout.FadeGroupScope scope = new EditorGUILayout.FadeGroupScope(customSettingsAnimation.faded)) { if (scope.visible == true) { DrawPlatformSpecificSettings(); EditorGUILayout.PropertyField(customScriptDefineSymbols); EditorGUILayout.PropertyField(customScenes); } } }
public CustomFileNameReorderableList(SerializedProperty names, SerializedProperty asSlug, GUIContent label) { // Member Variable NamesProperty = names; AsSlugProperty = asSlug; Label = label; // Setup List List = new ReorderableList(names.serializedObject, names, true, true, true, true); List.drawHeaderCallback = DrawNamesListHeader; List.drawElementCallback = DrawNamesListElement; List.onAddDropdownCallback = DrawNameListDropdown; List.elementHeight = EditorUiUtility.SingleLineHeight(EditorUiUtility.VerticalMargin); }
private float CalculateSupportedLangaugesListElementHeight(int index) { // Grab the relevant element SerializedProperty element = supportedLanguagesList.serializedProperty.GetArrayElementAtIndex(index); // Calculate base height float returnHeight = EditorUiUtility.GetHeight(null, 2, EditorUiUtility.VerticalMargin) + EditorUiUtility.VerticalMargin; // Grab the relevant list ReorderableList list = GetFontsList(element.FindPropertyRelative("fonts")); // Calculate list height returnHeight += list.GetHeight(); returnHeight += EditorUiUtility.VerticalMargin; return(returnHeight); }
protected override void DrawExtraSettings() { EditorGUILayout.Space(); // Draw foldout EditorUiUtility.DrawBoldFoldout(allArchivesAnimation, "Host Specific Archive Settings"); // Draw the list using (EditorGUILayout.FadeGroupScope scope = new EditorGUILayout.FadeGroupScope(allArchivesAnimation.faded)) { if (scope.visible == true) { allArchiveList.List.DoLayoutList(); } } }
public ChildBuildSettingReorderableList(Object target, SerializedProperty property, GUIContent label) : base(target, property, label) { // Setup List List.onAddDropdownCallback = DrawBuildSettingListDropdown; List.elementHeight = EditorUiUtility.GetHeight(2, 4f); // Setup all Methods AllMethods = new BuildSettingCreator[] { #region Windows new BuildSettingCreator("Windows 64-bit", () => { CreateDesktopPlatformSettings <WindowsBuildSetting>("Windows 64-bit", IPlatformBuildSetting.Architecture.Build64Bit); }), new BuildSettingCreator("Windows 32-bit", () => { CreateDesktopPlatformSettings <WindowsBuildSetting>("Windows 32-bit", IPlatformBuildSetting.Architecture.Build32Bit); }), null, #endregion new BuildSettingCreator("Mac", () => { AddAndModify <MacBuildSetting>("Mac"); }), null, #region Linux new BuildSettingCreator("Linux Universal", () => { CreateDesktopPlatformSettings <LinuxBuildSetting>("Linux", IPlatformBuildSetting.Architecture.BuildUniversal); }), new BuildSettingCreator("Linux 64-bit", () => { CreateDesktopPlatformSettings <LinuxBuildSetting>("Linux 64-bit", IPlatformBuildSetting.Architecture.Build64Bit); }), new BuildSettingCreator("Linux 32-bit", () => { CreateDesktopPlatformSettings <LinuxBuildSetting>("Linux 32-bit", IPlatformBuildSetting.Architecture.Build32Bit); }), null, #endregion new BuildSettingCreator("WebGL", () => { CreateWebGLSettings(); }), null, // FIXME: add UWP support #region Mobile new BuildSettingCreator("iOS", () => { AddAndModify <IosBuildSetting>("iOS"); }), new BuildSettingCreator("Android", () => { AddAndModify <AndroidBuildSetting>("Android"); }), //new BuildSettingCreator("UWP", () => { AddAndModify<UwpBuildSetting>("UWP"); }), null, #endregion // FIXME: add Facebook support #region Facebook //new BuildSettingCreator("Facebook Gameroom, WebGL", () => { CreateWebGLSettings(); }), //new BuildSettingCreator("Facebook Gameroom, Windows 64-bit", () => { CreateDesktopPlatformSettings<WindowsBuildSetting>("Windows 64-bit", IPlatformBuildSetting.Architecture.Build64Bit); }), //new BuildSettingCreator("Facebook Gameroom,Windows 32-bit", () => { CreateDesktopPlatformSettings<WindowsBuildSetting>("Windows 32-bit", IPlatformBuildSetting.Architecture.Build32Bit); }), //null, #endregion new BuildSettingCreator("Group of Platforms", () => { AddAndModify <GroupBuildSetting>("Group"); }), }; }
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { float height = EditorGUIUtility.singleLineHeight; if (property.isExpanded == true) { // Grab every field SerializedProperty key = property.FindPropertyRelative("key"); SerializedProperty dictionary = property.FindPropertyRelative("dictionary"); // Allocate key field height += EditorUiUtility.GetHeight(2); // Update status TranslationDictionary translationDictionary = dictionary.objectReferenceValue as TranslationDictionary; string translationKey = key.stringValue; Status status = UpdateMessageStatus(translationDictionary, translationKey); // Check status if (string.IsNullOrEmpty(Message) == false) { // Allocate help box height += EditorUiUtility.VerticalMargin; height += EditorUiUtility.GetHelpBoxHeight(Message, Width); } // Check button if (IsButtonDrawn(status) == true) { // Allocate button height += EditorUiUtility.VerticalMargin; height += ButtonHeight; } // Check preview if (IsTextPreviewDrawn(status) == true) { // Allocate preview height += EditorUiUtility.VerticalSpace; height += EditorGUIUtility.singleLineHeight; height += TextPreview.CalculateHeight(null, !translationDictionary.IsAllTranslationsSerialized); } } return(height); }
private ReorderableList GetFontsList(SerializedProperty property) { // Attempt to retrieve the list ReorderableList fontsList = null; if (fonts.TryGetValue(property, out fontsList) == false) { // If none is found, create a new one fontsList = new ReorderableList(serializedObject, property, true, true, true, true); fontsList.drawHeaderCallback = DrawFontsListHeader; fontsList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { DrawFontsListElement(property.GetArrayElementAtIndex(index), rect); }; fontsList.elementHeight = EditorUiUtility.SingleLineHeight(EditorUiUtility.VerticalMargin); fonts.Add(property, fontsList); } return(fontsList); }
private void DrawArchiveContents() { EditorUiUtility.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); EditorGUILayout.PropertyField(domainEncrypter); 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 = Utility.GetDomainList(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); } } } } } }
private Rect DrawHelpBox(Rect rect) { // Check whether to show the help box if (string.IsNullOrEmpty(Message) == false) { // Add indentation rect.x += IndentLeft; rect.width -= IndentLeft; // Draw a header message rect.y += EditorUiUtility.VerticalMargin + rect.height; rect.height = EditorUiUtility.GetHelpBoxHeight(Message, rect.width); EditorGUI.HelpBox(rect, Message, MessageType); // Remove indentation rect.x -= IndentLeft; rect.width += IndentLeft; } return(rect); }
private void OnEnable() { // Serialized properties and graphical wrappers supportedLanguages = serializedObject.FindProperty("supportedLanguages"); defaultToWhenKeyNotFound = serializedObject.FindProperty("defaultToWhenKeyNotFound"); presetMessageWhenKeyNotFound = serializedObject.FindProperty("presetMessageWhenKeyNotFound"); defaultToWhenTranslationNotFound = serializedObject.FindProperty("defaultToWhenTranslationNotFound"); presetMessageWhenTranslationNotFound = serializedObject.FindProperty("presetMessageWhenTranslationNotFound"); defaultLanguageWhenTranslationNotFound = serializedObject.FindProperty("defaultLanguageWhenTranslationNotFound"); replaceEmptyStringWithDefaultText = serializedObject.FindProperty("replaceEmptyStringWithDefaultText"); // Setup animations EditorUiUtility.CreateBool(this, ref showErrorMessage); EditorUiUtility.CreateBool(this, ref showDefaultConfigurations); EditorUiUtility.CreateBool(this, ref showPresetMessageForKeyNotFound); EditorUiUtility.CreateBool(this, ref showDefaultLanguageForTranslationNotFound); EditorUiUtility.CreateBool(this, ref showPresetMessageForTranslationNotFound); // Setup transations list translations = serializedObject.FindProperty("translations"); translationsList = new ReorderableList(serializedObject, translations, true, true, true, true); translationsList.drawHeaderCallback = DrawTranslationsListHeader; translationsList.drawElementCallback = DrawTranslationsListElement; translationsList.elementHeightCallback = CalculateTranslationsListElementHeight; translationsList.onAddCallback = OnAddTranslation; translationsList.onRemoveCallback = OnRemoveTranslation; translationsList.onReorderCallbackWithDetails = OnReorderTranslationList; // Populate the status list translationStatus.Clear(); frequencyInKeyAppearance.Clear(); for (int index = 0; index < translationsList.count; ++index) { AddEntryFromTranslationListStatus(translationsList, index); } UpdateTranslationListStatus(translationsList, 0); // Setup search field //searchField = new SearchField(); recalculateSearchResult = true; }
public void OnEnable() { // Grab all serialized properties domainMustContain = serializedObject.FindProperty("domainMustContain"); remoteDomainListUrl = serializedObject.FindProperty("remoteDomainListUrl"); domainDecrypter = serializedObject.FindProperty("domainDecrypter"); waitObjects = serializedObject.FindProperty("waitObjects"); forceRedirectIfDomainDoesntMatch = serializedObject.FindProperty("forceRedirectIfDomainDoesntMatch"); redirectURL = serializedObject.FindProperty("redirectURL"); // Setup domainMustContain list domainMustContainList = new ReorderableList(serializedObject, domainMustContain, true, true, true, true); domainMustContainList.drawHeaderCallback = DrawDomainHeader; domainMustContainList.drawElementCallback = DrawDomainElement; domainMustContainList.elementHeight = EditorUiUtility.SingleLineHeight(VerticalMargin); // Setup waitObjects list waitObjectsList = new ReorderableList(serializedObject, waitObjects, true, true, true, true); waitObjectsList.drawHeaderCallback = DrawWaitHeader; waitObjectsList.drawElementCallback = DrawWaitElement; waitObjectsList.elementHeight = EditorUiUtility.SingleLineHeight(VerticalMargin); }
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { return(EditorUiUtility.GetHeight(label, GetNumLinesToDraw(property, label), VerticalMargin)); }