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:
Piotr Hanusiak
2022-04-07 14:23:53 +02:00
committed by GitHub
parent 106ee755a8
commit 02f06a913b
15 changed files with 143 additions and 2 deletions
+1
View File
@@ -150,6 +150,7 @@ export class GameRoom {
position,
false,
this.positionNotifier,
joinRoomMessage.getAway(),
socket,
joinRoomMessage.getTagList(),
joinRoomMessage.getVisitcardurl(),
+13
View File
@@ -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);
}
+2
View File
@@ -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) {
+4
View File
@@ -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,