use emote button
This commit is contained in:
parent
83bd19c8dc
commit
f43deff626
9 changed files with 329 additions and 202 deletions
|
@ -1,8 +1,6 @@
|
|||
import {emoteEventStream} from "../../Connexion/EmoteEventStream";
|
||||
import type {GameScene} from "./GameScene";
|
||||
import type {Subscription} from "rxjs";
|
||||
|
||||
export const emotes: string[] = ['❤️', '👏', '✋', '🙏', '👍', '👎'];
|
||||
import { emoteEventStream } from "../../Connexion/EmoteEventStream";
|
||||
import type { GameScene } from "./GameScene";
|
||||
import type { Subscription } from "rxjs";
|
||||
|
||||
export class EmoteManager {
|
||||
private subscription: Subscription;
|
||||
|
@ -10,18 +8,13 @@ export class EmoteManager {
|
|||
constructor(private scene: GameScene) {
|
||||
this.subscription = emoteEventStream.stream.subscribe((event) => {
|
||||
const actor = this.scene.MapPlayersByKey.get(event.userId);
|
||||
if(actor) {
|
||||
if (actor) {
|
||||
actor.playEmote(event.emote);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
getEmotes(): string[] {
|
||||
// TODO: localstorage + management
|
||||
return emotes;
|
||||
});
|
||||
}
|
||||
|
||||
destroy() {
|
||||
this.subscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1319,9 +1319,9 @@ ${escapedMessage}
|
|||
if (pointer.wasTouch && (pointer.event as TouchEvent).touches.length > 1) {
|
||||
return; //we don't want the menu to open when pinching on a touch screen.
|
||||
}
|
||||
|
||||
this.CurrentPlayer.openOrCloseEmoteMenu( this.emoteManager.getEmotes());
|
||||
})
|
||||
|
||||
this.CurrentPlayer.openOrCloseEmoteMenu();
|
||||
});
|
||||
this.CurrentPlayer.on(requestEmoteEventName, (emoteKey: string) => {
|
||||
this.connection?.emitEmoteEvent(emoteKey);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue