Initial Commit
This commit is contained in:
parent
53eb92e9af
commit
270ab7d11f
15341 changed files with 700234 additions and 0 deletions
|
@ -0,0 +1,14 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
public class VSProjectSettingsProvider : Editor
|
||||
{
|
||||
[SettingsProvider]
|
||||
public static SettingsProvider CreateProjectSettingProvider()
|
||||
{
|
||||
return new VSProjectSettingsProviderView();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d6a0cc840e6084f62a3e3538f14bf3ce
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,97 @@
|
|||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
class VSProjectSettingsProviderView : SettingsProvider
|
||||
{
|
||||
private const string path = "Project/Visual Scripting";
|
||||
private const string title = "Visual Scripting";
|
||||
private const string titleGroup = "Generate Units";
|
||||
|
||||
VSSettingsAssembly vsSettingsAssembly;
|
||||
VSSettingsTypeOption vsSettingsTypeOption;
|
||||
VSSettingsCustomProperty vsSettingsCustomProperty;
|
||||
VSSettingsBackup vsSettingsBackup;
|
||||
VSSettingsScriptReferenceResolver vsSettingsScriptReferenceResolver;
|
||||
|
||||
VSSettingsUpdate vsSettingsUpdate;
|
||||
public VSProjectSettingsProviderView() : base(path, SettingsScope.Project)
|
||||
{
|
||||
label = title;
|
||||
}
|
||||
|
||||
private void CreateOptionsIfNeeded()
|
||||
{
|
||||
if (vsSettingsAssembly == null)
|
||||
{
|
||||
vsSettingsAssembly = new VSSettingsAssembly();
|
||||
}
|
||||
|
||||
if (vsSettingsTypeOption == null)
|
||||
{
|
||||
vsSettingsTypeOption = new VSSettingsTypeOption();
|
||||
}
|
||||
|
||||
if (vsSettingsCustomProperty == null)
|
||||
{
|
||||
vsSettingsCustomProperty = new VSSettingsCustomProperty();
|
||||
}
|
||||
|
||||
if (vsSettingsBackup == null)
|
||||
{
|
||||
vsSettingsBackup = new VSSettingsBackup();
|
||||
}
|
||||
|
||||
if (vsSettingsScriptReferenceResolver == null)
|
||||
{
|
||||
vsSettingsScriptReferenceResolver = new VSSettingsScriptReferenceResolver();
|
||||
}
|
||||
|
||||
if (vsSettingsUpdate == null)
|
||||
{
|
||||
vsSettingsUpdate = new VSSettingsUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnGUI(string searchContext)
|
||||
{
|
||||
GUILayout.Space(5f);
|
||||
|
||||
GUILayout.Label(titleGroup, EditorStyles.boldLabel);
|
||||
|
||||
GUILayout.Space(10f);
|
||||
|
||||
// happens when opening unity with the settings window already opened. there's a delay until the singleton is assigned
|
||||
if (BoltCore.instance == null)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Loading Configuration...", MessageType.Info);
|
||||
return;
|
||||
}
|
||||
|
||||
CreateOptionsIfNeeded();
|
||||
|
||||
vsSettingsTypeOption.OnGUI();
|
||||
|
||||
GUILayout.Space(10f);
|
||||
|
||||
vsSettingsAssembly.OnGUI();
|
||||
|
||||
GUILayout.Space(10f);
|
||||
|
||||
vsSettingsCustomProperty.OnGUI();
|
||||
|
||||
GUILayout.Space(10f);
|
||||
|
||||
vsSettingsBackup.OnGUI();
|
||||
|
||||
GUILayout.Space(10f);
|
||||
|
||||
vsSettingsScriptReferenceResolver.OnGUI();
|
||||
|
||||
GUILayout.Space(10f);
|
||||
|
||||
vsSettingsUpdate.OnGUI();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4eea00f49056f4ee98c82b6923b44600
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,76 @@
|
|||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
public class VSSettingsAssembly
|
||||
{
|
||||
private const string completeLabel = "Regenerate Units";
|
||||
private PluginConfigurationItemMetadata assemblyOptionsMetadata;
|
||||
|
||||
private bool showAssembly = false;
|
||||
private const string titleAssembly = "Node Library";
|
||||
private const string descriptionAssembly = "Choose the assemblies in which you want to look for units.\n"
|
||||
+ "By default, all project and Unity assemblies are included.\n"
|
||||
+ "Unless you use a third-party plugin distributed as a DLL, you shouldn't need to change this.";
|
||||
public VSSettingsAssembly()
|
||||
{
|
||||
assemblyOptionsMetadata = BoltCore.Configuration.GetMetadata(nameof(BoltCoreConfiguration.assemblyOptions));
|
||||
}
|
||||
|
||||
static class Styles
|
||||
{
|
||||
public static readonly GUIStyle background;
|
||||
public static readonly GUIStyle defaultsButton;
|
||||
public static readonly float optionsWidth = 250;
|
||||
|
||||
static Styles()
|
||||
{
|
||||
background = new GUIStyle(LudiqStyles.windowBackground);
|
||||
background.padding = new RectOffset(20, 20, 20, 20);
|
||||
|
||||
defaultsButton = new GUIStyle("Button");
|
||||
defaultsButton.padding = new RectOffset(10, 10, 4, 4);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
showAssembly = EditorGUILayout.Foldout(showAssembly, new GUIContent(titleAssembly, descriptionAssembly));
|
||||
|
||||
if (showAssembly)
|
||||
{
|
||||
GUILayout.BeginVertical(Styles.background, GUILayout.ExpandHeight(true));
|
||||
|
||||
float height = LudiqGUI.GetInspectorHeight(null, assemblyOptionsMetadata, Styles.optionsWidth, GUIContent.none);
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
var position = GUILayoutUtility.GetRect(Styles.optionsWidth, height);
|
||||
|
||||
LudiqGUI.Inspector(assemblyOptionsMetadata, position, GUIContent.none);
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
assemblyOptionsMetadata.Save();
|
||||
Codebase.UpdateSettings();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Reset to Defaults", Styles.defaultsButton))
|
||||
{
|
||||
assemblyOptionsMetadata.Reset(true);
|
||||
assemblyOptionsMetadata.Save();
|
||||
}
|
||||
|
||||
LudiqGUI.EndVertical();
|
||||
}
|
||||
|
||||
if (GUILayout.Button(completeLabel, Styles.defaultsButton))
|
||||
{
|
||||
UnitBase.Rebuild();
|
||||
|
||||
EditorUtility.DisplayDialog("Visual Script", "Regenerate Units completed", "OK");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7cb1615bd41a3442a8aabbcb872046a3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,46 @@
|
|||
using System.Diagnostics;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
public class VSSettingsBackup
|
||||
{
|
||||
private const string title = "Backup Graphs";
|
||||
private const string buttonBackupLabel = "Create Backup";
|
||||
private const string buttonRestoreLabel = "Restore Backup";
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
GUILayout.Space(5f);
|
||||
|
||||
GUILayout.Label(title, EditorStyles.boldLabel);
|
||||
|
||||
GUILayout.Space(5f);
|
||||
|
||||
if (GUILayout.Button(buttonBackupLabel, Styles.defaultsButton))
|
||||
{
|
||||
VSBackupUtility.Backup();
|
||||
|
||||
EditorUtility.DisplayDialog("Backup", "Backup completed successfully.", "OK");
|
||||
}
|
||||
|
||||
if (GUILayout.Button(buttonRestoreLabel, Styles.defaultsButton))
|
||||
{
|
||||
PathUtility.CreateDirectoryIfNeeded(Paths.backups);
|
||||
Process.Start(Paths.backups);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Styles
|
||||
{
|
||||
static Styles()
|
||||
{
|
||||
defaultsButton = new GUIStyle("Button");
|
||||
defaultsButton.padding = new RectOffset(10, 10, 4, 4);
|
||||
}
|
||||
|
||||
public static readonly GUIStyle defaultsButton;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
fileFormatVersion: 2
|
||||
<<<<<<< HEAD:Packages/com.unity.bolt/Editor/Bolt.Core/BoltGUI.cs.meta
|
||||
guid: 50455e66302b715488a9218e30b0ab24
|
||||
=======
|
||||
guid: 9b13d76d6b80b4b1ab4d0fac8c174df4
|
||||
>>>>>>> [1010] Visual Script Project Settings UI Change:Packages/com.unity.bolt/VSSettingsProvider/VSSettingsBackup.cs.meta
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,49 @@
|
|||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
public class VSSettingsCustomProperty
|
||||
{
|
||||
private const string title = "Custom Inspector Properties";
|
||||
private const string buttonLabel = "Generate";
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
GUILayout.Space(5f);
|
||||
|
||||
GUILayout.Label(title, EditorStyles.boldLabel);
|
||||
|
||||
GUILayout.Space(5f);
|
||||
|
||||
string label = "Inspectors in Bolt plugins can handle many custom types besides Unity primites and objects. ";
|
||||
label += "However, to be compatible with your custom editor drawers, some additional property provider scripts must be generated. ";
|
||||
|
||||
GUILayout.BeginHorizontal(EditorStyles.helpBox);
|
||||
GUILayout.Label(EditorGUIUtility.IconContent("console.infoicon"), GUILayout.ExpandWidth(true));
|
||||
GUILayout.Box(label, EditorStyles.wordWrappedLabel);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
if (GUILayout.Button(buttonLabel, Styles.defaultsButton))
|
||||
{
|
||||
SerializedPropertyProviderProvider.instance.GenerateProviderScripts();
|
||||
EditorUtility.DisplayDialog("Custom Inspector Generation", "Custom inspector generation has completed successfully.", "OK");
|
||||
}
|
||||
}
|
||||
|
||||
public static class Styles
|
||||
{
|
||||
static Styles()
|
||||
{
|
||||
defaultsButton = new GUIStyle("Button");
|
||||
defaultsButton.padding = new RectOffset(10, 10, 4, 4);
|
||||
|
||||
regenerateLabel = new GUIStyle(EditorStyles.centeredGreyMiniLabel);
|
||||
regenerateLabel.wordWrap = true;
|
||||
}
|
||||
|
||||
public static readonly GUIStyle defaultsButton;
|
||||
public static readonly GUIStyle regenerateLabel;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7da9d8250917648728b856bfab5f1320
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "VSSettingsProvider",
|
||||
"references": [
|
||||
"Unity.VisualScripting.Core",
|
||||
"Unity.VisualScripting.Core.Editor",
|
||||
"Unity.VisualScripting.Flow",
|
||||
"Unity.VisualScripting.Flow.Editor",
|
||||
"Unity.VisualScripting.State"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2aa54ddaa48744e1caddee916e39805e
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,40 @@
|
|||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
public class VSSettingsScriptReferenceResolver
|
||||
{
|
||||
private const string title = "Script Reference Resolver";
|
||||
private const string buttonLabel = "Fix Missing Scripts";
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
GUILayout.Space(5f);
|
||||
|
||||
GUILayout.Label(title, EditorStyles.boldLabel);
|
||||
|
||||
GUILayout.Space(5f);
|
||||
|
||||
if (GUILayout.Button(buttonLabel, Styles.defaultsButton))
|
||||
{
|
||||
ScriptReferenceResolver.Run();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Styles
|
||||
{
|
||||
static Styles()
|
||||
{
|
||||
defaultsButton = new GUIStyle("Button");
|
||||
defaultsButton.padding = new RectOffset(10, 10, 4, 4);
|
||||
|
||||
regenerateLabel = new GUIStyle(EditorStyles.centeredGreyMiniLabel);
|
||||
regenerateLabel.wordWrap = true;
|
||||
}
|
||||
|
||||
public static readonly GUIStyle defaultsButton;
|
||||
public static readonly GUIStyle regenerateLabel;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a8c0a3364f2ef4e42820eb87b5bdab69
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,68 @@
|
|||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
public class VSSettingsTypeOption
|
||||
{
|
||||
private readonly PluginConfigurationItemMetadata typeOptionsMetadata;
|
||||
|
||||
bool showTypeOption = false;
|
||||
private const string titleTypeOption = "Type Options";
|
||||
private const string descriptionTypeOption = "Choose the types you want to use for variables and units.\n"
|
||||
+ "MonoBehaviour types are always included.";
|
||||
static class Styles
|
||||
{
|
||||
public static readonly GUIStyle background;
|
||||
public static readonly GUIStyle defaultsButton;
|
||||
public static readonly float optionsWidth = 250;
|
||||
|
||||
static Styles()
|
||||
{
|
||||
background = new GUIStyle(LudiqStyles.windowBackground);
|
||||
background.padding = new RectOffset(20, 20, 20, 20);
|
||||
|
||||
defaultsButton = new GUIStyle("Button");
|
||||
defaultsButton.padding = new RectOffset(10, 10, 4, 4);
|
||||
}
|
||||
}
|
||||
|
||||
public VSSettingsTypeOption()
|
||||
{
|
||||
typeOptionsMetadata = BoltCore.Configuration.GetMetadata(nameof(BoltCoreConfiguration.typeOptions));
|
||||
}
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
showTypeOption = EditorGUILayout.Foldout(showTypeOption, new GUIContent(titleTypeOption, descriptionTypeOption));
|
||||
|
||||
if (showTypeOption)
|
||||
{
|
||||
GUILayout.BeginVertical(Styles.background, GUILayout.ExpandHeight(true));
|
||||
|
||||
float height =
|
||||
LudiqGUI.GetInspectorHeight(null, typeOptionsMetadata, Styles.optionsWidth, GUIContent.none);
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
var position = GUILayoutUtility.GetRect(Styles.optionsWidth, height);
|
||||
|
||||
LudiqGUI.Inspector(typeOptionsMetadata, position, GUIContent.none);
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
typeOptionsMetadata.Save();
|
||||
Codebase.UpdateSettings();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Reset to Defaults", Styles.defaultsButton))
|
||||
{
|
||||
typeOptionsMetadata.Reset(true);
|
||||
typeOptionsMetadata.Save();
|
||||
}
|
||||
|
||||
LudiqGUI.EndVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f061d8e7ad514436d82f47b34306a22c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,170 @@
|
|||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
public class VSSettingsUpdate
|
||||
{
|
||||
private const string title = "Plugins Update";
|
||||
private const string buttonLabel = "Update";
|
||||
private readonly List<Plugin> plugins;
|
||||
|
||||
public VSSettingsUpdate()
|
||||
{
|
||||
IEnumerable<Plugin> allPlugins = PluginContainer.GetAllPlugins();
|
||||
|
||||
Ensure.That(nameof(allPlugins)).IsNotNull(allPlugins);
|
||||
|
||||
plugins = new List<Plugin>(allPlugins.OrderByDependencies());
|
||||
}
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
GUILayout.Space(5f);
|
||||
|
||||
GUILayout.Label(title, EditorStyles.boldLabel);
|
||||
|
||||
GUILayout.Space(5f);
|
||||
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
if (plugins.All(plugin => plugin.manifest.savedVersion == plugin.manifest.currentVersion))
|
||||
{
|
||||
string label = "All your plugins are up to date.";
|
||||
|
||||
GUILayout.BeginHorizontal(EditorStyles.helpBox);
|
||||
GUILayout.Label(EditorGUIUtility.IconContent("console.infoicon"), GUILayout.ExpandWidth(false));
|
||||
GUILayout.Box(label, EditorStyles.wordWrappedLabel);
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
GUILayout.Space(5f);
|
||||
|
||||
DrawPluginVersionTable(plugins);
|
||||
|
||||
GUILayout.Space(5f);
|
||||
|
||||
if (plugins.Any(plugin => plugin.manifest.savedVersion != plugin.manifest.currentVersion))
|
||||
{
|
||||
if (GUILayout.Button(buttonLabel, Styles.defaultsButton))
|
||||
{
|
||||
VSBackupUtility.Backup();
|
||||
|
||||
(new VSMigrationUtility()).OnUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
LudiqGUI.EndVertical();
|
||||
}
|
||||
|
||||
private static void DrawPluginVersionTable(IEnumerable<Plugin> plugins)
|
||||
{
|
||||
var savedColumnHeader = new GUIContent("Saved");
|
||||
var installedColumnHeader = new GUIContent("Installed");
|
||||
|
||||
var pluginsColumnWidth = 0f;
|
||||
var savedColumnWidth = Styles.columnHeader.CalcSize(savedColumnHeader).x;
|
||||
var installedColumnWidth = Styles.columnHeader.CalcSize(installedColumnHeader).x;
|
||||
var stateColumnWidth = 0f;
|
||||
|
||||
foreach (var plugin in plugins)
|
||||
{
|
||||
pluginsColumnWidth = Mathf.Max(pluginsColumnWidth, Styles.pluginName.CalcSize(new GUIContent(plugin.manifest.name)).x);
|
||||
savedColumnWidth = Mathf.Max(savedColumnWidth, Styles.version.CalcSize(new GUIContent(plugin.manifest.savedVersion.ToString())).x);
|
||||
installedColumnWidth = Mathf.Max(installedColumnWidth, Styles.version.CalcSize(new GUIContent(plugin.manifest.currentVersion.ToString())).x);
|
||||
stateColumnWidth = Mathf.Max(stateColumnWidth, Styles.state.CalcSize(VersionStateContent(plugin)).x);
|
||||
}
|
||||
|
||||
LudiqGUI.BeginVertical();
|
||||
|
||||
// Header row
|
||||
LudiqGUI.BeginHorizontal();
|
||||
LudiqGUI.FlexibleSpace();
|
||||
GUILayout.Label(GUIContent.none, Styles.columnHeader, GUILayout.Width(pluginsColumnWidth));
|
||||
LudiqGUI.Space(Styles.columnSpacing);
|
||||
GUILayout.Label(savedColumnHeader, Styles.columnHeader, GUILayout.Width(savedColumnWidth));
|
||||
LudiqGUI.Space(Styles.columnSpacing);
|
||||
GUILayout.Label(installedColumnHeader, Styles.columnHeader, GUILayout.Width(installedColumnWidth));
|
||||
LudiqGUI.Space(Styles.columnSpacing);
|
||||
GUILayout.Label(GUIContent.none, Styles.state, GUILayout.Width(stateColumnWidth));
|
||||
LudiqGUI.FlexibleSpace();
|
||||
LudiqGUI.EndHorizontal();
|
||||
|
||||
// Plugin rows
|
||||
foreach (var plugin in plugins)
|
||||
{
|
||||
LudiqGUI.Space(Styles.rowSpacing);
|
||||
|
||||
LudiqGUI.BeginHorizontal();
|
||||
LudiqGUI.FlexibleSpace();
|
||||
GUILayout.Label(new GUIContent(plugin.manifest.name), Styles.pluginName, GUILayout.Width(pluginsColumnWidth));
|
||||
LudiqGUI.Space(Styles.columnSpacing);
|
||||
GUILayout.Label(new GUIContent(plugin.manifest.savedVersion.ToString()), Styles.version, GUILayout.Width(savedColumnWidth));
|
||||
LudiqGUI.Space(Styles.columnSpacing);
|
||||
GUILayout.Label(new GUIContent(plugin.manifest.currentVersion.ToString()), Styles.version, GUILayout.Width(installedColumnWidth));
|
||||
LudiqGUI.Space(Styles.columnSpacing);
|
||||
GUILayout.Label(VersionStateContent(plugin), Styles.state, GUILayout.Width(stateColumnWidth));
|
||||
LudiqGUI.FlexibleSpace();
|
||||
LudiqGUI.EndHorizontal();
|
||||
}
|
||||
|
||||
LudiqGUI.EndVertical();
|
||||
}
|
||||
|
||||
private static GUIContent VersionStateContent(Plugin plugin)
|
||||
{
|
||||
if (plugin.manifest.savedVersion < plugin.manifest.currentVersion)
|
||||
{
|
||||
return new GUIContent("New version", BoltCore.Icons.upgrade?[IconSize.Small]);
|
||||
}
|
||||
else if (plugin.manifest.savedVersion == plugin.manifest.currentVersion)
|
||||
{
|
||||
return new GUIContent("Up to date", BoltCore.Icons.upToDate?[IconSize.Small]);
|
||||
}
|
||||
else if (plugin.manifest.savedVersion > plugin.manifest.currentVersion)
|
||||
{
|
||||
return new GUIContent("Downgrade", BoltCore.Icons.downgrade?[IconSize.Small]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new GUIContent("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
public static class Styles
|
||||
{
|
||||
static Styles()
|
||||
{
|
||||
defaultsButton = new GUIStyle("Button");
|
||||
defaultsButton.padding = new RectOffset(10, 10, 4, 4);
|
||||
|
||||
pluginName = new GUIStyle(EditorStyles.label);
|
||||
pluginName.alignment = TextAnchor.MiddleRight;
|
||||
|
||||
version = new GUIStyle(EditorStyles.label);
|
||||
version.alignment = TextAnchor.MiddleCenter;
|
||||
|
||||
columnHeader = new GUIStyle(EditorStyles.label);
|
||||
columnHeader.alignment = TextAnchor.LowerCenter;
|
||||
columnHeader.fontStyle = FontStyle.Bold;
|
||||
|
||||
state = new GUIStyle();
|
||||
state.fixedWidth = IconSize.Small;
|
||||
state.fixedHeight = IconSize.Small;
|
||||
state.imagePosition = ImagePosition.ImageOnly;
|
||||
state.alignment = TextAnchor.MiddleCenter;
|
||||
}
|
||||
|
||||
public static readonly GUIStyle defaultsButton;
|
||||
public static readonly GUIStyle pluginName;
|
||||
public static readonly GUIStyle columnHeader;
|
||||
public static readonly GUIStyle version;
|
||||
public static readonly GUIStyle state;
|
||||
|
||||
public static readonly float columnSpacing = 10;
|
||||
public static readonly float rowSpacing = 10;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b36c743f1860dd1458d16127e0c98fe8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue