Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.x #43

Merged
merged 7 commits into from
Dec 19, 2023
Merged

1.x #43

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions Editor.GUI.CLI/External/AIO.Content.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

103 changes: 103 additions & 0 deletions Editor.GUI.CLI/External/AIO.Content/GEContent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/*|============|*|
|*|Author: |*| Star fire
|*|Date: |*| 2023-12-15
|*|E-Mail: |*| [email protected]
|*|============|*/

using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

namespace AIO.UEditor
{
/// <summary>
/// 图标
/// </summary>
public static class GEContent
{
internal static readonly Dictionary<string, GUIContent> GCSetting = new Dictionary<string, GUIContent>();
internal static readonly Dictionary<string, GUIContent> GCApp = new Dictionary<string, GUIContent>();
internal static readonly Dictionary<string, GUIContent> GCBuiltin = new Dictionary<string, GUIContent>();

public static GUIContent GetSetting(string name)
{
if (GCSetting.ContainsKey(name)) return GCSetting[name];
GCSetting[name] = new GUIContent(Resources.Load<Texture>(name));
return GCSetting[name];
}

public static GUIContent GetApp(string name)
{
if (!GCApp.ContainsKey(name)) return GCApp[name];
GCApp[name] = new GUIContent(Resources.Load<Texture>(name));
return GCApp[name];
}

public static GUIContent GetBuiltin(string name)
{
if (GCBuiltin.ContainsKey(name)) return GCBuiltin[name];
GCBuiltin[name] = EditorGUIUtility.IconContent(name);
return GCBuiltin[name];
}

public static GUIContent NewSetting(string name, string tooltip)
{
if (!GCSetting.ContainsKey(name))
GCSetting[name] = new GUIContent(Resources.Load<Texture>(string.Format("Icon/Setting/{0}", name)));
return new GUIContent(GCSetting[name].image, tooltip);
}

public static GUIContent NewSetting(string name)
{
if (!GCSetting.ContainsKey(name))
GCSetting[name] = new GUIContent(Resources.Load<Texture>(string.Format("Icon/Setting/{0}", name)));
return new GUIContent(GCSetting[name].image);
}

public static GUIContent NewApp(string name)
{
if (!GCApp.ContainsKey(name))
GCApp[name] = new GUIContent(Resources.Load<Texture>(string.Format("Icon/App/{0}", name)));
return new GUIContent(GCApp[name].image);
}

public static GUIContent NewApp(string name, string tooltip)
{
if (!GCApp.ContainsKey(name))
GCApp[name] = new GUIContent(Resources.Load<Texture>(string.Format("Icon/App/{0}", name)));
return new GUIContent(GCApp[name].image, tooltip);
}

public static GUIContent NewBuiltin(string name)
{
if (!GCBuiltin.ContainsKey(name))
GCBuiltin[name] = EditorGUIUtility.IconContent(name);
return new GUIContent(GCBuiltin[name].image);
}

public static GUIContent NewBuiltin(string name, string tooltip)
{
if (!GCBuiltin.ContainsKey(name))
GCBuiltin[name] = EditorGUIUtility.IconContent(name);
return new GUIContent(GCBuiltin[name].image, tooltip);
}

public static void LoadSetting()
{
GCSetting.Clear();
foreach (var texture in Resources.LoadAll<Texture2D>("Icon/Setting"))
{
GCSetting[texture.name] = new GUIContent(texture);
}
}

public static void LoadApp()
{
GCApp.Clear();
foreach (var texture in Resources.LoadAll<Texture2D>("Icon/App"))
{
GCApp[texture.name] = new GUIContent(texture);
}
}
}
}
3 changes: 3 additions & 0 deletions Editor.GUI.CLI/External/AIO.Content/GEContent.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public override void OnEnable()
Content = new GUIContent
{
tooltip = "CSDN",
image = Resources.Load<Texture>("Texture/CSDN"),
image = GEContent.NewApp("CSDN").image
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public override void OnEnable()
Content = new GUIContent
{
tooltip = "Gitee",
image = Resources.Load<Texture>("Texture/Gitee"),
image = GEContent.NewApp("Gitee").image
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public override void OnEnable()
Content = new GUIContent
{
tooltip = "Github",
image = Resources.Load<Texture>("Texture/github-mark-white"),
image = GEContent.NewApp("Github-mark-white").image
};
}

Expand Down
7 changes: 6 additions & 1 deletion Editor.GUI.CLI/External/AIO.Graph/LnkTools/LnkTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ private static void OnLnkToolsGUI(SceneView sceneView)

var rect = Rect.zero;
var x = sceneView.position.width - 45;
var y = sceneView.in2DMode ? 5 : sceneView.position.height / 2 - Height / 2;
var y =
#if UNITY_2021_1_OR_NEWER
sceneView.in2DMode ? 25 : sceneView.position.height / 2 - Height / 2;
#else
sceneView.in2DMode ? 5 : sceneView.position.height / 2 - Height / 2;
#endif

rect.Set(sceneView.position.width - 10, y, 10, 20);
if (GUI.Button(rect, Thumbnail ? Content_Thumbnail : Content_Restore, "InvisibleButton"))
Expand Down
34 changes: 30 additions & 4 deletions Editor.GUI.CLI/MenuItem/Assets/MenuItem.Assets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,61 @@ namespace AIO.UEditor
{
public static partial class EditorMenu_Assets
{
private const string TITLE = "Assets/Open C# Project AIO DLL";
private const string AIO_DLL_TITLE = "Assets/Open C# Project AIO DLL";
private const string AIO_NET_TITLE = "Assets/Open C# Project Net DLL";

[MenuItem(TITLE, true, 1000)]
[MenuItem(AIO_DLL_TITLE, true, 1000)]
public static bool OpenDllProject()
{
var info = PackageInfo.FindForAssembly(typeof(EditorMenu_Assets).Assembly);
var path = Path.Combine(info.resolvedPath, "Tools~", "ALL.sln");
return File.Exists(path);
}

[MenuItem(AIO_NET_TITLE, true, 1000)]
public static bool OpenNetProject()
{
var info = PackageInfo.FindForAssembly(typeof(EditorMenu_Assets).Assembly);
var path = Path.Combine(info.resolvedPath, "Tools~", "Net.sln");
return File.Exists(path);
}

#if UNITY_EDITOR_WIN
[MenuItem(TITLE)]
[MenuItem(AIO_DLL_TITLE)]
public static async void OpenDllProjectWIN()
{
var info = PackageInfo.FindForAssembly(typeof(EditorMenu_Assets).Assembly);
var executor = PrCmd.Create().Input(
$"start \"AIO DLL Project\" {Path.Combine(info.resolvedPath, "Tools~", "ALL.sln")} /B /Max /HIGH");
(await executor.Async()).Debug();
}

[MenuItem(AIO_NET_TITLE)]
public static async void OpenNetProjectWIN()
{
var info = PackageInfo.FindForAssembly(typeof(EditorMenu_Assets).Assembly);
var executor = PrCmd.Create().Input(
$"start \"AIO DLL Project\" {Path.Combine(info.resolvedPath, "Tools~", "Net.sln")} /B /Max /HIGH");
(await executor.Async()).Debug();
}
#endif

#if UNITY_EDITOR_OSX
[MenuItem(TITLE)]
[MenuItem(AIO_DLL_TITLE)]
public static async void OpenDllProjectOSX()
{
var info = PackageInfo.FindForAssembly(typeof(EditorMenu_Assets).Assembly);
var executor = PrMac.Open.Path(Path.Combine(info.resolvedPath, "Tools~", "ALL.sln"));
(await executor.Async()).Debug();
}

[MenuItem(AIO_NET_TITLE)]
public static async void OpenNetProjectWIN()
{
var info = PackageInfo.FindForAssembly(typeof(EditorMenu_Assets).Assembly);
var executor = PrMac.Open.Path(Path.Combine(info.resolvedPath, "Tools~", "Net.sln"));
(await executor.Async()).Debug();
}
#endif
}
}
8 changes: 8 additions & 0 deletions Editor.GUI.CLI/Resources/Icon.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Editor.GUI.CLI/Resources/Icon/App/Apple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
135 changes: 135 additions & 0 deletions Editor.GUI.CLI/Resources/Icon/App/Apple.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading