From 902ce585e56f2fab4ceffcac4a85d405cceb098c Mon Sep 17 00:00:00 2001 From: gereon77 Date: Thu, 8 Feb 2024 00:35:16 +0100 Subject: [PATCH] Add volume slider and rework audio handling --- .../src/client/EntireGameComponent.tsx | 26 +- agot-bg-game-server/src/client/GameClient.ts | 49 ++- .../src/client/IngameComponent.tsx | 316 +++++++++--------- .../src/client/chat-client/ChatComponent.tsx | 7 +- .../game-state-panel/CombatComponent.tsx | 6 +- .../game-state-panel/GameEndedComponent.tsx | 6 +- .../ResolveSingleMarchOrderComponent.tsx | 4 +- .../src/client/utils/SfxManager.ts | 287 ++++++++++++++++ .../client/utils/VolumeSliderComponent.tsx | 67 ++++ .../src/client/utils/sound-effects.ts | 161 --------- agot-bg-game-server/src/common/EntireGame.ts | 4 +- .../src/messages/ClientMessage.ts | 4 +- agot-bg-game-server/src/server/User.ts | 31 +- .../src/server/serializedGameMigrations.ts | 14 + 14 files changed, 621 insertions(+), 361 deletions(-) create mode 100644 agot-bg-game-server/src/client/utils/SfxManager.ts create mode 100644 agot-bg-game-server/src/client/utils/VolumeSliderComponent.tsx delete mode 100644 agot-bg-game-server/src/client/utils/sound-effects.ts diff --git a/agot-bg-game-server/src/client/EntireGameComponent.tsx b/agot-bg-game-server/src/client/EntireGameComponent.tsx index 49a7349ce..621fb3d48 100644 --- a/agot-bg-game-server/src/client/EntireGameComponent.tsx +++ b/agot-bg-game-server/src/client/EntireGameComponent.tsx @@ -10,7 +10,6 @@ import CancelledComponent from "./CancelledComponent"; import CancelledGameState from "../common/cancelled-game-state/CancelledGameState"; import Col from "react-bootstrap/Col"; import Badge from "react-bootstrap/Badge"; -import notificationSound from "../../public/sounds/notification.ogg"; import faviconNormal from "../../public/images/favicon.ico"; import faviconAlert from "../../public/images/favicon-alert.ico"; import rollingDicesImage from "../../public/images/icons/rolling-dices.svg"; @@ -25,7 +24,6 @@ import HouseIconComponent from "./game-state-panel/utils/HouseIconComponent"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faLock, faTriangleExclamation } from "@fortawesome/free-solid-svg-icons"; import GameEndedGameState from "../common/ingame-game-state/game-ended-game-state/GameEndedGameState"; -import introSound from "../../public/sounds/game-of-thrones-intro.ogg"; import CombatGameState from "../common/ingame-game-state/action-game-state/resolve-march-order-game-state/combat-game-state/CombatGameState"; import { toast, ToastContainer } from "react-toastify"; import { cssTransition } from "react-toastify"; @@ -48,7 +46,6 @@ interface EntireGameComponentProps { @observer export default class EntireGameComponent extends Component { @observable showMapWhenDrafting = false; - @observable playWelcomeSound = false; setIntervalId = -1; get entireGame(): EntireGame { @@ -121,9 +118,6 @@ export default class EntireGameComponent extends Component : this.entireGame.childGameState instanceof CancelledGameState && } - {this.playWelcomeSound && !this.props.gameClient.musicMuted && -