Merge branch 'phase/45-presence-talk'
# Conflicts: # docs/phases/README.md # src/HSchool.Server/Api/PeopleModels.cs # src/HSchool.Server/Game/PersonCardReader.cs
This commit is contained in:
@@ -662,3 +662,6 @@ public sealed record PresenceSnapshot(
|
||||
string? GoalId = null,
|
||||
float GoalWeight = 0f,
|
||||
string? GoalAction = null);
|
||||
|
||||
/// <summary>Ids of an active talk circle. Names are resolved by the client, not here.</summary>
|
||||
public sealed record TalkCirclePresence(string TopicId, IReadOnlyList<string> MemberIds);
|
||||
|
||||
@@ -218,6 +218,23 @@ public sealed class School : IDisposable
|
||||
|
||||
public IReadOnlyList<PresenceSnapshot> CapturePresence() => PresenceSystem.Capture(this);
|
||||
|
||||
/// <summary>
|
||||
/// Live circle for the presence frame and the person card. Null when this person is not talking.
|
||||
/// Member ids include self and are sorted; names stay off the wire.
|
||||
/// </summary>
|
||||
public TalkCirclePresence? TalkCircleOf(string personId)
|
||||
{
|
||||
if (!TalkCircleByPerson.TryGetValue(personId, out var circleId)
|
||||
|| !TalkCirclesById.TryGetValue(circleId, out var circle))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var members = circle.Members.ToArray();
|
||||
Array.Sort(members, StringComparer.Ordinal);
|
||||
return new TalkCirclePresence(circle.TopicId, members);
|
||||
}
|
||||
|
||||
public void RestorePresence(IReadOnlyList<PresenceSnapshot>? saved) => PresenceSystem.Restore(this, saved);
|
||||
|
||||
public bool IsCampusEmpty() => PresenceSystem.IsEmpty(this);
|
||||
|
||||
Reference in New Issue
Block a user