초기커밋
This commit is contained in:
86
GameServer/Contents/SocialAction/Base/SocialAction.cs
Normal file
86
GameServer/Contents/SocialAction/Base/SocialAction.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
using ServerCore; using ServerBase;
|
||||
using ServerCommon;
|
||||
|
||||
|
||||
|
||||
namespace GameServer
|
||||
{
|
||||
public class SocialAction : EntityBase
|
||||
{
|
||||
public SocialAction(EntityBase parent)
|
||||
: base(EntityType.SocialAction, parent)
|
||||
{
|
||||
}
|
||||
|
||||
public override async Task<Result> onInit()
|
||||
{
|
||||
var parent = getDirectParent();
|
||||
ArgumentNullException.ThrowIfNull(parent, $"parent is null !!!");
|
||||
|
||||
addEntityAttribute(new UserSocialActionAttribute(this));
|
||||
|
||||
addEntityAction(new SocialActionAction(this));
|
||||
|
||||
return await base.onInit();
|
||||
}
|
||||
|
||||
public override TAttribute getEntityAttribute<TAttribute>()
|
||||
{
|
||||
var parent = getRootParent();
|
||||
ArgumentNullException.ThrowIfNull(parent, $"parent is null !!!");
|
||||
|
||||
TAttribute? to_cast_entity_attribute;
|
||||
|
||||
if (typeof(TAttribute) == typeof(SocialActionAttributeBase))
|
||||
{
|
||||
to_cast_entity_attribute = base.getEntityAttribute<UserSocialActionAttribute>() as TAttribute;
|
||||
NullReferenceCheckHelper.throwIfNull(to_cast_entity_attribute, () => $"to_cast_entity_attribute is null !!!");
|
||||
|
||||
return to_cast_entity_attribute;
|
||||
}
|
||||
|
||||
to_cast_entity_attribute = base.getEntityAttribute<TAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(to_cast_entity_attribute, () => $"to_cast_entity_attribute is null !!!");
|
||||
|
||||
return to_cast_entity_attribute;
|
||||
}
|
||||
|
||||
public override TAttribute getOriginEntityAttribute<TAttribute>()
|
||||
{
|
||||
var parent = getRootParent();
|
||||
ArgumentNullException.ThrowIfNull(parent, $"parent is null !!!");
|
||||
|
||||
TAttribute? to_cast_entity_attribute;
|
||||
|
||||
if (typeof(TAttribute) == typeof(SocialActionAttributeBase))
|
||||
{
|
||||
to_cast_entity_attribute = base.getOriginEntityAttribute<UserSocialActionAttribute>() as TAttribute;
|
||||
NullReferenceCheckHelper.throwIfNull(to_cast_entity_attribute, () => $"to_cast_entity_attribute is null !!!");
|
||||
|
||||
return to_cast_entity_attribute;
|
||||
}
|
||||
|
||||
to_cast_entity_attribute = base.getOriginEntityAttribute<TAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(to_cast_entity_attribute, () => $"to_cast_entity_attribute is null !!!");
|
||||
|
||||
return to_cast_entity_attribute;
|
||||
}
|
||||
|
||||
public override string toBasicString()
|
||||
{
|
||||
return $"{this.getTypeName()}, SocialActionMetaId:{getOriginEntityAttribute<UserSocialActionAttribute>()?.SocialActionMetaId}";
|
||||
}
|
||||
|
||||
public override string toSummaryString()
|
||||
{
|
||||
return $"{this.getTypeName()}, {getEntityAttribute<UserSocialActionAttribute>()?.toSummaryString()}";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user