fix ReportMenu (#1397)

This commit is contained in:
GRL78 2021-09-01 10:11:12 +02:00 committed by GitHub
parent d7b552a513
commit 19baf7f582
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 19 deletions

View File

@ -21,7 +21,7 @@
if (reportScreenStore != null) { if (reportScreenStore != null) {
userName = reportScreenStore.userName; userName = reportScreenStore.userName;
userUUID = playersStore.getPlayerById(reportScreenStore.userId)?.userUuid; userUUID = playersStore.getPlayerById(reportScreenStore.userId)?.userUuid;
if (userUUID === undefined) { if (userUUID === undefined && reportScreenStore !== userReportEmpty) {
console.error("Could not find UUID for user with ID " + reportScreenStore.userId); console.error("Could not find UUID for user with ID " + reportScreenStore.userId);
} }
} }

View File

@ -1,16 +1,15 @@
import type {GameScene} from "../Game/GameScene"; import type { GameScene } from "../Game/GameScene";
import type {PointInterface} from "../../Connexion/ConnexionModels"; import type { PointInterface } from "../../Connexion/ConnexionModels";
import {Character} from "../Entity/Character"; import { Character } from "../Entity/Character";
import type {PlayerAnimationDirections} from "../Player/Animation"; import type { PlayerAnimationDirections } from "../Player/Animation";
import {requestVisitCardsStore} from "../../Stores/GameStore"; import { requestVisitCardsStore } from "../../Stores/GameStore";
/** /**
* Class representing the sprite of a remote player (a player that plays on another computer) * Class representing the sprite of a remote player (a player that plays on another computer)
*/ */
export class RemotePlayer extends Character { export class RemotePlayer extends Character {
userId: number; userId: number;
private visitCardUrl: string|null; private visitCardUrl: string | null;
constructor( constructor(
userId: number, userId: number,
@ -21,19 +20,33 @@ export class RemotePlayer extends Character {
texturesPromise: Promise<string[]>, texturesPromise: Promise<string[]>,
direction: PlayerAnimationDirections, direction: PlayerAnimationDirections,
moving: boolean, moving: boolean,
visitCardUrl: string|null, visitCardUrl: string | null,
companion: string|null, companion: string | null,
companionTexturePromise?: Promise<string> companionTexturePromise?: Promise<string>
) { ) {
super(Scene, x, y, texturesPromise, name, direction, moving, 1, !!visitCardUrl, companion, companionTexturePromise); super(
Scene,
x,
y,
texturesPromise,
name,
direction,
moving,
1,
!!visitCardUrl,
companion,
companionTexturePromise
);
//set data //set data
this.userId = userId; this.userId = userId;
this.visitCardUrl = visitCardUrl; this.visitCardUrl = visitCardUrl;
this.on('pointerdown', () => { this.on("pointerdown", (event: Phaser.Input.Pointer) => {
requestVisitCardsStore.set(this.visitCardUrl); if (event.downElement.nodeName === "CANVAS") {
}) requestVisitCardsStore.set(this.visitCardUrl);
}
});
} }
updatePosition(position: PointInterface): void { updatePosition(position: PointInterface): void {

View File

@ -1,11 +1,12 @@
import { derived } from "svelte/store"; import { derived } from "svelte/store";
import { menuInputFocusStore } from "./MenuStore"; import { menuInputFocusStore } from "./MenuStore";
import { chatInputFocusStore } from "./ChatStore"; import { chatInputFocusStore } from "./ChatStore";
import { showReportScreenStore, userReportEmpty } from "./ShowReportScreenStore";
//derived from the focus on Menu, ConsoleGlobal, Chat and ... //derived from the focus on Menu, ConsoleGlobal, Chat and ...
export const enableUserInputsStore = derived( export const enableUserInputsStore = derived(
[menuInputFocusStore, chatInputFocusStore], [menuInputFocusStore, chatInputFocusStore, showReportScreenStore],
([$menuInputFocusStore, $chatInputFocusStore]) => { ([$menuInputFocusStore, $chatInputFocusStore, $showReportScreenStore]) => {
return !$menuInputFocusStore && !$chatInputFocusStore; return !$menuInputFocusStore && !$chatInputFocusStore && !($showReportScreenStore !== userReportEmpty);
} }
); );