mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-04-22 03:59:35 +08:00
新增特殊的用户类型
This commit is contained in:
parent
af7e19096d
commit
3a46511bc0
@ -15,7 +15,22 @@ namespace Milimoe.FunGame.Core.Api.Factory
|
||||
|
||||
public static User Create(long Id = 0, string Username = "", DateTime? RegTime = null, DateTime? LastTime = null, string Email = "", string NickName = "", bool IsAdmin = false, bool IsOperator = false, bool IsEnable = true, decimal Credits = 0, decimal Materials = 0, decimal GameTime = 0, string AutoKey = "")
|
||||
{
|
||||
return new User(Id, Username, RegTime, LastTime, Email, NickName, IsAdmin, IsOperator, IsEnable, Credits, Materials, GameTime, AutoKey);
|
||||
return new(Id, Username, RegTime, LastTime, Email, NickName, IsAdmin, IsOperator, IsEnable, Credits, Materials, GameTime, AutoKey);
|
||||
}
|
||||
|
||||
public static User Create(UserType type)
|
||||
{
|
||||
return new(type);
|
||||
}
|
||||
|
||||
public static User CreateGuest()
|
||||
{
|
||||
return General.GuestUserInstance;
|
||||
}
|
||||
|
||||
public static User CreateLocalUser()
|
||||
{
|
||||
return General.LocalUserInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2140,6 +2140,16 @@
|
||||
默认的未知用户
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Constant.General.GuestUserInstance">
|
||||
<summary>
|
||||
游客用户
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Constant.General.LocalUserInstance">
|
||||
<summary>
|
||||
本地用户
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Milimoe.FunGame.Core.Library.Constant.General.HallInstance">
|
||||
<summary>
|
||||
大厅(空房间)实例
|
||||
|
@ -46,6 +46,26 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
Inventory = new(this);
|
||||
}
|
||||
|
||||
internal User(UserType usertype)
|
||||
{
|
||||
switch (usertype)
|
||||
{
|
||||
case UserType.General:
|
||||
case UserType.Empty:
|
||||
break;
|
||||
case UserType.Guest:
|
||||
Id = UserSet.GuestUserId;
|
||||
Username = UserSet.GuestUserName;
|
||||
break;
|
||||
case UserType.LocalUser:
|
||||
Id = UserSet.LocalUserId;
|
||||
Username = UserSet.LocalUserName;
|
||||
break;
|
||||
}
|
||||
Statistics = new(this);
|
||||
Inventory = new(this);
|
||||
}
|
||||
|
||||
public override bool Equals(IBaseEntity? other)
|
||||
{
|
||||
return other is User u && u.Id == Id;
|
||||
|
@ -274,4 +274,15 @@ namespace Milimoe.FunGame.Core.Library.Constant
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class UserSet
|
||||
{
|
||||
public const long UnknownUserId = 0;
|
||||
public const long GuestUserId = -5;
|
||||
public const long LocalUserId = -6;
|
||||
|
||||
public const string UnknownUserName = "未知用户";
|
||||
public const string GuestUserName = "游客用户";
|
||||
public const string LocalUserName = "本地用户";
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,16 @@ namespace Milimoe.FunGame.Core.Library.Constant
|
||||
/// </summary>
|
||||
public static User UnknownUserInstance => new();
|
||||
|
||||
/// <summary>
|
||||
/// 游客用户
|
||||
/// </summary>
|
||||
public static User GuestUserInstance => new(UserType.Guest);
|
||||
|
||||
/// <summary>
|
||||
/// 本地用户
|
||||
/// </summary>
|
||||
public static User LocalUserInstance => new(UserType.LocalUser);
|
||||
|
||||
/// <summary>
|
||||
/// 大厅(空房间)实例
|
||||
/// </summary>
|
||||
|
@ -205,6 +205,14 @@ namespace Milimoe.FunGame.Core.Library.Constant
|
||||
CharacterStatistics
|
||||
}
|
||||
|
||||
public enum UserType
|
||||
{
|
||||
General,
|
||||
Empty,
|
||||
Guest,
|
||||
LocalUser
|
||||
}
|
||||
|
||||
public enum ShowMessageType
|
||||
{
|
||||
None,
|
||||
|
Loading…
x
Reference in New Issue
Block a user