Commit 057ae3e8 authored by Matthew Odle's avatar Matthew Odle

move prevous and next letters to texts

parent 91b32484
var initials = {
ignoreMarker : true,
order : ['left', 'middle', 'right', 'submit'],
order : ['left', 'middle', 'right', 'done'],
options : ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'],
letterDisplays : ['previouser', 'previous', 'next', 'nexter'],
entries : {
previouser : {
noSelection: true,
fontSize : '15px',
defaultXAdjust : 7,
xAdjust : 7,
yAdjust : -10,
color : 'darkgrey',
},
previous : {
noSelection: true,
defaultXAdjust : 5,
xAdjust : 5,
yAdjust : -10,
color : 'grey',
},
left : {
text : 'A',
fontSize : '30px',
......@@ -49,28 +34,11 @@ var initials = {
menus.display('initials');
},
},
next : {
noSelection: true,
defaultXAdjust : 5,
xAdjust : 5,
yAdjust : -50,
color : 'grey',
},
nexter : {
noSelection: true,
fontSize : '15px',
defaultXAdjust : 7,
xAdjust : 7,
yAdjust : -50,
color : 'darkgrey',
},
submit : {
text : 'Done',
done : {
text : 'DONE',
fontSize : '30px',
xAdjust : 175,
yAdjust : -125,
yAdjust : -75,
submit : function() {
leaderboard.saveScore(menus.screens.initials.getEntries(), metrics.lastScore);
menus.display('main');
......@@ -102,5 +70,30 @@ var initials = {
yAdjust : 50,
fontSize : '20px',
},
previouser : {
fontSize : '15px',
defaultXAdjust : 7,
xOverride : 0,
yAdjust : -115,
color : 'darkgrey',
},
previous : {
defaultXAdjust : 5,
xOverride : 0,
yAdjust : -115,
color : 'grey',
},
next : {
defaultXAdjust : 5,
xOverride : 0,
yAdjust : -70,
color : 'grey',
},
nexter : {
fontSize : '15px',
xOverride : 0,
yAdjust : -70,
color : 'darkgrey',
},
},
};
......@@ -48,36 +48,32 @@ menus = {
if (!this.currentSelection.entry || this.timeSinceMenuMove < this.minTimeToMove) {
return;
};
if (!this.currentSelection.entry.options) {
let initialsEntries = this.screens.initials.entries;
initialsEntries.previous.text = 'DONE';
initialsEntries.previous.xAdjust = 175;
initialsEntries.previouser.text = 'DONE';
initialsEntries.previouser.xAdjust = 175;
initialsEntries.next.text = 'DONE';
initialsEntries.next.xAdjust = 175;
initialsEntries.nexter.text = 'DONE';
initialsEntries.nexter.xAdjust = 175;
return;
};
let texts = this.screens.initials.text;
this.setTexts(texts);
this.setPositions(texts);
},
setTexts : function(texts) {
this.screens.initials.text.currentScore.text = 'your score ' + metrics.lastScore;
this.shiftListOrder(this.currentSelection.entry.options);
let order = this.currentSelection.entry.options.slice();
let initialsEntries = this.screens.initials.entries;
initialsEntries.previous.text = order.pop();
initialsEntries.previouser.text = order.pop();
initialsEntries[this.currentSelection.name].text = order.shift();
initialsEntries.next.text = order.shift();
initialsEntries.nexter.text = order.shift();
let toAdjust = this.currentSelection.entry.xAdjust;
initialsEntries.previouser.xAdjust = initialsEntries.previouser.defaultXAdjust + (toAdjust ? toAdjust : 0);
initialsEntries.previous.xAdjust = initialsEntries.previous.defaultXAdjust + (toAdjust ? toAdjust : 0);
initialsEntries.next.xAdjust = initialsEntries.next.defaultXAdjust + (toAdjust ? toAdjust : 0);
initialsEntries.nexter.xAdjust = initialsEntries.nexter.defaultXAdjust + (toAdjust ? toAdjust : 0);
this.screens.initials.letterDisplays.forEach(entry =>
texts[entry].text = 'DONE'
);
if (this.currentSelection.entry.options) {
this.shiftListOrder(this.currentSelection.entry.options);
let order = this.currentSelection.entry.options.slice();
texts.previouser.text = order[order.length - 2];
texts.previous.text = order[order.length - 1];
texts.next.text = order[1];
texts.nexter.text = order[2];
this.screens.initials.entries[this.currentSelection.name].text = order[0];
};
},
setPositions : function(texts) {
let xPosition = this.currentSelection.entry.component.x;
let yPosition = this.currentSelection.entry.component.y;
this.screens.initials.letterDisplays.forEach(entry => {
texts[entry].xOverride = xPosition;
texts[entry].yOverride = yPosition;
});
},
selectNextInitial : function() {
let list = this.screens.initials.order;
......@@ -176,8 +172,8 @@ menus = {
if (!entry.component) {
entry.component = this.buildDefaultComponent();
};
entry.component.x = menuDefaults.text.x + (entry.xAdjust ? entry.xAdjust : 0);
entry.component.y = menuDefaults.text.y + (entry.yAdjust ? entry.yAdjust : 0) + menuDefaults.yDivider * index;
entry.component.x = (entry.xOverride ? entry.xOverride : menuDefaults.text.x) + (entry.xAdjust ? entry.xAdjust : 0);
entry.component.y = (entry.yOverride ? entry.yOverride : menuDefaults.text.y) + (entry.yAdjust ? entry.yAdjust : 0) + menuDefaults.yDivider * index;
entry.component.text = entry.text ? entry.text : entry.base;
if (entry.fontSize) {
entry.component.fontSize = entry.fontSize;
......
......@@ -168,9 +168,9 @@ var menusProps = {
text : 'because laziness',
},
gamepadCount : {
text : 'Active gamepads: 0',
xAdjust : 50,
yAdjust : 50,
text : 'Active gamepads: 0',
xAdjust : 50,
yAdjust : 50,
},
player1Check : {
base : 'Player 1: ',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment