초기커밋
This commit is contained in:
108
ServerCommon/Entity/Player/UserBase.cs
Normal file
108
ServerCommon/Entity/Player/UserBase.cs
Normal file
@@ -0,0 +1,108 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
using Google.Protobuf;
|
||||
using NeoSmart.AsyncLock;
|
||||
using Nettention.Proud;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
|
||||
|
||||
using SESSION_ID = System.Int32;
|
||||
using WORLD_ID = System.UInt32;
|
||||
using META_ID = System.UInt32;
|
||||
using ENTITY_GUID = System.String;
|
||||
using ACCOUNT_ID = System.String;
|
||||
using OWNER_GUID = System.String;
|
||||
using USER_GUID = System.String;
|
||||
using CHARACTER_GUID = System.String;
|
||||
using ITEM_GUID = System.String;
|
||||
|
||||
|
||||
namespace ServerCommon;
|
||||
|
||||
public abstract partial class UserBase : EntityBase, IEntityWithSession, IWithLogActor
|
||||
{
|
||||
private readonly HostID m_host_id;
|
||||
|
||||
private ListenSessionBase? m_listen_session_base = null;
|
||||
|
||||
private readonly DateTime m_login_start_time;
|
||||
private DateTime m_logout_end_time = DateTimeHelper.MinTime;
|
||||
|
||||
private bool m_is_completed_logout = false;
|
||||
|
||||
public UserBase(EntityType entityType, NetClientInfo netClient)
|
||||
: base(entityType)
|
||||
{
|
||||
m_host_id = netClient.hostID;
|
||||
|
||||
m_login_start_time = DateTimeHelper.Current;
|
||||
}
|
||||
|
||||
public override async Task<Result> onInit()
|
||||
{
|
||||
addEntityAttribute(new AccountAttribute(this));
|
||||
|
||||
return await base.onInit();
|
||||
}
|
||||
|
||||
// IWithLogActor.toLogActor()
|
||||
public virtual ILogActor toLogActor()
|
||||
{
|
||||
var server_logic = ServerLogicApp.getServerLogicApp();
|
||||
|
||||
var account_attribute = getEntityAttribute<AccountAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(account_attribute, () => $"account_attribute is null !!! - {toBasicString()}");
|
||||
|
||||
var log_info = new UserActorLog();
|
||||
|
||||
log_info.initLogInfo(
|
||||
// 서버 정보
|
||||
server_logic.getServerConfig().getRegionId()
|
||||
, server_logic.getServerConfig().getWorldId()
|
||||
, server_logic.getServerType().toServerType()
|
||||
, server_logic.getServerName()
|
||||
|
||||
// 계정 정보
|
||||
, account_attribute.AccountIdString
|
||||
, account_attribute.AccountId
|
||||
|
||||
// 유저 정보
|
||||
, account_attribute.UserGuid
|
||||
, string.Empty
|
||||
, 0
|
||||
|
||||
// 캐릭터 정보
|
||||
, 0
|
||||
, CharRace.None
|
||||
|
||||
// 기타
|
||||
, account_attribute.AuthAdminLevelType
|
||||
, account_attribute.AccountType
|
||||
, account_attribute.AccountCreationType
|
||||
, Google.Protobuf.ByteString.Empty
|
||||
);
|
||||
|
||||
return log_info;
|
||||
}
|
||||
|
||||
public override OwnerEntityType onGetOwnerEntityType()
|
||||
{
|
||||
return OwnerEntityType.User;
|
||||
}
|
||||
|
||||
public override string toBasicString()
|
||||
{
|
||||
return $"userNickname:{getOriginEntityAttribute<NicknameAttribute>()?.Nickname}"
|
||||
+ $", userGuid:{getOriginEntityAttribute<UserAttribute>()?.UserGuid}"
|
||||
+ $", accountIdString:{getOriginEntityAttribute<AccountAttribute>()?.AccountIdString}"
|
||||
+ $", {base.toBasicString()}";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user