use png instead of svg for talk icon

This commit is contained in:
Hanusiak Piotr 2022-02-14 10:37:13 +01:00
parent e85f94998f
commit 639c456540
3 changed files with 5 additions and 5 deletions

View File

@ -1 +0,0 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 367.4 343.27"><path d="M342.12,294.51c13.41,7.49,24.13,14.06,31.43,18.68,33.88,21.42,50.42,34.65,61.24,28.62a14.3,14.3,0,0,0,6-7q5.16-18.15,10.33-36.3" transform="translate(-122.66 0)" style="fill:#d6e0e7"/><path d="M246.56,215.43c-25.86,0-46.83-19.56-46.83-43.69V20.51a128.34,128.34,0,0,0-12.8-4.32A119.78,119.78,0,0,0,170.79,13a127,127,0,0,0-29.61-.14,59.93,59.93,0,0,0-9.52,2.27c-8.71,2.72-9,4.68-9,5.23v223.2c0,20.9,37.31,56.12,60.28,56.12L469,299.06a23,23,0,0,0,13.41-3.42,22.48,22.48,0,0,0,6.32-6.05l.37-74.19Z" transform="translate(-122.66 0)" style="fill:#d6e0e7"/><path d="M461.36,13.17H184.88a14.12,14.12,0,0,0-14.12,14.06V230.8a14.12,14.12,0,0,0,14.12,14.12H341a4.64,4.64,0,0,1,2.7.84l71.4,50.64V249.59a4.72,4.72,0,0,1,4.72-4.67h41.58a14.12,14.12,0,0,0,14.12-14.12h0V27.23A14.12,14.12,0,0,0,461.36,13.17Z" transform="translate(-122.66 0)" style="fill:#b0d4e8"/><path d="M419.78,316.6a9.86,9.86,0,0,1-5.62-1.8l-76.58-53.9H184.88a28.68,28.68,0,0,1-28.69-28.69h0V28.64A28.75,28.75,0,0,1,184.88,0H461.36a28.77,28.77,0,0,1,28.7,28.64V232.2a28.7,28.7,0,0,1-28.7,28.7H429.63v45.74a9.73,9.73,0,0,1-5.63,8.72A9.23,9.23,0,0,1,419.78,316.6ZM184.88,19.75a8.94,8.94,0,0,0-8.94,8.89V232.2a9,9,0,0,0,8.94,9H341a9.86,9.86,0,0,1,5.62,1.8l63.24,44.62V251a9.85,9.85,0,0,1,9.85-9.84h41.69a9,9,0,0,0,9-8.89V28.64a9,9,0,0,0-9-8.89Z" transform="translate(-122.66 0)" style="fill:#4e7a9e"/><path d="M246.32,152.51A20.48,20.48,0,1,1,266.75,132V132A20.48,20.48,0,0,1,246.32,152.51Z" transform="translate(-122.66 0)" style="fill:#fff"/><path d="M327.85,152.51A20.48,20.48,0,1,1,348.27,132V132A20.47,20.47,0,0,1,327.85,152.51Z" transform="translate(-122.66 0)" style="fill:#fff"/><path d="M409.37,152.51A20.48,20.48,0,1,1,429.8,132V132A20.48,20.48,0,0,1,409.37,152.51Z" transform="translate(-122.66 0)" style="fill:#fff"/></svg>

Before

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -11,7 +11,7 @@ export class TalkIcon extends Phaser.GameObjects.Image {
super(scene, x, y, "iconTalk"); super(scene, x, y, "iconTalk");
this.defaultPosition = { x, y }; this.defaultPosition = { x, y };
this.defaultScale = 0.15; this.defaultScale = 0.3;
this.shown = false; this.shown = false;
this.setAlpha(0); this.setAlpha(0);

View File

@ -251,7 +251,7 @@ export class GameScene extends DirtyScene {
loadCustomTexture(this.load, texture).catch((e) => console.error(e)); loadCustomTexture(this.load, texture).catch((e) => console.error(e));
} }
} }
this.load.svg("iconTalk", "/resources/icons/icon_talking.svg"); this.load.image("iconTalk", "/resources/icons/icon_talking.png");
if (touchScreenManager.supportTouchScreen) { if (touchScreenManager.supportTouchScreen) {
this.load.image(joystickBaseKey, joystickBaseImg); this.load.image(joystickBaseKey, joystickBaseImg);
@ -646,6 +646,7 @@ export class GameScene extends DirtyScene {
this.connect(); this.connect();
} }
const talkIconVolumeTreshold = 10;
let oldPeerNumber = 0; let oldPeerNumber = 0;
this.peerStoreUnsubscribe = peerStore.subscribe((peers) => { this.peerStoreUnsubscribe = peerStore.subscribe((peers) => {
this.volumeStoreUnsubscribers.forEach((unsubscribe) => unsubscribe()); this.volumeStoreUnsubscribers.forEach((unsubscribe) => unsubscribe());
@ -656,7 +657,7 @@ export class GameScene extends DirtyScene {
key, key,
videoStream.volumeStore.subscribe((volume) => { videoStream.volumeStore.subscribe((volume) => {
if (volume) { if (volume) {
this.MapPlayersByKey.get(key)?.showTalkIcon(volume > 5); this.MapPlayersByKey.get(key)?.showTalkIcon(volume > talkIconVolumeTreshold);
} }
}) })
); );
@ -671,7 +672,7 @@ export class GameScene extends DirtyScene {
if (newPeerNumber > 0) { if (newPeerNumber > 0) {
this.localVolumeStoreUnsubscriber = localVolumeStore.subscribe((volume) => { this.localVolumeStoreUnsubscriber = localVolumeStore.subscribe((volume) => {
if (volume) { if (volume) {
this.CurrentPlayer.showTalkIcon(volume > 5); this.CurrentPlayer.showTalkIcon(volume > talkIconVolumeTreshold);
} }
}); });
} else { } else {