87 lines
2.9 KiB
C#
87 lines
2.9 KiB
C#
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()}";
|
|
}
|
|
}
|
|
}
|