summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers/SoundEventController.cpp')
-rw-r--r--Swift/Controllers/SoundEventController.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/Swift/Controllers/SoundEventController.cpp b/Swift/Controllers/SoundEventController.cpp
index 456de44..29f7fbf 100644
--- a/Swift/Controllers/SoundEventController.cpp
+++ b/Swift/Controllers/SoundEventController.cpp
@@ -4,14 +4,18 @@
#include "Swift/Controllers/EventController.h"
#include "Swift/Controllers/SoundPlayer.h"
+#include "Swift/Controllers/UIEvents/UIEventStream.h"
+#include "Swift/Controllers/UIEvents/ToggleSoundsUIEvent.h"
namespace Swift {
-SoundEventController::SoundEventController(EventController* eventController, SoundPlayer* soundPlayer, bool playSounds) {
+SoundEventController::SoundEventController(EventController* eventController, SoundPlayer* soundPlayer, bool playSounds, UIEventStream* uiEvents) {
eventController_ = eventController;
eventController_->onEventQueueEventAdded.connect(boost::bind(&SoundEventController::handleEventQueueEventAdded, this, _1));
soundPlayer_ = soundPlayer;
playSounds_ = playSounds;
+ uiEvents_ = uiEvents;
+ uiEvents_->onUIEvent.connect(boost::bind(&SoundEventController::handleUIEvent, this, _1));
}
void SoundEventController::handleEventQueueEventAdded(boost::shared_ptr<StanzaEvent>) {
@@ -22,4 +26,11 @@ void SoundEventController::setPlaySounds(bool playSounds) {
playSounds_ = playSounds;
}
+void SoundEventController::handleUIEvent(boost::shared_ptr<UIEvent> event) {
+ boost::shared_ptr<ToggleSoundsUIEvent> soundEvent = boost::dynamic_pointer_cast<ToggleSoundsUIEvent>(event);
+ if (soundEvent) {
+ setPlaySounds(soundEvent->getEnabled());
+ }
+}
+
}