public static string Title(IGraphNester nester) { var graph = nester.childGraph; if (!StringUtility.IsNullOrWhiteSpace(graph?.title)) { return(graph?.title); } if (nester.nest.source == GraphSource.Macro && (UnityObject)nester.nest.macro != null) { var macroName = ((UnityObject)nester.nest.macro).name; if (LudiqCore.Configuration.humanNaming) { return(macroName.Prettify()); } else { return(macroName); } } return(nester.GetType().HumanName()); }
protected override void OnContentGUI() { GUILayout.BeginVertical(Styles.background); GUILayout.Label(new GUIContent(changelog.plugin.manifest.name), Styles.plugin); LudiqGUI.Space(2); GUILayout.Label(new GUIContent($"Version {changelog.version}"), Styles.version); if (!StringUtility.IsNullOrWhiteSpace(changelog.description)) { LudiqGUI.Space(5); GUILayout.Label(new GUIContent(changelog.description.Trim()), Styles.description); } foreach (var change in changes) { LudiqGUI.Space(10); GUILayout.BeginHorizontal(GUILayout.ExpandHeight(false)); GUILayout.Label(GUIContent.none, Styles.bullet); GUILayout.Label(change.type, Styles.changeType); GUILayout.Label(change.content, Styles.changeContent); LudiqGUI.EndHorizontal(); } LudiqGUI.EndVertical(); }
protected override void OnContentGUI() { GUILayout.BeginVertical(Styles.background, GUILayout.ExpandHeight(true)); LudiqGUI.FlexibleSpace(); EditorGUILayout.LabelField($"Version {aboutable.version}", LudiqStyles.centeredLabel); LudiqGUI.FlexibleSpace(); if (!StringUtility.IsNullOrWhiteSpace(aboutable.description)) { EditorGUILayout.LabelField(aboutable.description.Trim(), LudiqStyles.centeredLabel); } LudiqGUI.FlexibleSpace(); if (!StringUtility.IsNullOrWhiteSpace(aboutable.author)) { EditorGUILayout.LabelField($"{aboutable.authorLabel.Trim()} {aboutable.author.Trim()}", LudiqStyles.centeredLabel); } if (!StringUtility.IsNullOrWhiteSpace(aboutable.copyrightHolder)) { EditorGUILayout.LabelField($"Copyright \u00a9 {aboutable.copyrightYear} {aboutable.copyrightHolder.Trim()}. All Rights Reserved.", LudiqStyles.centeredLabel); } if (aboutable.authorLogo != null) { LudiqGUI.FlexibleSpace(); LudiqGUI.BeginHorizontal(); LudiqGUI.FlexibleSpace(); var logoHeight = Styles.authorLogoHeight; var logoWidth = (float)aboutable.authorLogo.width / aboutable.authorLogo.height * logoHeight; var logoPosition = GUILayoutUtility.GetRect(logoWidth, logoHeight); if (!string.IsNullOrEmpty(aboutable.authorUrl)) { if (GUI.Button(logoPosition, aboutable.authorLogo, GUIStyle.none)) { Process.Start(aboutable.authorUrl); } } else if (e.type == EventType.Repaint) { GUI.DrawTexture(logoPosition, aboutable.authorLogo); } LudiqGUI.FlexibleSpace(); LudiqGUI.EndHorizontal(); } LudiqGUI.FlexibleSpace(); LudiqGUI.EndVertical(); }
public static string Summary(IGraphNester nester) { var graph = nester.childGraph; if (!StringUtility.IsNullOrWhiteSpace(graph?.summary)) { return(graph?.summary); } return(nester.GetType().Summary()); }
public override string ToString() { if (StringUtility.IsNullOrWhiteSpace(label)) { return($"{major}.{minor}.{patch}"); } else { return($"{major}.{minor}.{patch}{label}{increment}"); } }
public void IsNotNullOrWhiteSpace(string value) { if (!Ensure.IsActive) { return; } IsNotNull(value); if (StringUtility.IsNullOrWhiteSpace(value)) { throw new ArgumentException(ExceptionMessages.Strings_IsNotNullOrWhiteSpace_Failed, paramName); } }
protected override void OnContentGUI() { GUILayout.BeginVertical(Styles.background); GUILayout.Label(acknowledgement.title, Styles.title); var hasAuthor = !StringUtility.IsNullOrWhiteSpace(acknowledgement.author); var hasCopyright = acknowledgement.copyrightYear != null; if (hasAuthor && hasCopyright) { GUILayout.Label($"Copyright \u00a9 {acknowledgement.copyrightYear} {acknowledgement.author}", Styles.property); } else if (hasAuthor) { GUILayout.Label($"Author: {acknowledgement.author}", Styles.property); } else if (hasCopyright) { GUILayout.Label($"Copyright \u00a9 {acknowledgement.copyrightYear}", Styles.property); } if (!StringUtility.IsNullOrWhiteSpace(acknowledgement.url)) { if (GUILayout.Button(acknowledgement.url, Styles.url)) { Process.Start(acknowledgement.url); } } if (!StringUtility.IsNullOrWhiteSpace(acknowledgement.licenseName)) { GUILayout.Label("License: " + acknowledgement.licenseName.Trim(), Styles.property); } LudiqGUI.EndVertical(); if (!StringUtility.IsNullOrWhiteSpace(acknowledgement.licenseText)) { GUILayout.Box(GUIContent.none, LudiqStyles.horizontalSeparator); licenseScroll = GUILayout.BeginScrollView(licenseScroll, Styles.licenseBackground); GUILayout.Label(licenseText, Styles.licenseText); GUILayout.EndScrollView(); LudiqGUI.Space(-1); } }
public static float HeightWithLabel(Metadata metadata, float width, float height, GUIContent label = null, GUIStyle labelStyle = null) { label = ProcessLabel(metadata, label); if (label == GUIContent.none) { return(height); } var labelWidth = LabelWidth(metadata, width); labelStyle = ProcessLabelStyle(metadata, labelStyle); var wide = metadata.HasAttribute <InspectorWideAttribute>(); var labelHeight = labelStyle.CalcHeight(label, labelWidth); if (expandTooltip.value || metadata.HasAttribute <InspectorExpandTooltipAttribute>()) { var tooltipHeight = StringUtility.IsNullOrWhiteSpace(label.tooltip) ? 0 : LudiqStyles.expandedTooltip.CalcHeight(new GUIContent(label.tooltip), labelWidth); if (wide) { height += labelHeight + tooltipHeight; } else { height = Mathf.Max(height, labelHeight + tooltipHeight); } } else { if (wide) { height += labelHeight; } else { height = Mathf.Max(height, labelHeight); } } return(height); }
public static void GenerateLicenseFile(string path) { var acknowledgements = PluginContainer.plugins .SelectMany(plugin => plugin.resources.acknowledgements) .Distinct() .ToArray(); var sb = new StringBuilder(); sb.AppendLine("The Unity Asset Store policy requires that all third-party"); sb.AppendLine("licenses be contained in a single LICENSES files."); sb.AppendLine("This file is auto-generated for this purpose."); sb.AppendLine(); sb.AppendLine("However, you can find a more readable version of each product's"); sb.AppendLine("acknowledgements in its About window, found in the Tools menu."); sb.AppendLine(); sb.AppendLine("Acknowledgements below:"); foreach (var acknowledgement in acknowledgements) { sb.AppendLine(" - " + acknowledgement.title); } foreach (var acknowledgement in acknowledgements) { sb.AppendLine(); sb.AppendLine("============================="); sb.AppendLine(); sb.AppendLine(acknowledgement.title); var hasAuthor = !StringUtility.IsNullOrWhiteSpace(acknowledgement.author); var hasCopyright = acknowledgement.copyrightYear != null; if (hasAuthor && hasCopyright) { sb.AppendLine($"Copyright \u00a9 {acknowledgement.copyrightYear} {acknowledgement.author}"); } else if (hasAuthor) { sb.AppendLine($"Author: {acknowledgement.author}"); } else if (hasCopyright) { sb.AppendLine($"Copyright \u00a9 {acknowledgement.copyrightYear}"); } if (!StringUtility.IsNullOrWhiteSpace(acknowledgement.url)) { sb.AppendLine(acknowledgement.url); } if (!StringUtility.IsNullOrWhiteSpace(acknowledgement.licenseName)) { sb.AppendLine("License: " + acknowledgement.licenseName.Trim()); } if (!StringUtility.IsNullOrWhiteSpace(acknowledgement.licenseText)) { var licenseText = string.Join("\n\n", acknowledgement.licenseText.Split(new[] { "\r\n\r\n", "\n\n" }, StringSplitOptions.RemoveEmptyEntries).Select(s => s.Replace("\r\n", "").Replace("\n", "")).ToArray()); sb.AppendLine(); sb.AppendLine(licenseText); } } if (path == null) { path = EditorUtility.SaveFilePanelInProject("License File", "LICENSES", "txt", null); } if (path != null) { File.WriteAllText(path, sb.ToString()); AssetDatabase.Refresh(); } }