diff --git a/Runtime/MicroLibrary/MacroEnum.cs b/Runtime/MicroLibrary/MacroEnum.cs index 9a843e5..258b831 100644 --- a/Runtime/MicroLibrary/MacroEnum.cs +++ b/Runtime/MicroLibrary/MacroEnum.cs @@ -188,7 +188,7 @@ namespace XericLibrary.Runtime.MacroLibrary [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool EnumGreater(this Enum target) { - return target.EnumToInt32() > 0; + return target.EnumToInt32() != 0; } /// @@ -198,7 +198,7 @@ namespace XericLibrary.Runtime.MacroLibrary [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool EnumGreater(this Enum target, Enum value) { - return (target.EnumToInt32() & value.EnumToInt32()) > 0; + return (target.EnumToInt32() & value.EnumToInt32()) != 0; } /// @@ -208,7 +208,7 @@ namespace XericLibrary.Runtime.MacroLibrary [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool EnumGreater1(this Enum target) { - return (target.EnumToInt32() & 01) > 0; + return (target.EnumToInt32() & 01) != 0; } /// @@ -218,7 +218,7 @@ namespace XericLibrary.Runtime.MacroLibrary [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool EnumGreater2(this Enum target) { - return (target.EnumToInt32() & 02) > 0; + return (target.EnumToInt32() & 02) != 0; } /// @@ -228,7 +228,7 @@ namespace XericLibrary.Runtime.MacroLibrary [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool EnumGreater3(this Enum target) { - return (target.EnumToInt32() & 04) > 0; + return (target.EnumToInt32() & 04) != 0; } /// @@ -238,7 +238,7 @@ namespace XericLibrary.Runtime.MacroLibrary [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool EnumGreater4(this Enum target) { - return (target.EnumToInt32() & 010) > 0; + return (target.EnumToInt32() & 010) != 0; } /// @@ -248,7 +248,7 @@ namespace XericLibrary.Runtime.MacroLibrary [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool EnumGreater5(this Enum target) { - return (target.EnumToInt32() & 020) > 0; + return (target.EnumToInt32() & 020) != 0; } /// @@ -258,7 +258,7 @@ namespace XericLibrary.Runtime.MacroLibrary [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool EnumGreater6(this Enum target) { - return (target.EnumToInt32() & 030) > 0; + return (target.EnumToInt32() & 030) != 0; } /// @@ -268,7 +268,7 @@ namespace XericLibrary.Runtime.MacroLibrary [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool EnumGreater7(this Enum target) { - return (target.EnumToInt32() & 040) > 0; + return (target.EnumToInt32() & 040) != 0; } /// @@ -278,7 +278,7 @@ namespace XericLibrary.Runtime.MacroLibrary [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool EnumGreater8(this Enum target) { - return (target.EnumToInt32() & 0100) > 0; + return (target.EnumToInt32() & 0100) != 0; } /// diff --git a/Runtime/MicroLibrary/MacroList.cs b/Runtime/MicroLibrary/MacroList.cs index 1e79ab2..179dadf 100644 --- a/Runtime/MicroLibrary/MacroList.cs +++ b/Runtime/MicroLibrary/MacroList.cs @@ -85,5 +85,23 @@ namespace XericLibrary.Runtime.MacroLibrary } #endregion + + #region 应用算法 + + /// + /// 获取列表中随机顺序的对象 + /// + /// + /// + /// 需要采样的数量 + /// + public static IEnumerable GetRandom(this List list, int count = -1) + { + var index = FisherYatesShuffle(list.Count, count <= 0 ? list.Count : count); + for(int i = 0; i < index.Count; i++) + yield return list[index[i]]; + } + + #endregion } } \ No newline at end of file diff --git a/Runtime/MicroLibrary/MacroString.cs b/Runtime/MicroLibrary/MacroString.cs index eb7fd36..650640c 100644 --- a/Runtime/MicroLibrary/MacroString.cs +++ b/Runtime/MicroLibrary/MacroString.cs @@ -62,6 +62,11 @@ namespace XericLibrary.Runtime.MacroLibrary private static readonly string[] chineseDigit = new string[] { "","十","百","千","万","十","百","千","亿","十","百","千","亿"}; + private static readonly string[] chineseNumber_ComplexFont = new string[] + {"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"}; + private static readonly string[] chineseDigit_ComplexFont = new string[] + { "","拾","佰","仟","万","拾","佰","仟","亿","拾","佰","仟","亿"}; + /// /// 将一个数值转为中文小写格式; /// @@ -98,7 +103,6 @@ namespace XericLibrary.Runtime.MacroLibrary /// 将一个数值转为中文小写格式,并确保读写格式满足日常使用; /// 比如 510会读成五百一十,9009会读成九千零九, /// 最大支持到九千亿,理论上并不是它的极限,只要继续套格式即可。 - /// 不过缺点是在读10,11时,会读成一十,一十一,需要额外处理一下以符合阅读习惯 /// /// ///