ajweeks
0 Likes Commentsjavascript
return OptionState;
})(BasicState);
var LevelSelectState = (function (_super) {
__extends(LevelSelectState, _super);
function LevelSelectState(sm) {
_super.call(this, STATE.LEVEL_SELECT, sm);
this.height = 8;
this.numOfLevels = 64;
this.offset = 150;
this.maxOffset = -(Math.ceil(this.numOfLevels / this.height) * 250 - window.innerWidth + 150);
get('levelselectstate').style.display = "block";
var x, y, str = '', n;
for (x = 0; x < Math.ceil(this.numOfLevels / this.height); x++) {
str += '<div class="col">';
for (y = 0; y < this.height; y++) {
n = (x * this.height) + y;
var enabled = Game.defaultLevels[n] !== undefined;
str += '<div class="button lvlselect' + (enabled ? ' enabled' : '') +
(enabled ? 'onmousedown="if (clickType(event)===\'left\') Game.sm.enterState(\'game\') +
'>' + decimalToHex(n) + '</div>';
}
str += '</div>';
}
str += '<div id="backarrow" onmouseover="Game.lvlselectButtonDirection=1;" onmouseout="Game.lvlselectButtonDirection = 0;" style="visibility: hidden"><p>◀</p></div>';
str += '<div id="forwardarrow" onmouseover="Game.lvlselectButtonDirection=-1" onmouseout="Game.lvlselectButtonDirection = 0;"><p>▶</p></div>';
str += '<div class="button" onmousedown="if (clickType(event)===\'left\') Game.sm.enterPreviousState();" style="margin-left: -90px; margin-top: -490px;">Back</div>';
get('levelselectstate').style.width = 250 * Math.ceil(this.numOfLevels / this.height) + 'px';
get('levelselectstate').style.marginLeft = '150px';
get('levelselects