Skip to content

Commit

Permalink
Adding screen icons and converting to ES6, see phetsims/fractions-com…
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanolson committed Dec 27, 2018
1 parent f6fcb3d commit 1712dce
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 96 deletions.
20 changes: 10 additions & 10 deletions js/fractions-mixed-numbers-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
*
* @author Jonathan Olson <[email protected]>
*/
define( function( require ) {
define( require => {
'use strict';

// modules
var GameScreen = require( 'FRACTIONS_MIXED_NUMBERS/view/GameScreen' );
var IntroScreen = require( 'FRACTIONS_MIXED_NUMBERS/view/IntroScreen' );
var LabScreen = require( 'FRACTIONS_MIXED_NUMBERS/view/LabScreen' );
var Sim = require( 'JOIST/Sim' );
var SimLauncher = require( 'JOIST/SimLauncher' );
const GameScreen = require( 'FRACTIONS_MIXED_NUMBERS/view/GameScreen' );
const IntroScreen = require( 'FRACTIONS_MIXED_NUMBERS/view/IntroScreen' );
const LabScreen = require( 'FRACTIONS_MIXED_NUMBERS/view/LabScreen' );
const Sim = require( 'JOIST/Sim' );
const SimLauncher = require( 'JOIST/SimLauncher' );

// strings
var fractionsMixedNumbersTitleString = require( 'string!FRACTIONS_MIXED_NUMBERS/fractions-mixed-numbers.title' );
const fractionsMixedNumbersTitleString = require( 'string!FRACTIONS_MIXED_NUMBERS/fractions-mixed-numbers.title' );

var simOptions = {
const simOptions = {
credits: {
//TODO fill in proper credits, all of these fields are optional, see joist.AboutDialog
leadDesign: '',
Expand All @@ -30,8 +30,8 @@ define( function( require ) {
}
};

SimLauncher.launch( function() {
var sim = new Sim( fractionsMixedNumbersTitleString, [
SimLauncher.launch( () => {
const sim = new Sim( fractionsMixedNumbersTitleString, [
new IntroScreen(),
new GameScreen(),
new LabScreen()
Expand Down
4 changes: 2 additions & 2 deletions js/fractionsMixedNumbers.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
*
* @author Jonathan Olson <[email protected]>
*/
define( function( require ) {
define( require => {
'use strict';

// modules
var Namespace = require( 'PHET_CORE/Namespace' );
const Namespace = require( 'PHET_CORE/Namespace' );

return new Namespace( 'fractionsMixedNumbers' );
} );
50 changes: 22 additions & 28 deletions js/view/GameScreen.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
// Copyright 2018, University of Colorado Boulder

/**
* TODO: doc
* Game screen for Fractions: Mixed Numbers
*
* @author Jonathan Olson <[email protected]>
*/
define( function( require ) {
define( require => {
'use strict';

// modules
var BuildingGameModel = require( 'FRACTIONS_COMMON/game/model/BuildingGameModel' );
var BuildingGameScreenView = require( 'FRACTIONS_COMMON/game/view/BuildingGameScreenView' );
var FractionsCommonColorProfile = require( 'FRACTIONS_COMMON/common/view/FractionsCommonColorProfile' );
var fractionsMixedNumbers = require( 'FRACTIONS_MIXED_NUMBERS/fractionsMixedNumbers' );
var inherit = require( 'PHET_CORE/inherit' );
var Screen = require( 'JOIST/Screen' );
const BuildingGameModel = require( 'FRACTIONS_COMMON/game/model/BuildingGameModel' );
const BuildingGameScreenView = require( 'FRACTIONS_COMMON/game/view/BuildingGameScreenView' );
const FractionsCommonColorProfile = require( 'FRACTIONS_COMMON/common/view/FractionsCommonColorProfile' );
const fractionsMixedNumbers = require( 'FRACTIONS_MIXED_NUMBERS/fractionsMixedNumbers' );
const Screen = require( 'JOIST/Screen' );

// strings
var screenGameString = require( 'string!FRACTIONS_MIXED_NUMBERS/screen.game' );

/**
* @constructor
*/
function GameScreen() {

var options = {
name: screenGameString,
backgroundColorProperty: FractionsCommonColorProfile.otherScreenBackgroundProperty
};

Screen.call( this,
function() { return new BuildingGameModel( true ); },
function( model ) { return new BuildingGameScreenView( model ); },
options
);
const screenGameString = require( 'string!FRACTIONS_MIXED_NUMBERS/screen.game' );

class GameScreen extends Screen {
constructor() {
super(
() => new BuildingGameModel( true ),
model => new BuildingGameScreenView( model ),
{
name: screenGameString,
backgroundColorProperty: FractionsCommonColorProfile.otherScreenBackgroundProperty,
homeScreenIcon: BuildingGameScreenView.createMixedScreenIcon()
}
);
}
}

fractionsMixedNumbers.register( 'GameScreen', GameScreen );

return inherit( Screen, GameScreen );
return fractionsMixedNumbers.register( 'GameScreen', GameScreen );
} );
51 changes: 23 additions & 28 deletions js/view/IntroScreen.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,37 @@
// Copyright 2018, University of Colorado Boulder

/**
* TODO: doc
* Intro screen for Fractions: Mixed Numbers
*
* @author Jonathan Olson <[email protected]>
*/
define( function( require ) {
define( require => {
'use strict';

// modules
var FractionsCommonColorProfile = require( 'FRACTIONS_COMMON/common/view/FractionsCommonColorProfile' );
var fractionsMixedNumbers = require( 'FRACTIONS_MIXED_NUMBERS/fractionsMixedNumbers' );
var inherit = require( 'PHET_CORE/inherit' );
var IntroModel = require( 'FRACTIONS_COMMON/intro/model/IntroModel' );
var IntroScreenView = require( 'FRACTIONS_COMMON/intro/view/IntroScreenView' );
var Screen = require( 'JOIST/Screen' );
const FractionsCommonColorProfile = require( 'FRACTIONS_COMMON/common/view/FractionsCommonColorProfile' );
const fractionsMixedNumbers = require( 'FRACTIONS_MIXED_NUMBERS/fractionsMixedNumbers' );
const IntroModel = require( 'FRACTIONS_COMMON/intro/model/IntroModel' );
const IntroScreenView = require( 'FRACTIONS_COMMON/intro/view/IntroScreenView' );
const Screen = require( 'JOIST/Screen' );

// strings
var screenIntroString = require( 'string!FRACTIONS_MIXED_NUMBERS/screen.intro' );

/**
* @constructor
*/
function IntroScreen() {

var options = {
name: screenIntroString,
backgroundColorProperty: FractionsCommonColorProfile.introScreenBackgroundProperty
};

Screen.call( this,
function() { return new IntroModel( true ); },
function( model ) { return new IntroScreenView( model ); },
options
);
const screenIntroString = require( 'string!FRACTIONS_MIXED_NUMBERS/screen.intro' );

class IntroScreen extends Screen {
constructor() {
super(
() => new IntroModel( true ),
model => new IntroScreenView( model ),
{
name: screenIntroString,
backgroundColorProperty: FractionsCommonColorProfile.introScreenBackgroundProperty,
homeScreenIcon: IntroScreenView.createMixedScreenIcon(),
navigationBarIcon: IntroScreenView.createMixedScreenThumbnail()
}
);
}
}

fractionsMixedNumbers.register( 'IntroScreen', IntroScreen );

return inherit( Screen, IntroScreen );
return fractionsMixedNumbers.register( 'IntroScreen', IntroScreen );
} );
50 changes: 22 additions & 28 deletions js/view/LabScreen.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
// Copyright 2018, University of Colorado Boulder

/**
* TODO: doc
* Lab screen for Fractions: Mixed Numbers
*
* @author Jonathan Olson <[email protected]>
*/
define( function( require ) {
define( require => {
'use strict';

// modules
var BuildingLabModel = require( 'FRACTIONS_COMMON/lab/model/BuildingLabModel' );
var BuildingLabScreenView = require( 'FRACTIONS_COMMON/lab/view/BuildingLabScreenView' );
var FractionsCommonColorProfile = require( 'FRACTIONS_COMMON/common/view/FractionsCommonColorProfile' );
var fractionsMixedNumbers = require( 'FRACTIONS_MIXED_NUMBERS/fractionsMixedNumbers' );
var inherit = require( 'PHET_CORE/inherit' );
var Screen = require( 'JOIST/Screen' );
const BuildingLabModel = require( 'FRACTIONS_COMMON/lab/model/BuildingLabModel' );
const BuildingLabScreenView = require( 'FRACTIONS_COMMON/lab/view/BuildingLabScreenView' );
const FractionsCommonColorProfile = require( 'FRACTIONS_COMMON/common/view/FractionsCommonColorProfile' );
const fractionsMixedNumbers = require( 'FRACTIONS_MIXED_NUMBERS/fractionsMixedNumbers' );
const Screen = require( 'JOIST/Screen' );

// strings
var screenLabString = require( 'string!FRACTIONS_MIXED_NUMBERS/screen.lab' );

/**
* @constructor
*/
function LabScreen() {

var options = {
name: screenLabString,
backgroundColorProperty: FractionsCommonColorProfile.otherScreenBackgroundProperty
};

Screen.call( this,
function() { return new BuildingLabModel( true ); },
function( model ) { return new BuildingLabScreenView( model ); },
options
);
const screenLabString = require( 'string!FRACTIONS_MIXED_NUMBERS/screen.lab' );

class LabScreen extends Screen {
constructor() {
super(
() => new BuildingLabModel( true ),
model => new BuildingLabScreenView( model ),
{
name: screenLabString,
backgroundColorProperty: FractionsCommonColorProfile.otherScreenBackgroundProperty,
homeScreenIcon: BuildingLabScreenView.createMixedScreenIcon()
}
);
}
}

fractionsMixedNumbers.register( 'LabScreen', LabScreen );

return inherit( Screen, LabScreen );
return fractionsMixedNumbers.register( 'LabScreen', LabScreen );
} );

0 comments on commit 1712dce

Please sign in to comment.