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 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() { 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() 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(); NullReferenceCheckHelper.throwIfNull(to_cast_entity_attribute, () => $"to_cast_entity_attribute is null !!!"); return to_cast_entity_attribute; } public override TAttribute getOriginEntityAttribute() { 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() 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(); 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()?.SocialActionMetaId}"; } public override string toSummaryString() { return $"{this.getTypeName()}, {getEntityAttribute()?.toSummaryString()}"; } } }