Skip to content

Commit

Permalink
Merge pull request #65 from AIO-GAME/1.x
Browse files Browse the repository at this point in the history
1.x
  • Loading branch information
xinansky authored Jan 16, 2024
2 parents 56f76d6 + deae90b commit 08bc2a1
Show file tree
Hide file tree
Showing 26 changed files with 373 additions and 300 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ public GWindowAttribute(string title, string tooltip = "", [CallerFilePath] stri
};
if (filePath.StartsWith(".\\Packages\\")) FilePath = filePath.Substring(2);
else FilePath = filePath.Replace('\\', '/');
Debug.Log(FilePath);
}
}
}
6 changes: 3 additions & 3 deletions Editor.GUI.CLI/External/AIO.Graph/GELayout/GELayout.Button.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*|============|*|
|*|Author: |*| xinan
|*|Date: |*| 2023-10-09
|*|E-Mail: |*| [email protected]
|*|Author: |*| xinan
|*|Date: |*| 2023-10-09
|*|E-Mail: |*| [email protected]
|*|============|*/

using System;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public virtual VisualElement OnCreateVerticalToolbarContent()
static LnkToolOverlay()
{
var type = typeof(LnkToolOverlay);

Debug.unityLogger.logEnabled = false;
var miTarget = type.GetMethod("CreateHorizontalToolbarContent", ToolBarBind);
var miReplacement = type.GetMethod("OnCreateHorizontalToolbarContent", ToolBarBind);

Expand All @@ -96,6 +96,7 @@ static LnkToolOverlay()
var Replacement = type.GetMethod("OnCreateVerticalToolbarContent", ToolBarBind);
_hook2 = new MethodHook(Target, Replacement);
_hook2.Install();
Debug.unityLogger.logEnabled = true;
}

protected override Layout supportedLayouts
Expand Down
10 changes: 6 additions & 4 deletions Editor.GUI.CLI/Window/SymlinkDraw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ protected static SettingsProvider SettingsProvider()

GUILayout.Space(10);
GUILayout.EndVertical();

GUILayout.FlexibleSpace();
EditorGUILayout.LabelField("Version 1.0.1-preview", EditorStyles.centeredGreyMiniLabel);
}
Expand Down Expand Up @@ -137,7 +137,7 @@ private static void Initialize()
/// </summary>
/// <param name="guid"></param>
/// <param name="r"></param>
private static void OnProjectWindowItemGUI(string guid, Rect r)
private static async void OnProjectWindowItemGUI(string guid, Rect r)
{
var path = AssetDatabase.GUIDToAssetPath(guid);
if (string.IsNullOrEmpty(path)) return;
Expand All @@ -148,13 +148,15 @@ private static void OnProjectWindowItemGUI(string guid, Rect r)
r.width = 30;
if (GUI.Button(r, "<->", SymlinkMarkerStyle))
{
var realPath = GetRealPath(path).Replace('\\', '/');
try
{
PrPlatform.Open.Path(GetRealPath(path)).Async();
var result = await PrPlatform.Open.Path(realPath).Async();
if (result.ExitCode != 0) EditorUtility.RevealInFinder(realPath);
}
catch
{
// ignored
EditorUtility.RevealInFinder(realPath);
}
}
}
Expand Down
36 changes: 20 additions & 16 deletions Editor/General/Utils/IO/U.IO.Get.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static IEnumerable<string> GetAssetsPath(
if (string.IsNullOrEmpty(pattern)) return Array.Empty<string>();
return AssetDatabase.FindAssets(pattern, folders)
.Select(AssetDatabase.GUIDToAssetPath)
.Where(value => !filtration(value)).ToArray();
.Where(value => !filtration.Invoke(value)).ToArray();
}

/// <summary>
Expand Down Expand Up @@ -192,10 +192,12 @@ public static IEnumerable<string> GetFilesRelativeAsset(
in SearchOption option = SearchOption.TopDirectoryOnly)
{
if (!Directory.Exists(value)) return Array.Empty<string>();
value = System.IO.Path.GetFullPath(value);
value = System.IO.Path.GetFullPath(value).Replace('\\', System.IO.Path.AltDirectorySeparatorChar);
if (!value.Contains(Path.Project)) return Array.Empty<string>();
return AHelper.IO.GetFilesInfo(value, pattern, option)
.Select(item => item.FullName.Substring(Path.Project.Length + 1));
var len = Path.Project.Length + 1;
return AHelper.IO
.GetFilesInfo(value, pattern, option)
.Select(item => item.FullName.Substring(len).Replace('\\', '/'));
}

/// <summary>
Expand All @@ -213,10 +215,12 @@ public static IEnumerable<string> GetFilesRelativeAsset(
in SearchOption option = SearchOption.TopDirectoryOnly)
{
if (!Directory.Exists(value)) return Array.Empty<string>();
value = System.IO.Path.GetFullPath(value);
value = System.IO.Path.GetFullPath(value).Replace('\\', System.IO.Path.AltDirectorySeparatorChar);
if (!value.Contains(Path.Project)) return Array.Empty<string>();
return AHelper.IO.GetFilesInfo(value, filtration, pattern, option)
.Select(item => item.FullName.Substring(Path.Project.Length + 1));
var len = Path.Project.Length + 1;
return AHelper.IO
.GetFilesInfo(value, filtration, pattern, option)
.Select(item => item.FullName.Substring(len).Replace('\\', '/'));
}

