Availability indicator (#2044)
* status indicators changing properly * away status wip * updating away status on connection * remove obsolete logs * fix typecheck * minor adjustments * darker outline * Trying darker outline * Apply suggestions from code review * Update pusher/src/Model/Zone.ts * Making the dot smaller * Marking onleavezone as deprecated Co-authored-by: Piotr 'pwh' Hanusiak <p.hanusiak@workadventu.re> Co-authored-by: David Négrier <d.negrier@thecodingmachine.com>
This commit is contained in:
@@ -150,6 +150,7 @@ export class GameRoom {
|
||||
position,
|
||||
false,
|
||||
this.positionNotifier,
|
||||
joinRoomMessage.getAway(),
|
||||
socket,
|
||||
joinRoomMessage.getTagList(),
|
||||
joinRoomMessage.getVisitcardurl(),
|
||||
|
||||
@@ -32,6 +32,7 @@ export class User implements Movable {
|
||||
private position: PointInterface,
|
||||
public silent: boolean,
|
||||
private positionNotifier: PositionNotifier,
|
||||
private away: boolean,
|
||||
public readonly socket: UserSocket,
|
||||
public readonly tags: string[],
|
||||
public readonly visitCardUrl: string | null,
|
||||
@@ -89,6 +90,10 @@ export class User implements Movable {
|
||||
return this.outlineColor;
|
||||
}
|
||||
|
||||
public isAway(): boolean {
|
||||
return this.away;
|
||||
}
|
||||
|
||||
get following(): User | undefined {
|
||||
return this._following;
|
||||
}
|
||||
@@ -129,6 +134,11 @@ export class User implements Movable {
|
||||
}
|
||||
this.voiceIndicatorShown = details.getShowvoiceindicator()?.getValue();
|
||||
|
||||
const away = details.getAway();
|
||||
if (away) {
|
||||
this.away = away.getValue();
|
||||
}
|
||||
|
||||
const playerDetails = new SetPlayerDetailsMessage();
|
||||
|
||||
if (this.outlineColor !== undefined) {
|
||||
@@ -137,6 +147,9 @@ export class User implements Movable {
|
||||
if (this.voiceIndicatorShown !== undefined) {
|
||||
playerDetails.setShowvoiceindicator(new BoolValue().setValue(this.voiceIndicatorShown));
|
||||
}
|
||||
if (details.getAway() !== undefined) {
|
||||
playerDetails.setAway(new BoolValue().setValue(this.away));
|
||||
}
|
||||
|
||||
this.positionNotifier.updatePlayerDetails(this, playerDetails);
|
||||
}
|
||||
|
||||
@@ -331,6 +331,7 @@ export class SocketManager {
|
||||
userJoinedZoneMessage.setUserid(thing.id);
|
||||
userJoinedZoneMessage.setUseruuid(thing.uuid);
|
||||
userJoinedZoneMessage.setName(thing.name);
|
||||
userJoinedZoneMessage.setAway(thing.isAway());
|
||||
userJoinedZoneMessage.setCharacterlayersList(ProtobufUtils.toCharacterLayerMessages(thing.characterLayers));
|
||||
userJoinedZoneMessage.setPosition(ProtobufUtils.toPositionMessage(thing.getPosition()));
|
||||
userJoinedZoneMessage.setFromzone(this.toProtoZone(fromZone));
|
||||
@@ -658,6 +659,7 @@ export class SocketManager {
|
||||
userJoinedMessage.setUserid(thing.id);
|
||||
userJoinedMessage.setUseruuid(thing.uuid);
|
||||
userJoinedMessage.setName(thing.name);
|
||||
userJoinedMessage.setAway(thing.isAway());
|
||||
userJoinedMessage.setCharacterlayersList(ProtobufUtils.toCharacterLayerMessages(thing.characterLayers));
|
||||
userJoinedMessage.setPosition(ProtobufUtils.toPositionMessage(thing.getPosition()));
|
||||
if (thing.visitCardUrl) {
|
||||
|
||||
@@ -41,6 +41,7 @@ describe("PositionNotifier", () => {
|
||||
},
|
||||
false,
|
||||
positionNotifier,
|
||||
false,
|
||||
{} as UserSocket,
|
||||
[],
|
||||
null,
|
||||
@@ -60,6 +61,7 @@ describe("PositionNotifier", () => {
|
||||
},
|
||||
false,
|
||||
positionNotifier,
|
||||
false,
|
||||
{} as UserSocket,
|
||||
[],
|
||||
null,
|
||||
@@ -149,6 +151,7 @@ describe("PositionNotifier", () => {
|
||||
},
|
||||
false,
|
||||
positionNotifier,
|
||||
false,
|
||||
{} as UserSocket,
|
||||
[],
|
||||
null,
|
||||
@@ -168,6 +171,7 @@ describe("PositionNotifier", () => {
|
||||
},
|
||||
false,
|
||||
positionNotifier,
|
||||
false,
|
||||
{} as UserSocket,
|
||||
[],
|
||||
null,
|
||||
|
||||
Reference in New Issue
Block a user