Merge branch 'develop' of github.com:thecodingmachine/workadventure
This commit is contained in:
@@ -13,9 +13,27 @@ export class GameMapPropertiesListener {
|
||||
constructor(private scene: GameScene, private gameMap: GameMap) {}
|
||||
|
||||
register() {
|
||||
this.gameMap.onPropertyChange("openTab", (newValue) => {
|
||||
this.gameMap.onPropertyChange("openTab", (newValue, oldvalue, allProps) => {
|
||||
if (newValue === undefined) {
|
||||
layoutManagerActionStore.removeAction("openTab");
|
||||
}
|
||||
if (typeof newValue == "string" && newValue.length) {
|
||||
scriptUtils.openTab(newValue);
|
||||
const openWebsiteTriggerValue = allProps.get(TRIGGER_WEBSITE_PROPERTIES);
|
||||
if (openWebsiteTriggerValue && openWebsiteTriggerValue === ON_ACTION_TRIGGER_BUTTON) {
|
||||
let message = allProps.get(WEBSITE_MESSAGE_PROPERTIES);
|
||||
if (message === undefined) {
|
||||
message = "Press SPACE or touch here to open web site in new tab";
|
||||
}
|
||||
layoutManagerActionStore.addAction({
|
||||
uuid: "openTab",
|
||||
type: "message",
|
||||
message: message,
|
||||
callback: () => scriptUtils.openTab(newValue),
|
||||
userInputManager: this.scene.userInputManager,
|
||||
});
|
||||
} else {
|
||||
scriptUtils.openTab(newValue);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.gameMap.onPropertyChange("openWebsite", (newValue, oldValue, allProps) => {
|
||||
|
||||
@@ -82,7 +82,7 @@ import { biggestAvailableAreaStore } from "../../Stores/BiggestAvailableAreaStor
|
||||
import { SharedVariablesManager } from "./SharedVariablesManager";
|
||||
import { playersStore } from "../../Stores/PlayersStore";
|
||||
import { chatVisibilityStore } from "../../Stores/ChatStore";
|
||||
import { emoteStore } from "../../Stores/EmoteStore";
|
||||
import { emoteStore, emoteMenuStore } from "../../Stores/EmoteStore";
|
||||
import {
|
||||
audioManagerFileStore,
|
||||
audioManagerVisibilityStore,
|
||||
@@ -617,15 +617,13 @@ export class GameScene extends DirtyScene {
|
||||
this.openChatIcon.setVisible(!v);
|
||||
});
|
||||
|
||||
this.emoteUnsubscribe = emoteStore.subscribe(() => {
|
||||
const emoteKey = get(emoteStore);
|
||||
this.emoteUnsubscribe = emoteStore.subscribe((emoteKey) => {
|
||||
if (emoteKey) {
|
||||
this.CurrentPlayer?.playEmote(emoteKey)
|
||||
this.CurrentPlayer?.playEmote(emoteKey);
|
||||
this.connection?.emitEmoteEvent(emoteKey);
|
||||
emoteStore.set(null);
|
||||
}
|
||||
});
|
||||
|
||||
Promise.all([ this.connectionAnswerPromise as Promise<unknown>, ...scriptPromises ]).then(() => {
|
||||
this.scene.wake();
|
||||
});
|
||||
@@ -1482,7 +1480,12 @@ export class GameScene extends DirtyScene {
|
||||
return; //we don't want the menu to open when pinching on a touch screen.
|
||||
}
|
||||
|
||||
this.CurrentPlayer.openOrCloseEmoteMenu();
|
||||
// toggle EmoteMenu
|
||||
if (get(emoteMenuStore)) {
|
||||
emoteMenuStore.closeEmoteMenu();
|
||||
} else {
|
||||
emoteMenuStore.openEmoteMenu();
|
||||
}
|
||||
})
|
||||
this.CurrentPlayer.on(requestEmoteEventName, (emoteKey: string) => {
|
||||
this.connection?.emitEmoteEvent(emoteKey);
|
||||
|
||||
@@ -85,16 +85,4 @@ export class Player extends Character {
|
||||
return this.wasMoving;
|
||||
}
|
||||
|
||||
playEmote(emote: string) {
|
||||
super.playEmote(emote);
|
||||
emoteMenuStore.set(false);
|
||||
}
|
||||
|
||||
openOrCloseEmoteMenu() {
|
||||
if (get(emoteMenuStore)) {
|
||||
emoteMenuStore.set(false);
|
||||
} else {
|
||||
emoteMenuStore.set(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user