Skip to content

Commit

Permalink
added content for sound options dialog, see #216
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Oct 7, 2019
1 parent 9e17257 commit 80a940b
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
5 changes: 5 additions & 0 deletions js/molecules-and-light-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ define( require => {
// modules
const MoleculesAndLightKeyboardHelpContent = require( 'MOLECULES_AND_LIGHT/common/view/MoleculesAndLightKeyboardHelpContent' );
const MoleculesAndLightScreen = require( 'MOLECULES_AND_LIGHT/moleculesandlight/MoleculesAndLightScreen' );
const malSoundOptionsDialogContent = require( 'MOLECULES_AND_LIGHT/moleculesandlight/view/malSoundOptionsDialogContent' );
const platform = require( 'PHET_CORE/platform' );
const Sim = require( 'JOIST/Sim' );
const SimLauncher = require( 'JOIST/SimLauncher' );
Expand All @@ -24,6 +25,10 @@ define( require => {
const simOptions = {
keyboardHelpNode: keyboardHelpContent,

createOptionsDialogContent: phet.chipper.queryParameters.supportsSound ?
() => { return malSoundOptionsDialogContent; } :
null,

credits: {
leadDesign: 'Kelly Lancaster (Java), Amy Rouinfar (HTML5)',
softwareDevelopment: 'Jesse Greenberg, John Blanco, Sam Reid, Aaron Davis',
Expand Down
88 changes: 88 additions & 0 deletions js/moleculesandlight/view/malSoundOptionsDialogContent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// Copyright 2019, University of Colorado Boulder

/**
* MALSoundOptionsDialogContent is a Scenery node that presents a set of options for choosing between various sound
* options. This file is meant to exist temporarily, just long enough for the sound design to be worked out. This
* node should never be seen by end users.
*
* The dialog content node is implemented as a singleton so that the values it manages can be obtained in multiple
* places.
*
* TODO: Delete this dialog and all usages thereof once the sound design is finalized, see
* https://github.com/phetsims/molecules-and-light/issues/216
*
* @author John Blanco
*/

define( require => {
'use strict';

// modules
const AquaRadioButton = require( 'SUN/AquaRadioButton' );
const Node = require( 'SCENERY/nodes/Node' );
const NumberProperty = require( 'AXON/NumberProperty' );
const moleculesAndLight = require( 'MOLECULES_AND_LIGHT/moleculesAndLight' );
const PhetFont = require( 'SCENERY_PHET/PhetFont' );
const Text = require( 'SCENERY/nodes/Text' );
const VBox = require( 'SCENERY/nodes/VBox' );

// constants
const RADIO_BUTTON_TEXT_OPTIONS = { font: new PhetFont( 16 ) };

/**
* @constructor
* @param {Node} content - content for the dialog
* @param {Tandem} tandem
*/
class MALSoundOptionsDialogContent extends Node {

constructor() {
super();

// @public (read-only)
this.photonSoundSetProperty = new NumberProperty( 1 );

// Create the radio buttons. I (jbphet) know that it's a bit silly to have numbers for radio button entries, but
// I've done it this way so that the sound families can be easily named if desired.
const oneRadioButton = new AquaRadioButton(
this.photonSoundSetProperty,
1,
new Text( '1', RADIO_BUTTON_TEXT_OPTIONS )
);
const twoRadioButton = new AquaRadioButton(
this.photonSoundSetProperty,
2,
new Text( '2', RADIO_BUTTON_TEXT_OPTIONS )
);
const threeRadioButton = new AquaRadioButton(
this.photonSoundSetProperty,
3,
new Text( '3', RADIO_BUTTON_TEXT_OPTIONS )
);
const fourRadioButton = new AquaRadioButton(
this.photonSoundSetProperty,
4,
new Text( '4', RADIO_BUTTON_TEXT_OPTIONS )
);

this.addChild( new VBox( {
children: [
new Text( 'Photon Sound Family', { font: new PhetFont( 20 ), weight: 'bold' } ),
oneRadioButton,
twoRadioButton,
threeRadioButton,
fourRadioButton
],
align: 'left'
} ) );
}
}

const malSoundOptionsDialogContent = new MALSoundOptionsDialogContent();

moleculesAndLight.register( 'malSoundOptionsDialogContent', malSoundOptionsDialogContent );

// return the singleton instance
return malSoundOptionsDialogContent;

} );

0 comments on commit 80a940b

Please sign in to comment.