Skip to content

Commit

Permalink
Move descriptor information to CharacterSet base class, see: #347
Browse files Browse the repository at this point in the history
  • Loading branch information
marlitas committed Nov 30, 2022
1 parent 9189d3e commit 91560d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
31 changes: 7 additions & 24 deletions js/common/view/SkaterImages.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ class SkaterImageSet {
* from preferences.
*/
class SkaterCharacterSet extends CharacterSet {
constructor( imageSet1, imageSet2, imageSet3, imageSet4, imageSet5, imageSet6, imageSet7, imageSet8 ) {
super();
constructor( labelString, imageSet1, imageSet2, imageSet3, imageSet4, imageSet5, imageSet6, imageSet7, imageSet8 ) {
const headshotIcon = new HeadshotIcon( imageSet1.headshotImage );

super( headshotIcon, labelString );
this.imageSet1 = imageSet1;
this.imageSet2 = imageSet2;
this.imageSet3 = imageSet3;
Expand All @@ -96,12 +98,11 @@ class SkaterCharacterSet extends CharacterSet {
this.imageSet6 = imageSet6;
this.imageSet7 = imageSet7;
this.imageSet8 = imageSet8;

this.imageSets = [ imageSet1, imageSet2, imageSet3, imageSet4, imageSet5, imageSet6, imageSet7, imageSet8 ];
}
}

const CHARACTER_SET_1 = new SkaterCharacterSet(
unitedStatesOfAmericaString,
new SkaterImageSet( skater1_set1_left_png, skater1_set1_right_png, skater1_set1_headshot_png ),
new SkaterImageSet( skater2_set1_left_png, skater2_set1_right_png, skater2_set1_headshot_png ),
new SkaterImageSet( skater3_set1_left_png, skater3_set1_right_png, skater3_set1_headshot_png ),
Expand All @@ -113,6 +114,7 @@ const CHARACTER_SET_1 = new SkaterCharacterSet(
);

const CHARACTER_SET_2 = new SkaterCharacterSet(
africaString,
new SkaterImageSet( skater1_set2_left_png, skater1_set2_right_png, skater1_set2_headshot_png ),
new SkaterImageSet( skater2_set2_left_png, skater2_set2_right_png, skater2_set2_headshot_png ),
new SkaterImageSet( skater3_set2_left_png, skater3_set2_right_png, skater3_set2_headshot_png ),
Expand All @@ -124,6 +126,7 @@ const CHARACTER_SET_2 = new SkaterCharacterSet(
);

const CHARACTER_SET_3 = new SkaterCharacterSet(
africaConservativeString,
new SkaterImageSet( skater1_set2_left_png, skater1_set2_right_png, skater1_set2_headshot_png ),
new SkaterImageSet( skater2_set2_left_png, skater2_set2_right_png, skater2_set2_headshot_png ),
new SkaterImageSet( skater3_set2_left_png, skater3_set2_right_png, skater3_set2_headshot_png ),
Expand All @@ -145,26 +148,6 @@ const SkaterImages = {
CHARACTER_SET_2: CHARACTER_SET_2,
CHARACTER_SET_3: CHARACTER_SET_3,

SKATER_SET_DESCRIPTORS: [
{
icon: new HeadshotIcon( CHARACTER_SET_1.imageSet1.headshotImage ),
label: unitedStatesOfAmericaString,
characterSet: CHARACTER_SET_1
},
{
icon: new HeadshotIcon( CHARACTER_SET_2.imageSet1.headshotImage ),
label: africaString,
characterSet: CHARACTER_SET_2
},
{
icon: new HeadshotIcon( CHARACTER_SET_3.imageSet1.headshotImage ),
label: africaConservativeString,
characterSet: CHARACTER_SET_3


}
],

IMAGES_PER_SET: 8
};

Expand Down
2 changes: 1 addition & 1 deletion js/energy-skate-park-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ simLauncher.launch( () => {
} ]
},
localizationOptions: {
regionAndCultureDescriptors: SkaterImages.SKATER_SET_DESCRIPTORS
characterSets: SkaterImages.SKATER_CHARACTER_SETS
}
} ),
credits: {
Expand Down

0 comments on commit 91560d0

Please sign in to comment.