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

View File

@ -0,0 +1 @@
<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>

After

Width:  |  Height:  |  Size: 1.9 KiB

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);

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");