Skip to content

Commit

Permalink
stringProperties experimentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanolson committed Aug 13, 2022
1 parent f8b8160 commit 69f5f66
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
4 changes: 1 addition & 3 deletions js/compare/CompareScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import compare_screen_icon_png from '../../mipmaps/compare_screen_icon_png.js';
import density from '../density.js';
import densityStrings from '../densityStrings.js';

const screenCompareString = densityStrings.screen.compare;

export default class CompareScreen extends Screen<DensityCompareModel, DensityCompareScreenView> {
public constructor( tandem: Tandem ) {
const icon = DensityBuoyancyCommonQueryParameters.generateIconImages ? DensityBuoyancyScreenView.getDensityCompareIcon() : new Image( compare_screen_icon_png );
Expand All @@ -33,7 +31,7 @@ export default class CompareScreen extends Screen<DensityCompareModel, DensityCo
tandem: tandem.createTandem( 'view' )
} ),
{
name: screenCompareString,
name: densityStrings.screen.compareProperty,
backgroundColorProperty: DensityBuoyancyCommonColors.skyBottomProperty,
homeScreenIcon: new ScreenIcon( icon, {
maxIconWidthProportion: 1,
Expand Down
4 changes: 1 addition & 3 deletions js/density-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import CompareScreen from './compare/CompareScreen.js';
import IntroScreen from './intro/IntroScreen.js';
import MysteryScreen from './mystery/MysteryScreen.js';

const densityTitleString = densityStrings.density.title;

const simOptions: SimOptions = {
credits: {
//TODO fill in credits, all of these fields are optional, see joist.CreditsNode
Expand All @@ -36,7 +34,7 @@ const simOptions: SimOptions = {
// launch the sim - beware that scenery Image nodes created outside of simLauncher.launch() will have zero bounds
// until the images are fully loaded, see https://github.com/phetsims/coulombs-law/issues/70
simLauncher.launch( () => {
const sim = new Sim( densityTitleString, [
const sim = new Sim( densityStrings.density.titleProperty, [
new IntroScreen( Tandem.ROOT.createTandem( 'introScreen' ) ),
new CompareScreen( Tandem.ROOT.createTandem( 'compareScreen' ) ),
new MysteryScreen( Tandem.ROOT.createTandem( 'mysteryScreen' ) )
Expand Down
5 changes: 5 additions & 0 deletions js/densityStrings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@
*/
/* eslint-disable */
import getStringModule from '../../chipper/js/getStringModule.js';
import Property from '../../axon/js/Property.js';
import density from './density.js';

type StringsType = {
'density': {
'title': string;
'titleProperty': Property<string>;
};
'screen': {
'intro': string;
'introProperty': Property<string>;
'compare': string;
'compareProperty': Property<string>;
'mystery': string;
'mysteryProperty': Property<string>;
}
};

Expand Down
4 changes: 1 addition & 3 deletions js/intro/IntroScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import intro_screen_icon_png from '../../mipmaps/intro_screen_icon_png.js';
import density from '../density.js';
import densityStrings from '../densityStrings.js';

const screenIntroString = densityStrings.screen.intro;

export default class IntroScreen extends Screen<DensityIntroModel, DensityIntroScreenView> {
public constructor( tandem: Tandem ) {
const icon = DensityBuoyancyCommonQueryParameters.generateIconImages ? DensityBuoyancyScreenView.getDensityIntroIcon() : new Image( intro_screen_icon_png );
Expand All @@ -33,7 +31,7 @@ export default class IntroScreen extends Screen<DensityIntroModel, DensityIntroS
tandem: tandem.createTandem( 'view' )
} ),
{
name: screenIntroString,
name: densityStrings.screen.introProperty,
backgroundColorProperty: DensityBuoyancyCommonColors.skyBottomProperty,
homeScreenIcon: new ScreenIcon( icon, {
maxIconWidthProportion: 1,
Expand Down
4 changes: 1 addition & 3 deletions js/mystery/MysteryScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import mystery_screen_icon_png from '../../mipmaps/mystery_screen_icon_png.js';
import density from '../density.js';
import densityStrings from '../densityStrings.js';

const screenMysteryString = densityStrings.screen.mystery;

export default class MysteryScreen extends Screen<DensityMysteryModel, DensityMysteryScreenView> {
public constructor( tandem: Tandem ) {
const icon = DensityBuoyancyCommonQueryParameters.generateIconImages ? DensityBuoyancyScreenView.getDensityMysteryIcon() : new Image( mystery_screen_icon_png );
Expand All @@ -33,7 +31,7 @@ export default class MysteryScreen extends Screen<DensityMysteryModel, DensityMy
tandem: tandem.createTandem( 'view' )
} ),
{
name: screenMysteryString,
name: densityStrings.screen.mysteryProperty,
backgroundColorProperty: DensityBuoyancyCommonColors.skyBottomProperty,
homeScreenIcon: new ScreenIcon( icon, {
maxIconWidthProportion: 1,
Expand Down

1 comment on commit 69f5f66

@jonathanolson
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please sign in to comment.