/// <summary>
Expand All @@ -234,12 +238,12 @@ public static IEnumerable<string> GetFilesRelativeAssetNoMeta(
SearchOption option = SearchOption.TopDirectoryOnly)
{
if (!Directory.Exists(value)) return Array.Empty<string>();
value = System.IO.Path.GetFullPath(value);
value = System.IO.Path.GetFullPath(value).Replace('\\', System.IO.Path.AltDirectorySeparatorChar);
if (!value.Contains(Path.Project)) return Array.Empty<string>();
return
from item in AHelper.IO.GetFilesInfo(value, filtration, pattern, option)
var len = Path.Project.Length + 1;
return from item in AHelper.IO.GetFilesInfo(value, filtration, pattern, option)
where !item.Extension.Contains(".meta")
select item.FullName.Substring(Path.Project.Length + 1);
select item.FullName.Substring(len).Replace('\\', '/');
}

/// <summary>
Expand All @@ -255,12 +259,12 @@ public static IEnumerable<string> GetFilesRelativeAssetNoMeta(
in string pattern = "*")
{
if (!Directory.Exists(value)) return Array.Empty<string>();
value = System.IO.Path.GetFullPath(value);
value = System.IO.Path.GetFullPath(value).Replace('\\', System.IO.Path.AltDirectorySeparatorChar);
if (!value.StartsWith(Path.Project)) return Array.Empty<string>();
return
from item in AHelper.IO.GetFilesInfo(value, pattern, option)
where !item.Extension.StartsWith(".meta")
select item.FullName.Substring(Path.Project.Length + 1);
var len = Path.Project.Length + 1;
return from item in AHelper.IO.GetFilesInfo(value, pattern, option)
where !item.Extension.Contains(".meta")
select item.FullName.Substring(len).Replace('\\', '/');
}
}
}
Expand Down
31 changes: 15 additions & 16 deletions Editor/General/Utils/Path/U.Path.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using UnityEditor;
using UnityEngine;
using Debug = UnityEngine.Debug;
Expand All @@ -29,26 +28,26 @@ private static void Init()
try
{
Project = Application.dataPath.Substring(0, Application.dataPath.LastIndexOf('/'));
Project = Project.Replace('/', '\\');
Prefs.SaveString("ProjectPath", Project);
}
catch (Exception)
{
Project = Prefs.LoadString("ProjectPath");
Debug.LogWarning("Failed to get project path from Unity API. Using saved path instead.");
}

Assets = System.IO.Path.Combine(Project, "Assets");
StreamingAssets = System.IO.Path.Combine(Assets, "Assets", "StreamingAssets");
Assets = string.Concat(Project, "/Assets");
StreamingAssets = string.Concat(Assets, "/StreamingAssets");
if (Project != null)
{
Temp = System.IO.Path.Combine(Project, "Temp");
Logs = System.IO.Path.Combine(Project, "Logs");
Packages = System.IO.Path.Combine(Project, "Packages");
UserSettings = System.IO.Path.Combine(Project, "UserSettings");

ProjectSettings = System.IO.Path.Combine(Project, "ProjectSettings");
Backups = System.IO.Path.Combine(Project, "Editor Default Resources");
EditorDefaultResources = System.IO.Path.Combine(Project, "Backups");
Temp = string.Concat(Project, "/Temp");
Logs = string.Concat(Project, "/Logs");
Packages = string.Concat(Project, "/Packages");
UserSettings = string.Concat(Project, "/UserSettings");

ProjectSettings = string.Concat(Project, "/ProjectSettings");
Backups = string.Concat(Project, "/Backups");
EditorDefaultResources = string.Concat(Project, "/Editor Default Resources");
}

try
Expand Down Expand Up @@ -155,7 +154,7 @@ public static string EditorContents
private static string _EditorContents { get; set; }

/// <summary>
/// 获取当前项目所在文件夹的完整路径。
/// 获取当前项目所在文件夹的完整路径。 文件分隔符为 '/' 正斜杠。
/// </summary>
public static string Project { get; private set; }

Expand Down Expand Up @@ -340,12 +339,12 @@ private static IEnumerable<string> environmentPaths
}
}

// ProgramFilesx86 is not available until .NET 4
// Program Files x86 is not available until .NET 4
// https://stackoverflow.com/questions/194157/
/// <summary>
/// 获取x86程序文件夹路径,兼容32位和64位操作系统
/// </summary>
private static string ProgramFilesx86
private static string ProgramFiles_X86
{
get
{
Expand Down Expand Up @@ -375,7 +374,7 @@ public static string MSBuild
{
var startInfo = new ProcessStartInfo
{
FileName = System.IO.Path.Combine(ProgramFilesx86,
FileName = System.IO.Path.Combine(ProgramFiles_X86,
@"Microsoft Visual Studio\Installer\vswhere.exe"),
Arguments =
@"-latest -prerelease -products * -requires Microsoft.Component.MSBuild -find **\Bin\MSBuild.exe",
Expand Down
Binary file modified Plugins/AIO.Common.dll
Binary file not shown.
Loading

0 comments on commit 08bc2a1

Please sign in to comment.