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 = "")
|
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>
|
</summary>
|
||||||
</member>
|
</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">
|
<member name="P:Milimoe.FunGame.Core.Library.Constant.General.HallInstance">
|
||||||
<summary>
|
<summary>
|
||||||
大厅(空房间)实例
|
大厅(空房间)实例
|
||||||
|
@ -46,6 +46,26 @@ namespace Milimoe.FunGame.Core.Entity
|
|||||||
Inventory = new(this);
|
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)
|
public override bool Equals(IBaseEntity? other)
|
||||||
{
|
{
|
||||||
return other is User u && u.Id == Id;
|
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>
|
/// </summary>
|
||||||
public static User UnknownUserInstance => new();
|
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>
|
||||||
/// 大厅(空房间)实例
|
/// 大厅(空房间)实例
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -205,6 +205,14 @@ namespace Milimoe.FunGame.Core.Library.Constant
|
|||||||
CharacterStatistics
|
CharacterStatistics
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum UserType
|
||||||
|
{
|
||||||
|
General,
|
||||||
|
Empty,
|
||||||
|
Guest,
|
||||||
|
LocalUser
|
||||||
|
}
|
||||||
|
|
||||||
public enum ShowMessageType
|
public enum ShowMessageType
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user