Merge branch 'develop' of github.com:thecodingmachine/workadventure

This commit is contained in:
_Bastler
2021-10-27 19:17:23 +02:00
3 changed files with 11 additions and 6 deletions
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import type {PlayerInterface} from "../../Phaser/Game/PlayerInterface"; import type {PlayerInterface} from "../../Phaser/Game/PlayerInterface";
import {chatSubMenuVisbilityStore} from "../../Stores/ChatStore"; import {chatSubMenuVisibilityStore} from "../../Stores/ChatStore";
import {onDestroy, onMount} from "svelte"; import {onDestroy, onMount} from "svelte";
import type {Unsubscriber} from "svelte/store"; import type {Unsubscriber} from "svelte/store";
import ChatSubMenu from "./ChatSubMenu.svelte"; import ChatSubMenu from "./ChatSubMenu.svelte";
@@ -12,11 +12,11 @@
let chatSubMenuVisivilytUnsubcribe: Unsubscriber; let chatSubMenuVisivilytUnsubcribe: Unsubscriber;
function openSubMenu() { function openSubMenu() {
chatSubMenuVisbilityStore.openSubMenu(player.name, line); chatSubMenuVisibilityStore.openSubMenu(player.name, line);
} }
onMount(() => { onMount(() => {
chatSubMenuVisivilytUnsubcribe = chatSubMenuVisbilityStore.subscribe((newValue) => { chatSubMenuVisivilytUnsubcribe = chatSubMenuVisibilityStore.subscribe((newValue) => {
isSubMenuOpen = (newValue === player.name + line); isSubMenuOpen = (newValue === player.name + line);
}) })
}) })
+1 -1
View File
@@ -109,7 +109,7 @@ export abstract class Character extends Container {
this.setSize(16, 16); this.setSize(16, 16);
this.getBody().setSize(16, 16); //edit the hitbox to better match the character model this.getBody().setSize(16, 16); //edit the hitbox to better match the character model
this.getBody().setOffset(0, 8); this.getBody().setOffset(0, 8);
this.setDepth(-1); this.setDepth(0);
if (typeof companion === "string") { if (typeof companion === "string") {
this.addCompanion(companion, companionTexturePromise); this.addCompanion(companion, companionTexturePromise);
+7 -2
View File
@@ -84,7 +84,12 @@ function createChatMessagesStore() {
addExternalMessage(authorId: number, text: string) { addExternalMessage(authorId: number, text: string) {
update((list) => { update((list) => {
const lastMessage = list[list.length - 1]; const lastMessage = list[list.length - 1];
if (lastMessage && lastMessage.type === ChatMessageTypes.text && lastMessage.text && lastMessage?.author?.userId === authorId) { if (
lastMessage &&
lastMessage.type === ChatMessageTypes.text &&
lastMessage.text &&
lastMessage?.author?.userId === authorId
) {
lastMessage.text.push(text); lastMessage.text.push(text);
} else { } else {
list.push({ list.push({
@@ -116,4 +121,4 @@ function createChatSubMenuVisibilityStore() {
}; };
} }
export const chatSubMenuVisbilityStore = createChatSubMenuVisibilityStore(); export const chatSubMenuVisibilityStore = createChatSubMenuVisibilityStore();