so others may contribute
This commit is contained in:
20
code/game_status.js
Normal file
20
code/game_status.js
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
// GAME STATUS ///////////////////////////////////////////////////////
|
||||
// MindUnit display
|
||||
window.updateGameScore = function(data) {
|
||||
if(!data) {
|
||||
window.postAjax('getGameScore', {}, window.updateGameScore);
|
||||
return;
|
||||
}
|
||||
|
||||
var r = parseInt(data.result.resistanceScore), e = parseInt(data.result.alienScore);
|
||||
var s = r+e;
|
||||
var rp = r/s*100, ep = e/s*100;
|
||||
r = digits(r), e = digits(e);
|
||||
var rs = '<span class="res" style="width:'+rp+'%;">'+Math.round(rp)+'% </span>';
|
||||
var es = '<span class="enl" style="width:'+ep+'%;"> '+Math.round(ep)+'%</span>';
|
||||
$('#gamestat').html(rs+es).one('click', function() { window.updateGameScore() });
|
||||
$('#gamestat').attr('title', 'Resistance:\t\t'+r+' MindUnits\nEnlightenment:\t'+e+' MindUnits');
|
||||
|
||||
window.setTimeout('window.updateGameScore', REFRESH_GAME_SCORE*1000);
|
||||
}
|
Reference in New Issue
Block a user