From 520184fdebe06e4635f289e9628df685c8fde4c6 Mon Sep 17 00:00:00 2001 From: Hanusiak Piotr Date: Tue, 1 Feb 2022 12:25:14 +0100 Subject: [PATCH] add talk-icon --- front/dist/resources/icons/icon_talking.svg | 1 + front/src/Phaser/Entity/Character.ts | 10 ++++++++++ front/src/Phaser/Game/GameScene.ts | 2 ++ 3 files changed, 13 insertions(+) create mode 100644 front/dist/resources/icons/icon_talking.svg diff --git a/front/dist/resources/icons/icon_talking.svg b/front/dist/resources/icons/icon_talking.svg new file mode 100644 index 00000000..2f1d03e3 --- /dev/null +++ b/front/dist/resources/icons/icon_talking.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/front/src/Phaser/Entity/Character.ts b/front/src/Phaser/Entity/Character.ts index e1fd3a5a..c6fd0c4a 100644 --- a/front/src/Phaser/Entity/Character.ts +++ b/front/src/Phaser/Entity/Character.ts @@ -31,6 +31,7 @@ const interactiveRadius = 35; export abstract class Character extends Container { private bubble: SpeechBubble | null = null; private readonly playerName: Text; + private readonly iconTalk: Phaser.GameObjects.Image; public PlayerValue: string; public sprites: Map; protected lastDirection: PlayerAnimationDirections = PlayerAnimationDirections.Down; @@ -97,6 +98,11 @@ export abstract class Character extends Container { this.playerName.setOrigin(0.5).setDepth(DEPTH_INGAME_TEXT_INDEX); this.add(this.playerName); + this.iconTalk = new Phaser.GameObjects.Image(scene, 0, -45, 'iconTalk') + .setScale(0.15) + .setVisible(false); + this.add(this.iconTalk); + if (isClickable) { this.setInteractive({ hitArea: new Phaser.Geom.Circle(0, 0, interactiveRadius), @@ -156,6 +162,10 @@ export abstract class Character extends Container { }); } + public showIconTalk(show: boolean = true): void { + this.iconTalk.setVisible(show); + } + public addCompanion(name: string, texturePromise?: Promise): void { if (typeof texturePromise !== "undefined") { this.companion = new Companion(this.scene, this.x, this.y, name, texturePromise); diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 23a211a6..215797bb 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -245,6 +245,7 @@ export class GameScene extends DirtyScene { loadCustomTexture(this.load, texture).catch((e) => console.error(e)); } } + this.load.svg('iconTalk', '/resources/icons/icon_talking.svg'); if (touchScreenManager.supportTouchScreen) { this.load.image(joystickBaseKey, joystickBaseImg); @@ -630,6 +631,7 @@ export class GameScene extends DirtyScene { let oldPeerNumber = 0; this.peerStoreUnsubscribe = peerStore.subscribe((peers) => { + console.log(peers); const newPeerNumber = peers.size; if (newPeerNumber > oldPeerNumber) { this.playSound("audio-webrtc-in");