-
Notifications
You must be signed in to change notification settings - Fork 6
/
YongAnTool.cs
38 lines (36 loc) · 1.06 KB
/
YongAnTool.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using Exiled.API.Features;
using Respawning;
using System;
using System.Collections.Generic;
using System.Reflection;
using YongAnFrame.Players;
using YongAnFrame.Roles.Enums;
namespace YongAnFrame
{
/// <summary>
/// 扩展方法工具类
/// </summary>
public static class YongAnTool
{
/// <summary>
/// <seealso cref="Guid"/>作为种子取随机数
/// </summary>
/// <param name="r"></param>
/// <param name="min">最小值</param>
/// <param name="max">最大值</param>
/// <returns></returns>
public static int StrictNext(this Random r, int min, int max)
{
return new Random(BitConverter.ToInt32(Guid.NewGuid().ToByteArray(), 0)).Next(min, max);
}
/// <summary>
/// <seealso cref="Player"/>转换为<seealso cref="FramePlayer"/>
/// </summary>
/// <param name="p"></param>
/// <returns></returns>
public static FramePlayer ToFPlayer(this Player p)
{
return FramePlayer.Get(p);
}
}
}