hide voice indicator for player leaving still existing bubble conversation
This commit is contained in:
parent
6890e2579c
commit
cd42f30aa7
@ -97,7 +97,7 @@ import { startLayerNamesStore } from "../../Stores/StartLayerNamesStore";
|
|||||||
import { JitsiCoWebsite } from "../../WebRtc/CoWebsite/JitsiCoWebsite";
|
import { JitsiCoWebsite } from "../../WebRtc/CoWebsite/JitsiCoWebsite";
|
||||||
import { SimpleCoWebsite } from "../../WebRtc/CoWebsite/SimpleCoWebsite";
|
import { SimpleCoWebsite } from "../../WebRtc/CoWebsite/SimpleCoWebsite";
|
||||||
import type { CoWebsite } from "../../WebRtc/CoWebsite/CoWesbite";
|
import type { CoWebsite } from "../../WebRtc/CoWebsite/CoWesbite";
|
||||||
import { BodyResourceDescriptionInterface } from "../Entity/PlayerTextures";
|
import type { VideoPeer } from "../../WebRtc/VideoPeer";
|
||||||
import CancelablePromise from "cancelable-promise";
|
import CancelablePromise from "cancelable-promise";
|
||||||
import { Deferred } from "ts-deferred";
|
import { Deferred } from "ts-deferred";
|
||||||
export interface GameSceneInitInterface {
|
export interface GameSceneInitInterface {
|
||||||
@ -628,7 +628,7 @@ export class GameScene extends DirtyScene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const talkIconVolumeTreshold = 10;
|
const talkIconVolumeTreshold = 10;
|
||||||
let oldPeerNumber = 0;
|
const oldPeers = new Map<number, VideoPeer>();
|
||||||
this.peerStoreUnsubscribe = peerStore.subscribe((peers) => {
|
this.peerStoreUnsubscribe = peerStore.subscribe((peers) => {
|
||||||
this.volumeStoreUnsubscribers.forEach((unsubscribe) => unsubscribe());
|
this.volumeStoreUnsubscribers.forEach((unsubscribe) => unsubscribe());
|
||||||
this.volumeStoreUnsubscribers.clear();
|
this.volumeStoreUnsubscribers.clear();
|
||||||
@ -645,10 +645,17 @@ export class GameScene extends DirtyScene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const newPeerNumber = peers.size;
|
const newPeerNumber = peers.size;
|
||||||
if (newPeerNumber > oldPeerNumber) {
|
if (newPeerNumber > oldPeers.size) {
|
||||||
this.playSound("audio-webrtc-in");
|
this.playSound("audio-webrtc-in");
|
||||||
} else if (newPeerNumber < oldPeerNumber) {
|
} else if (newPeerNumber < oldPeers.size) {
|
||||||
this.playSound("audio-webrtc-out");
|
this.playSound("audio-webrtc-out");
|
||||||
|
const oldPeersKeys = oldPeers.keys();
|
||||||
|
const newPeersKeys = Array.from(peers.keys());
|
||||||
|
for (const oldKey of oldPeersKeys) {
|
||||||
|
if (!newPeersKeys.includes(oldKey)) {
|
||||||
|
this.MapPlayersByKey.get(oldKey)?.showTalkIcon(false, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (newPeerNumber > 0) {
|
if (newPeerNumber > 0) {
|
||||||
if (!this.localVolumeStoreUnsubscriber) {
|
if (!this.localVolumeStoreUnsubscriber) {
|
||||||
@ -666,7 +673,10 @@ export class GameScene extends DirtyScene {
|
|||||||
this.localVolumeStoreUnsubscriber = undefined;
|
this.localVolumeStoreUnsubscriber = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
oldPeerNumber = newPeerNumber;
|
oldPeers.clear();
|
||||||
|
for (const [key, val] of peers) {
|
||||||
|
oldPeers.set(key, val);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.emoteUnsubscribe = emoteStore.subscribe((emote) => {
|
this.emoteUnsubscribe = emoteStore.subscribe((emote) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user