-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add preferences model and structure for character sets. See #198.
- Loading branch information
Showing
15 changed files
with
269 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2023, University of Colorado Boulder | ||
|
||
/** | ||
* The BoxPlayerCharacterSet defines what is needed for each character set in Arithmetic. | ||
* | ||
* @author Luisa Vargas | ||
* | ||
*/ | ||
|
||
import RegionAndCulturePortrayal from '../../../../joist/js/preferences/RegionAndCulturePortrayal.js'; | ||
import arithmetic from '../../arithmetic.js'; | ||
|
||
export default class BoxPlayerCharacterSet extends RegionAndCulturePortrayal { | ||
|
||
/** | ||
* @param label { LocalizedStringProperty } | ||
* @param multiplyLevel1 { HTMLImageElement } | ||
* @param multiplyLevel2 { HTMLImageElement } | ||
* @param multiplyLevel3 { HTMLImageElement } | ||
* @param factorLevel1 { HTMLImageElement } | ||
* @param factorLevel2 { HTMLImageElement } | ||
* @param factorLevel3 { HTMLImageElement } | ||
* @param divideLevel1 { HTMLImageElement } | ||
* @param divideLevel2 { HTMLImageElement } | ||
* @param divideLevel3 { HTMLImageElement } | ||
* @param queryParameterValue { string } | ||
*/ | ||
constructor( label, | ||
multiplyLevel1, multiplyLevel2, multiplyLevel3, | ||
factorLevel1, factorLevel2, factorLevel3, | ||
divideLevel1, divideLevel2, divideLevel3, | ||
queryParameterValue ) { | ||
|
||
super( label, queryParameterValue, {} ); | ||
|
||
this.multiplyLevel1 = multiplyLevel1; | ||
this.multiplyLevel2 = multiplyLevel2; | ||
this.multiplyLevel3 = multiplyLevel3; | ||
this.factorLevel1 = factorLevel1; | ||
this.factorLevel2 = factorLevel2; | ||
this.factorLevel3 = factorLevel3; | ||
this.divideLevel1 = divideLevel1; | ||
this.divideLevel2 = divideLevel2; | ||
this.divideLevel3 = divideLevel3; | ||
} | ||
} | ||
|
||
arithmetic.register( 'BoxPlayerCharacterSet', BoxPlayerCharacterSet ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2023, University of Colorado Boulder | ||
|
||
/** | ||
* This file instantiates the USA region and culture portrayals. | ||
* | ||
* @author Luisa Vargas | ||
* | ||
*/ | ||
|
||
import JoistStrings from '../../../../joist/js/JoistStrings.js'; | ||
import { USA_REGION_AND_CULTURE_ID } from '../../../../joist/js/preferences/RegionAndCulturePortrayal.js'; | ||
import divideLevel1Icon_png from '../../../mipmaps/divideLevel1Icon_png.js'; | ||
import divideLevel2Icon_png from '../../../mipmaps/divideLevel2Icon_png.js'; | ||
import divideLevel3Icon_png from '../../../mipmaps/divideLevel3Icon_png.js'; | ||
import factorLevel1Icon_png from '../../../mipmaps/factorLevel1Icon_png.js'; | ||
import factorLevel2Icon_png from '../../../mipmaps/factorLevel2Icon_png.js'; | ||
import factorLevel3Icon_png from '../../../mipmaps/factorLevel3Icon_png.js'; | ||
import multiplyLevel1Icon_png from '../../../mipmaps/multiplyLevel1Icon_png.js'; | ||
import multiplyLevel2Icon_png from '../../../mipmaps/multiplyLevel2Icon_png.js'; | ||
import multiplyLevel3Icon_png from '../../../mipmaps/multiplyLevel3Icon_png.js'; | ||
import BoxPlayerCharacterSet from './BoxPlayerCharacterSet.js'; | ||
|
||
const ExplorerCharacterSetUSA = new BoxPlayerCharacterSet( | ||
JoistStrings.preferences.tabs.localization.regionAndCulture.portrayalSets.unitedStatesOfAmericaStringProperty, | ||
multiplyLevel1Icon_png, | ||
multiplyLevel2Icon_png, | ||
multiplyLevel3Icon_png, | ||
factorLevel1Icon_png, | ||
factorLevel2Icon_png, | ||
factorLevel3Icon_png, | ||
divideLevel1Icon_png, | ||
divideLevel2Icon_png, | ||
divideLevel3Icon_png, | ||
USA_REGION_AND_CULTURE_ID | ||
); | ||
|
||
export default ExplorerCharacterSetUSA; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
// Copyright 2023, University of Colorado Boulder | ||
|
||
/** | ||
* The BoxPlayerController creates the images of each version of the 'level' box player ( multiply level 1, | ||
* multiply level 2, multiply level 3, factor level 1, factor level 2, factor level 3, divide level 1, divide level 2, | ||
* and divide level 3), as well as defines the visibility of each individual image based on the | ||
* regionAndCulturePortrayalProperty. | ||
* | ||
* @author Luisa Vargas | ||
* | ||
*/ | ||
|
||
import DerivedProperty from '../../../../axon/js/DerivedProperty.js'; | ||
import { Image, Node } from '../../../../scenery/js/imports.js'; | ||
import arithmetic from '../../arithmetic.js'; | ||
import BoxPlayerImages from './BoxPlayerImages.js'; | ||
|
||
export default class BoxPlayerController { | ||
|
||
/** | ||
* @param { ArithmeticModel } sceneModel | ||
*/ | ||
constructor( sceneModel ) { | ||
|
||
const boxPlayerSets = BoxPlayerImages.BOX_PLAYER_CHARACTER_SETS; | ||
const regionAndCulturePortrayalProperty = sceneModel.regionAndCulturePortrayalProperty; | ||
|
||
const createVisibleProperty = set => { | ||
return new DerivedProperty( [ regionAndCulturePortrayalProperty ], portrayal => { | ||
return portrayal === set; | ||
} ); | ||
}; | ||
|
||
const multiplyLevel1Images = boxPlayerSets.map( set => new Image( set.multiplyLevel1, | ||
{ | ||
visibleProperty: createVisibleProperty( set ) | ||
} ) ); | ||
const multiplyLevel2Images = boxPlayerSets.map( set => new Image( set.multiplyLevel2, | ||
{ | ||
visibleProperty: createVisibleProperty( set ) | ||
} ) ); | ||
const multiplyLevel3Images = boxPlayerSets.map( set => new Image( set.multiplyLevel3, | ||
{ | ||
visibleProperty: createVisibleProperty( set ) | ||
} ) ); | ||
const factorLevel1Images = boxPlayerSets.map( set => new Image( set.factorLevel1, | ||
{ | ||
visibleProperty: createVisibleProperty( set ) | ||
} ) ); | ||
const factorLevel2Images = boxPlayerSets.map( set => new Image( set.factorLevel2, | ||
{ | ||
visibleProperty: createVisibleProperty( set ) | ||
} ) ); | ||
const factorLevel3Images = boxPlayerSets.map( set => new Image( set.factorLevel3, | ||
{ | ||
visibleProperty: createVisibleProperty( set ) | ||
} ) ); | ||
const divideLevel1Images = boxPlayerSets.map( set => new Image( set.divideLevel1, | ||
{ | ||
visibleProperty: createVisibleProperty( set ) | ||
} ) ); | ||
const divideLevel2Images = boxPlayerSets.map( set => new Image( set.divideLevel2, | ||
{ | ||
visibleProperty: createVisibleProperty( set ) | ||
} ) ); | ||
const divideLevel3Images = boxPlayerSets.map( set => new Image( set.divideLevel3, | ||
{ | ||
visibleProperty: createVisibleProperty( set ) | ||
} ) ); | ||
|
||
const multiplyLevel1Node = new Node( { children: multiplyLevel1Images } ); | ||
const multiplyLevel2Node = new Node( { children: multiplyLevel2Images } ); | ||
const multiplyLevel3Node = new Node( { children: multiplyLevel3Images } ); | ||
const factorLevel1Node = new Node( { children: factorLevel1Images } ); | ||
const factorLevel2Node = new Node( { children: factorLevel2Images } ); | ||
const factorLevel3Node = new Node( { children: factorLevel3Images } ); | ||
const divideLevel1Node = new Node( { children: divideLevel1Images } ); | ||
const divideLevel2Node = new Node( { children: divideLevel2Images } ); | ||
const divideLevel3Node = new Node( { children: divideLevel3Images } ); | ||
|
||
/** | ||
* @public | ||
* @type {{divide: Node[], multiply: Node[], factor: Node[]}} | ||
*/ | ||
this.boxPlayerNodes = { | ||
multiply: [ | ||
multiplyLevel1Node, | ||
multiplyLevel2Node, | ||
multiplyLevel3Node | ||
], | ||
factor: [ | ||
factorLevel1Node, | ||
factorLevel2Node, | ||
factorLevel3Node | ||
], | ||
divide: [ | ||
divideLevel1Node, | ||
divideLevel2Node, | ||
divideLevel3Node | ||
] | ||
}; | ||
} | ||
} | ||
|
||
arithmetic.register( 'BoxPlayerController', BoxPlayerController ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2023, University of Colorado Boulder | ||
/** | ||
* BoxPlayer images contains an array of character sets, each representing a different region/culture. | ||
* | ||
* @author Luisa Vargas | ||
* | ||
*/ | ||
|
||
import arithmetic from '../../arithmetic.js'; | ||
import BoxPlayerCharacterSetUSA from './BoxPlayerCharacterSetUSA.js'; | ||
|
||
|
||
const BoxPlayerImages = { | ||
BOX_PLAYER_CHARACTER_SETS: [ | ||
BoxPlayerCharacterSetUSA | ||
] | ||
}; | ||
|
||
arithmetic.register( 'BoxPlayerImages', BoxPlayerImages ); | ||
export default BoxPlayerImages; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.