From f46d7d57f3e5b16fab49aee34f2253d7a697971e Mon Sep 17 00:00:00 2001 From: Piotr Hanusiak Date: Thu, 5 May 2022 11:46:15 +0200 Subject: [PATCH] chat bubble above game tiles (#2129) Co-authored-by: Piotr 'pwh' Hanusiak --- front/src/Phaser/Game/DepthIndexes.ts | 1 + front/src/Phaser/Game/GameScene.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/front/src/Phaser/Game/DepthIndexes.ts b/front/src/Phaser/Game/DepthIndexes.ts index d2d38328..04d38146 100644 --- a/front/src/Phaser/Game/DepthIndexes.ts +++ b/front/src/Phaser/Game/DepthIndexes.ts @@ -4,5 +4,6 @@ export const DEPTH_TILE_INDEX = 0; //Note: Player characters use their y coordinate as their depth to simulate a perspective. //See the Character class. export const DEPTH_OVERLAY_INDEX = 10000; +export const DEPTH_BUBBLE_CHAT_SPRITE = 99999; export const DEPTH_INGAME_TEXT_INDEX = 100000; export const DEPTH_UI_INDEX = 1000000; diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index c573cea7..427be444 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -101,6 +101,7 @@ import type { CoWebsite } from "../../WebRtc/CoWebsite/CoWesbite"; import CancelablePromise from "cancelable-promise"; import { Deferred } from "ts-deferred"; import { SuperLoaderPlugin } from "../Services/SuperLoaderPlugin"; +import { DEPTH_BUBBLE_CHAT_SPRITE } from "./DepthIndexes"; import { ErrorScreenMessage, PlayerDetailsUpdatedMessage } from "../../Messages/ts-proto-generated/protos/messages"; import { uiWebsiteManager } from "./UI/UIWebsiteManager"; export interface GameSceneInitInterface { @@ -1216,7 +1217,7 @@ ${escapedMessage} this.CurrentPlayer.y, "circleSprite-white" ); - scriptedBubbleSprite.setDisplayOrigin(48, 48); + scriptedBubbleSprite.setDisplayOrigin(48, 48).setDepth(DEPTH_BUBBLE_CHAT_SPRITE); this.add.existing(scriptedBubbleSprite); }) ); @@ -2079,7 +2080,7 @@ ${escapedMessage} ? "circleSprite-red" : "circleSprite-white" ); - sprite.setDisplayOrigin(48, 48); + sprite.setDisplayOrigin(48, 48).setDepth(DEPTH_BUBBLE_CHAT_SPRITE); this.add.existing(sprite); this.groups.set(groupPositionMessage.groupId, sprite); if (this.currentPlayerGroupId === groupPositionMessage.groupId) {