Initial Commit
This commit is contained in:
parent
53eb92e9af
commit
270ab7d11f
15341 changed files with 700234 additions and 0 deletions
|
@ -0,0 +1,112 @@
|
|||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
public sealed class AssemblyOptionsPage : Page
|
||||
{
|
||||
public AssemblyOptionsPage() : base()
|
||||
{
|
||||
title = "Assembly Options";
|
||||
shortTitle = "Assemblies";
|
||||
icon = BoltFlow.Resources.LoadIcon("Icons/Windows/UnitOptionsWizard/AssemblyOptionsPage.png");
|
||||
assemblyOptionsMetadata = BoltCore.Configuration.GetMetadata(nameof(BoltCoreConfiguration.assemblyOptions));
|
||||
}
|
||||
|
||||
private readonly PluginConfigurationItemMetadata assemblyOptionsMetadata;
|
||||
|
||||
protected override void OnContentGUI()
|
||||
{
|
||||
GUILayout.BeginVertical(Styles.background, GUILayout.ExpandHeight(true));
|
||||
|
||||
LudiqGUI.FlexibleSpace();
|
||||
|
||||
LudiqGUI.BeginHorizontal();
|
||||
LudiqGUI.FlexibleSpace();
|
||||
|
||||
var text = "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.";
|
||||
|
||||
GUILayout.Label(text, LudiqStyles.centeredLabel, GUILayout.MaxWidth(370));
|
||||
LudiqGUI.FlexibleSpace();
|
||||
LudiqGUI.EndHorizontal();
|
||||
|
||||
LudiqGUI.Space(10);
|
||||
|
||||
var height = LudiqGUI.GetInspectorHeight(null, assemblyOptionsMetadata, Styles.optionsWidth, GUIContent.none);
|
||||
|
||||
LudiqGUI.BeginHorizontal();
|
||||
|
||||
LudiqGUI.FlexibleSpace();
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
var position = GUILayoutUtility.GetRect(Styles.optionsWidth, height);
|
||||
|
||||
LudiqGUI.Inspector(assemblyOptionsMetadata, position, GUIContent.none);
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
assemblyOptionsMetadata.Save();
|
||||
Codebase.UpdateSettings();
|
||||
}
|
||||
|
||||
LudiqGUI.FlexibleSpace();
|
||||
LudiqGUI.EndHorizontal();
|
||||
|
||||
LudiqGUI.Space(10);
|
||||
|
||||
LudiqGUI.BeginHorizontal();
|
||||
LudiqGUI.FlexibleSpace();
|
||||
|
||||
if (GUILayout.Button("Reset to Defaults", Styles.defaultsButton))
|
||||
{
|
||||
assemblyOptionsMetadata.Reset(true);
|
||||
assemblyOptionsMetadata.Save();
|
||||
}
|
||||
|
||||
LudiqGUI.FlexibleSpace();
|
||||
LudiqGUI.EndHorizontal();
|
||||
|
||||
LudiqGUI.FlexibleSpace();
|
||||
|
||||
LudiqGUI.Space(10);
|
||||
|
||||
LudiqGUI.BeginHorizontal();
|
||||
LudiqGUI.FlexibleSpace();
|
||||
|
||||
if (GUILayout.Button(completeLabel, Styles.completeButton))
|
||||
{
|
||||
Complete();
|
||||
}
|
||||
|
||||
LudiqGUI.FlexibleSpace();
|
||||
LudiqGUI.EndHorizontal();
|
||||
|
||||
LudiqGUI.FlexibleSpace();
|
||||
|
||||
LudiqGUI.EndVertical();
|
||||
}
|
||||
|
||||
public static class Styles
|
||||
{
|
||||
static Styles()
|
||||
{
|
||||
background = new GUIStyle(LudiqStyles.windowBackground);
|
||||
background.padding = new RectOffset(20, 20, 20, 20);
|
||||
|
||||
completeButton = new GUIStyle("Button");
|
||||
completeButton.padding = new RectOffset(12, 12, 7, 7);
|
||||
|
||||
defaultsButton = new GUIStyle("Button");
|
||||
defaultsButton.padding = new RectOffset(10, 10, 4, 4);
|
||||
}
|
||||
|
||||
public static readonly GUIStyle background;
|
||||
public static readonly GUIStyle completeButton;
|
||||
public static readonly GUIStyle defaultsButton;
|
||||
public static readonly float optionsWidth = 250;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9aa7df0e25f12473e9a5fe7ca4d44906
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,118 @@
|
|||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
public sealed class TypeOptionsPage : Page
|
||||
{
|
||||
public TypeOptionsPage() : base()
|
||||
{
|
||||
title = "Type Options";
|
||||
shortTitle = "Types";
|
||||
icon = BoltFlow.Resources.LoadIcon("Icons/Windows/UnitOptionsWizard/TypeOptionsPage.png");
|
||||
typeOptionsMetadata = BoltCore.Configuration.GetMetadata(nameof(BoltCoreConfiguration.typeOptions));
|
||||
}
|
||||
|
||||
private readonly PluginConfigurationItemMetadata typeOptionsMetadata;
|
||||
|
||||
protected override void OnContentGUI()
|
||||
{
|
||||
GUILayout.BeginVertical(Styles.background, GUILayout.ExpandHeight(true));
|
||||
|
||||
LudiqGUI.FlexibleSpace();
|
||||
|
||||
LudiqGUI.BeginHorizontal();
|
||||
LudiqGUI.FlexibleSpace();
|
||||
|
||||
var text = "Choose the types you want to use for variables and units.\n"
|
||||
+ "MonoBehaviour types are always included.";
|
||||
|
||||
GUILayout.Label(text, LudiqStyles.centeredLabel, GUILayout.MaxWidth(370));
|
||||
LudiqGUI.FlexibleSpace();
|
||||
LudiqGUI.EndHorizontal();
|
||||
|
||||
LudiqGUI.Space(10);
|
||||
|
||||
var height = LudiqGUI.GetInspectorHeight(null, typeOptionsMetadata, Styles.optionsWidth, GUIContent.none);
|
||||
|
||||
LudiqGUI.BeginHorizontal();
|
||||
|
||||
LudiqGUI.FlexibleSpace();
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
var position = GUILayoutUtility.GetRect(Styles.optionsWidth, height);
|
||||
|
||||
LudiqGUI.Inspector(typeOptionsMetadata, position, GUIContent.none);
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
typeOptionsMetadata.Save();
|
||||
Codebase.UpdateSettings();
|
||||
}
|
||||
|
||||
LudiqGUI.FlexibleSpace();
|
||||
LudiqGUI.EndHorizontal();
|
||||
|
||||
LudiqGUI.Space(10);
|
||||
|
||||
LudiqGUI.BeginHorizontal();
|
||||
LudiqGUI.FlexibleSpace();
|
||||
|
||||
if (GUILayout.Button("Reset to Defaults", Styles.defaultsButton))
|
||||
{
|
||||
typeOptionsMetadata.Reset(true);
|
||||
typeOptionsMetadata.Save();
|
||||
}
|
||||
|
||||
LudiqGUI.FlexibleSpace();
|
||||
LudiqGUI.EndHorizontal();
|
||||
|
||||
LudiqGUI.FlexibleSpace();
|
||||
|
||||
LudiqGUI.Space(10);
|
||||
|
||||
LudiqGUI.BeginHorizontal();
|
||||
LudiqGUI.FlexibleSpace();
|
||||
|
||||
if (GUILayout.Button("Generate", Styles.completeButton))
|
||||
{
|
||||
Complete();
|
||||
}
|
||||
|
||||
LudiqGUI.FlexibleSpace();
|
||||
LudiqGUI.EndHorizontal();
|
||||
|
||||
LudiqGUI.FlexibleSpace();
|
||||
|
||||
LudiqGUI.EndVertical();
|
||||
}
|
||||
|
||||
protected override void Complete()
|
||||
{
|
||||
UnitBase.Build();
|
||||
|
||||
base.Complete();
|
||||
}
|
||||
|
||||
public static class Styles
|
||||
{
|
||||
static Styles()
|
||||
{
|
||||
background = new GUIStyle(LudiqStyles.windowBackground);
|
||||
background.padding = new RectOffset(20, 20, 20, 20);
|
||||
|
||||
completeButton = new GUIStyle("Button");
|
||||
completeButton.padding = new RectOffset(12, 12, 7, 7);
|
||||
|
||||
defaultsButton = new GUIStyle("Button");
|
||||
defaultsButton.padding = new RectOffset(10, 10, 4, 4);
|
||||
}
|
||||
|
||||
public static readonly GUIStyle background;
|
||||
public static readonly GUIStyle completeButton;
|
||||
public static readonly GUIStyle defaultsButton;
|
||||
public static readonly float optionsWidth = 250;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a4df7f88461274da59bae2bc56e3eaa3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,27 @@
|
|||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
public sealed class UnitOptionsWizard : Wizard
|
||||
{
|
||||
public static UnitOptionsWizard instance { get; }
|
||||
|
||||
static UnitOptionsWizard()
|
||||
{
|
||||
instance = new UnitOptionsWizard();
|
||||
}
|
||||
|
||||
public UnitOptionsWizard() : base()
|
||||
{
|
||||
pages.Add(new AssemblyOptionsPage());
|
||||
pages.Add(new TypeOptionsPage());
|
||||
}
|
||||
|
||||
protected override void ConfigureWindow()
|
||||
{
|
||||
window.titleContent = new GUIContent("Unit Options Wizard");
|
||||
window.minSize = window.maxSize = new Vector2(500, 400);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9a6195740dc594004b8a0d4536fe82d9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue