Skip to content

Commit

Permalink
[All] fix get msg cannot obtain face id (#643)
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkRRb authored Oct 19, 2024
1 parent 5270314 commit f9b26f4
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Lagrange.Core/Message/Entity/FaceEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ namespace Lagrange.Core.Message.Entity;
[MessageElement(typeof(Face)), MessageElement(typeof(CommonElem))]
public class FaceEntity : IMessageEntity
{
public ushort FaceId { get; }
public bool IsLargeFace { get; }
public ushort FaceId { get; set; }

public bool IsLargeFace { get; set; }

public FaceEntity() { }

public FaceEntity(ushort faceId, bool isLargeFace)
{
FaceId = faceId;
IsLargeFace = isLargeFace;
}

IEnumerable<Elem> IMessageEntity.PackElement()
{
if (IsLargeFace)
Expand Down Expand Up @@ -51,7 +51,7 @@ IEnumerable<Elem> IMessageEntity.PackElement()
}
};
}

return new Elem[] { new() { Face = new Face { Index = FaceId } } };
}

Expand All @@ -63,10 +63,10 @@ IEnumerable<Elem> IMessageEntity.PackElement()
if (faceId != null) return new FaceEntity((ushort)faceId, false);
}

if (elems.CommonElem is { ServiceType:37, PbElem: not null } common)
if (elems.CommonElem is { ServiceType: 37, PbElem: not null } common)
{
var qFace = Serializer.Deserialize<QFaceExtra>(common.PbElem.AsSpan());

ushort? faceId = (ushort?)qFace.FaceId;
if (faceId != null) return new FaceEntity((ushort)faceId, true);
}
Expand All @@ -76,7 +76,7 @@ IEnumerable<Elem> IMessageEntity.PackElement()
var qSmallFace = Serializer.Deserialize<QSmallFaceExtra>(append.PbElem.AsSpan());
return new FaceEntity((ushort)qSmallFace.FaceId, false);
}

return null;
}

Expand Down

0 comments on commit f9b26f4

Please sign in to comment.