add talk-icon

This commit is contained in:
Hanusiak Piotr
2022-02-01 12:25:14 +01:00
parent 4210334aa2
commit 520184fdeb
3 changed files with 13 additions and 0 deletions
+10
View File
@@ -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<string, Sprite>;
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<string>): void {
if (typeof texturePromise !== "undefined") {
this.companion = new Companion(this.scene, this.x, this.y, name, texturePromise);
+2
View File
@@ -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");