Skip to content

Commit

Permalink
Remove temporary code => separate branch
Browse files Browse the repository at this point in the history
  • Loading branch information
kintel committed Nov 23, 2015
1 parent b0bdd95 commit b5ad568
Showing 1 changed file with 1 addition and 92 deletions.
93 changes: 1 addition & 92 deletions src/audio-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,97 +91,6 @@ export default class AudioView {
}

_handleChanges(changes) {
if (changes.currentGame === GAMES.HANDSHAKE) this.sounds.alone.ambient.play();

this._handleHandshakeChanges(changes);
this._handleStatusChanges(changes);
this._handleLightChanges(changes);
}

_handleHandshakeChanges(changes) {
if (changes.handshakes) {
// Did someone shake my hand?
if (changes.handshakes[this.config.username]) {
this.sounds.alone.ambient.stop();
this.sounds.alone.handshake.play();
}
}
}

_handleStatusChanges(changes) {
if (changes.status) {
let statusSounds;

if (this.store.isPlayingMoleGame) {
statusSounds = {
[SculptureStore.STATUS_SUCCESS]: this.sounds.mole.success,
[SculptureStore.STATUS_FAILURE]: this.sounds.mole.failure
};
}
if (this.store.isPlayingSimonGame) {
statusSounds = {
[SculptureStore.STATUS_SUCCESS]: this.sounds.simon.success,
[SculptureStore.STATUS_FAILURE]: this.sounds.simon.failure
};
}

const statusSound = statusSounds[changes.status];
if (statusSound) statusSound.play();
}
}

_handleLightChanges(changes) {
const lightChanges = changes.lights;
if (!lightChanges || !this.store.isReady) {
return;
}

if (this.store.isPlayingMoleGame) {
const lightArray = this.lightArray;
for (let stripId of Object.keys(lightChanges)) {
const panels = lightChanges[stripId].panels;
for (let panelId of Object.keys(panels)) {
const panelChanges = panels[panelId];
if (panelChanges.intensity > 90) {
this.sounds.mole.panels[stripId][panelId].play();
}
if (panelChanges.hasOwnProperty("active")) {
if (panelChanges.active) {
const molegame = this.store.currentGameLogic;
const moledata = this.store.data.get('mole');
const currentTarget = molegame.getTargetPanels(moledata.get('targetIndex'));

// FIXME: The problem here is that currentTarget gets removed by the MoleGameLogic before this event reaches us. We may have to transport this info in the changes object as that's currently not done.

if (currentTarget.has(stripId, panelId)) {
this.sounds.mole.success.play();
}
else {
this.sounds.mole.failure.play();
// console.log(`Play ${stripId}:${panelId}`);
// this.panelsounds[stripId][panelId].play();
}
}
}

}
}
}
if (this.store.isPlayingSimonGame) {
const lightArray = this.lightArray;
for (let stripId of Object.keys(lightChanges)) {
const panels = lightChanges[stripId].panels;
for (let panelId of Object.keys(panels)) {
const panelChanges = panels[panelId];
if (panelChanges.active || panelChanges.intensity > 90) {
this.sounds.simon.panels[stripId][panelId].play();
}
}
}
}
}

get lightArray() {
return this.store.data.get('lights');
// FIXME: Turn changes in sculpture store into audio here
}
}

1 comment on commit b5ad568

@sunjay
Copy link
Contributor

@sunjay sunjay commented on b5ad568 Nov 23, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair. 👍

Please sign in to comment.