statuses swapping fixes
This commit is contained in:
parent
7385ce522f
commit
92c79a89fe
@ -139,8 +139,10 @@ export class User implements Movable {
|
|||||||
this.voiceIndicatorShown = details.getShowvoiceindicator()?.getValue();
|
this.voiceIndicatorShown = details.getShowvoiceindicator()?.getValue();
|
||||||
|
|
||||||
const status = details.getStatus();
|
const status = details.getStatus();
|
||||||
if (status !== undefined) {
|
let sendStatusUpdate = false;
|
||||||
|
if (status && status !== this.status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
|
sendStatusUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const playerDetails = new SetPlayerDetailsMessage();
|
const playerDetails = new SetPlayerDetailsMessage();
|
||||||
@ -151,7 +153,7 @@ export class User implements Movable {
|
|||||||
if (this.voiceIndicatorShown !== undefined) {
|
if (this.voiceIndicatorShown !== undefined) {
|
||||||
playerDetails.setShowvoiceindicator(new BoolValue().setValue(this.voiceIndicatorShown));
|
playerDetails.setShowvoiceindicator(new BoolValue().setValue(this.voiceIndicatorShown));
|
||||||
}
|
}
|
||||||
if (details.getStatus() !== undefined) {
|
if (sendStatusUpdate) {
|
||||||
playerDetails.setStatus(details.getStatus());
|
playerDetails.setStatus(details.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ export class PlayerStatusDot extends Phaser.GameObjects.Container {
|
|||||||
[AvailabilityStatus.SILENT]: { filling: 0xe74c3c, outline: 0xc0392b },
|
[AvailabilityStatus.SILENT]: { filling: 0xe74c3c, outline: 0xc0392b },
|
||||||
[AvailabilityStatus.JITSI]: { filling: 0x74b9ff, outline: 0x0984e3 },
|
[AvailabilityStatus.JITSI]: { filling: 0x74b9ff, outline: 0x0984e3 },
|
||||||
[AvailabilityStatus.UNRECOGNIZED]: { filling: 0xffffff, outline: 0xffffff },
|
[AvailabilityStatus.UNRECOGNIZED]: { filling: 0xffffff, outline: 0xffffff },
|
||||||
|
[AvailabilityStatus.UNCHANGED]: { filling: 0xffffff, outline: 0xffffff },
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(scene: Phaser.Scene, x: number, y: number) {
|
constructor(scene: Phaser.Scene, x: number, y: number) {
|
||||||
@ -31,7 +32,7 @@ export class PlayerStatusDot extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public setStatus(status: AvailabilityStatus, instant: boolean = false): void {
|
public setStatus(status: AvailabilityStatus, instant: boolean = false): void {
|
||||||
if (this.status === status) {
|
if (this.status === status || status === AvailabilityStatus.UNCHANGED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.status = status;
|
this.status = status;
|
||||||
|
@ -18,7 +18,7 @@ import { iframeListener } from "../../Api/IframeListener";
|
|||||||
import { Room } from "../../Connexion/Room";
|
import { Room } from "../../Connexion/Room";
|
||||||
import LL from "../../i18n/i18n-svelte";
|
import LL from "../../i18n/i18n-svelte";
|
||||||
import { AvailabilityStatus } from "../../Messages/ts-proto-generated/protos/messages";
|
import { AvailabilityStatus } from "../../Messages/ts-proto-generated/protos/messages";
|
||||||
import { availabilityStatusStore } from "../../Stores/MediaStore";
|
import { availabilityStatusStore, previousAvailabilityStatusStore } from "../../Stores/MediaStore";
|
||||||
|
|
||||||
interface OpenCoWebsite {
|
interface OpenCoWebsite {
|
||||||
actionId: string;
|
actionId: string;
|
||||||
@ -67,9 +67,9 @@ export class GameMapPropertiesListener {
|
|||||||
coWebsiteManager.closeCoWebsite(coWebsite);
|
coWebsiteManager.closeCoWebsite(coWebsite);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.scene.connection?.emitPlayerStatusChange(AvailabilityStatus.ONLINE);
|
const newStatus = this.swapAvailabilityStatuses();
|
||||||
availabilityStatusStore.set(AvailabilityStatus.ONLINE);
|
this.scene.connection?.emitPlayerStatusChange(newStatus);
|
||||||
this.scene.CurrentPlayer.setStatus(AvailabilityStatus.ONLINE);
|
this.scene.CurrentPlayer.setStatus(newStatus);
|
||||||
} else {
|
} else {
|
||||||
const openJitsiRoomFunction = () => {
|
const openJitsiRoomFunction = () => {
|
||||||
const roomName = jitsiFactory.getRoomName(newValue.toString(), this.scene.instance);
|
const roomName = jitsiFactory.getRoomName(newValue.toString(), this.scene.instance);
|
||||||
@ -113,6 +113,7 @@ export class GameMapPropertiesListener {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
openJitsiRoomFunction();
|
openJitsiRoomFunction();
|
||||||
|
previousAvailabilityStatusStore.set(get(availabilityStatusStore));
|
||||||
this.scene.connection?.emitPlayerStatusChange(AvailabilityStatus.JITSI);
|
this.scene.connection?.emitPlayerStatusChange(AvailabilityStatus.JITSI);
|
||||||
availabilityStatusStore.set(AvailabilityStatus.JITSI);
|
availabilityStatusStore.set(AvailabilityStatus.JITSI);
|
||||||
this.scene.CurrentPlayer.setStatus(AvailabilityStatus.JITSI);
|
this.scene.CurrentPlayer.setStatus(AvailabilityStatus.JITSI);
|
||||||
@ -151,10 +152,11 @@ export class GameMapPropertiesListener {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.gameMap.onPropertyChange(GameMapProperties.SILENT, (newValue) => {
|
this.gameMap.onPropertyChange(GameMapProperties.SILENT, (newValue) => {
|
||||||
|
const newStatus = this.swapAvailabilityStatuses();
|
||||||
if (newValue === undefined || newValue === false || newValue === "") {
|
if (newValue === undefined || newValue === false || newValue === "") {
|
||||||
this.scene.connection?.emitPlayerStatusChange(AvailabilityStatus.ONLINE);
|
availabilityStatusStore.set(newStatus);
|
||||||
availabilityStatusStore.set(AvailabilityStatus.ONLINE);
|
this.scene.connection?.emitPlayerStatusChange(newStatus);
|
||||||
this.scene.CurrentPlayer.setStatus(AvailabilityStatus.ONLINE);
|
this.scene.CurrentPlayer.setStatus(newStatus);
|
||||||
} else {
|
} else {
|
||||||
this.scene.connection?.emitPlayerStatusChange(AvailabilityStatus.SILENT);
|
this.scene.connection?.emitPlayerStatusChange(AvailabilityStatus.SILENT);
|
||||||
availabilityStatusStore.set(AvailabilityStatus.SILENT);
|
availabilityStatusStore.set(AvailabilityStatus.SILENT);
|
||||||
@ -378,4 +380,11 @@ export class GameMapPropertiesListener {
|
|||||||
handler();
|
handler();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private swapAvailabilityStatuses(): AvailabilityStatus {
|
||||||
|
const newStatus = get(previousAvailabilityStatusStore);
|
||||||
|
previousAvailabilityStatusStore.set(get(availabilityStatusStore));
|
||||||
|
availabilityStatusStore.set(newStatus);
|
||||||
|
return newStatus;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ import { MapStore } from "../../Stores/Utils/MapStore";
|
|||||||
import { followUsersColorStore } from "../../Stores/FollowStore";
|
import { followUsersColorStore } from "../../Stores/FollowStore";
|
||||||
import { GameSceneUserInputHandler } from "../UserInput/GameSceneUserInputHandler";
|
import { GameSceneUserInputHandler } from "../UserInput/GameSceneUserInputHandler";
|
||||||
import { locale } from "../../i18n/i18n-svelte";
|
import { locale } from "../../i18n/i18n-svelte";
|
||||||
import { availabilityStatusStore, localVolumeStore } from "../../Stores/MediaStore";
|
import { availabilityStatusStore, localVolumeStore, previousAvailabilityStatusStore } from "../../Stores/MediaStore";
|
||||||
import { StringUtils } from "../../Utils/StringUtils";
|
import { StringUtils } from "../../Utils/StringUtils";
|
||||||
import { startLayerNamesStore } from "../../Stores/StartLayerNamesStore";
|
import { startLayerNamesStore } from "../../Stores/StartLayerNamesStore";
|
||||||
import { JitsiCoWebsite } from "../../WebRtc/CoWebsite/JitsiCoWebsite";
|
import { JitsiCoWebsite } from "../../WebRtc/CoWebsite/JitsiCoWebsite";
|
||||||
@ -709,9 +709,13 @@ export class GameScene extends DirtyScene {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.privacyShutdownStoreUnsubscribe = privacyShutdownStore.subscribe((away) => {
|
this.privacyShutdownStoreUnsubscribe = privacyShutdownStore.subscribe((away) => {
|
||||||
const status = away ? AvailabilityStatus.AWAY : AvailabilityStatus.ONLINE;
|
if ([AvailabilityStatus.SILENT, AvailabilityStatus.JITSI].includes(get(availabilityStatusStore))) {
|
||||||
this.connection?.emitPlayerStatusChange(status);
|
return;
|
||||||
|
}
|
||||||
|
const status = away ? AvailabilityStatus.AWAY : get(previousAvailabilityStatusStore);
|
||||||
|
previousAvailabilityStatusStore.set(get(availabilityStatusStore));
|
||||||
availabilityStatusStore.set(status);
|
availabilityStatusStore.set(status);
|
||||||
|
this.connection?.emitPlayerStatusChange(status);
|
||||||
});
|
});
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
|
@ -179,6 +179,7 @@ function createVideoConstraintStore() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const previousAvailabilityStatusStore = writable(AvailabilityStatus.ONLINE);
|
||||||
export const availabilityStatusStore = writable(AvailabilityStatus.ONLINE);
|
export const availabilityStatusStore = writable(AvailabilityStatus.ONLINE);
|
||||||
|
|
||||||
export const videoConstraintStore = createVideoConstraintStore();
|
export const videoConstraintStore = createVideoConstraintStore();
|
||||||
|
@ -5,10 +5,11 @@ import "google/protobuf/wrappers.proto";
|
|||||||
/*********** PARTIAL MESSAGES **************/
|
/*********** PARTIAL MESSAGES **************/
|
||||||
|
|
||||||
enum AvailabilityStatus {
|
enum AvailabilityStatus {
|
||||||
ONLINE = 0;
|
UNCHANGED = 0;
|
||||||
SILENT = 1;
|
ONLINE = 1;
|
||||||
AWAY = 2;
|
SILENT = 2;
|
||||||
JITSI = 3;
|
AWAY = 3;
|
||||||
|
JITSI = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
message PositionMessage {
|
message PositionMessage {
|
||||||
|
Loading…
Reference in New Issue
Block a user