update
This commit is contained in:
parent
6df4649c64
commit
3a61f6677b
|
@ -73,9 +73,11 @@ namespace BITKit
|
||||||
{
|
{
|
||||||
path = null;
|
path = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Execute()
|
public void Execute()
|
||||||
{
|
{
|
||||||
path = path.Replace(@"/", @"\");
|
//path = string.IsNullOrEmpty(path) ? Environment.CurrentDirectory : path.Replace(@"/", @"\");
|
||||||
|
path = string.IsNullOrEmpty(path) ? Environment.CurrentDirectory : System.IO.Path.Combine(Environment.CurrentDirectory, path);
|
||||||
BIT4Log.Log<OpenPath>($"正在打开文件夹:{path}");
|
BIT4Log.Log<OpenPath>($"正在打开文件夹:{path}");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -88,6 +90,7 @@ namespace BITKit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
public class OpenAPP : IAction, IDisposable
|
public class OpenAPP : IAction, IDisposable
|
||||||
{
|
{
|
||||||
|
@ -214,6 +217,7 @@ namespace BITKit
|
||||||
CancellationTokenSource = default;
|
CancellationTokenSource = default;
|
||||||
State = InitializationState.None;
|
State = InitializationState.None;
|
||||||
BIT4Log.Log<BITApp>($"已停止{nameof(BITApp)}");
|
BIT4Log.Log<BITApp>($"已停止{nameof(BITApp)}");
|
||||||
|
BIT4Log.Log<BITApp>("----------------------------------------");
|
||||||
}
|
}
|
||||||
public static void Run(string path, string WorkingDirectory = "")
|
public static void Run(string path, string WorkingDirectory = "")
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,6 +60,7 @@ namespace BITKit
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<T[]> Combinations<T>(IEnumerable<T> source)
|
public static IEnumerable<T[]> Combinations<T>(IEnumerable<T> source)
|
||||||
{
|
{
|
||||||
if (null == source) throw new ArgumentNullException(nameof(source));
|
if (null == source) throw new ArgumentNullException(nameof(source));
|
||||||
|
@ -74,13 +75,14 @@ namespace BITKit
|
||||||
switch (self)
|
switch (self)
|
||||||
{
|
{
|
||||||
case List<T> list:
|
case List<T> list:
|
||||||
list.Insert(index,item);
|
list.Insert(index, item);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
var _list = self.ToList();
|
var _list = self.ToList();
|
||||||
_list.Insert(index,item);
|
_list.Insert(index, item);
|
||||||
return _list;
|
return _list;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,8 +93,10 @@ namespace BITKit
|
||||||
{
|
{
|
||||||
value = self.ElementAt(0);
|
value = self.ElementAt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return value is not null;
|
return value is not null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 组合集合中的所有元素
|
/// 组合集合中的所有元素
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -113,6 +117,7 @@ namespace BITKit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取集合中所有的组合,每个组合中的元素个数为输入集合的元素个数,每个元素只出现一次
|
/// 获取集合中所有的组合,每个组合中的元素个数为输入集合的元素个数,每个元素只出现一次
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -132,5 +137,34 @@ namespace BITKit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Linq Distinct扩展方法,可以传入自定义比较器
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="comparer"></param>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static IEnumerable<T> Distinct<T>(
|
||||||
|
this IEnumerable<T> source, Func<T, T, bool> comparer)
|
||||||
|
where T : class
|
||||||
|
=> source.Distinct(new DynamicEqualityComparer<T>(comparer));
|
||||||
|
/// <summary>
|
||||||
|
/// 动态自定义比较器
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
private sealed class DynamicEqualityComparer<T> : IEqualityComparer<T>
|
||||||
|
where T : class
|
||||||
|
{
|
||||||
|
private readonly Func<T, T, bool> _func;
|
||||||
|
|
||||||
|
public DynamicEqualityComparer(Func<T, T, bool> func)
|
||||||
|
{
|
||||||
|
_func = func;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Equals(T x, T y) => _func(x, y);
|
||||||
|
|
||||||
|
public int GetHashCode(T obj) => 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace BITKit.Sensors
|
||||||
|
|
||||||
[SerializeField] private Optional<LayerMask> detectedLayer;
|
[SerializeField] private Optional<LayerMask> detectedLayer;
|
||||||
[SerializeField] private bool allowStatic;
|
[SerializeField] private bool allowStatic;
|
||||||
|
[SerializeField] private bool useRigidbody;
|
||||||
|
|
||||||
[Header(Constant.Header.Events)] public UnityEvent<Collider> onDetected = new();
|
[Header(Constant.Header.Events)] public UnityEvent<Collider> onDetected = new();
|
||||||
public UnityEvent<Collider> onLost = new();
|
public UnityEvent<Collider> onLost = new();
|
||||||
|
|
Loading…
Reference in New Issue