- server.zip
- Local.testsettings
- packages
- Fleck.0.8.2.1
- Fleck.0.8.2.1.nupkg
- lib
- net40
- Fleck.dll
- HttpClient.0.6.0
- HttpClient.0.6.0.nupkg
- lib
- 40
- JsonValue.0.6.0
- JsonValue.0.6.0.nupkg
- lib
- 40
- Newtonsoft.Json.4.0.5
- repositories.config
- SpaceShooterServer.sln
- SpaceShooterServer.vsmdi
- SpaceShooterServer
- Test
- bin
- Debug
- Release
- Fleck.dll
- Microsoft.Json.dll
- Microsoft.Json.xml
- Microsoft.Server.Common.dll
- SpaceShooterServer.exe
- Test.dll
- Local.testsettings
- obj
- Debug
- TempPE
- Release
- TempPE
- packages.config
- Properties
- SpaceShooterServer.vsmdi
- Test.csproj
- Test.csproj.user
- TraceAndTestImpact.testsettings
- UnitTests.cs
- TraceAndTestImpact.testsettings
- client.zip
|
score.show = function() {
var ss = document.getElementById('scorescreen');
score.isShown = ss.style.display !== 'block' || game.isDead;
if(score.isShown)
ss.style.display = 'block';
else
ss.style.display = 'none';
};
score.init = function() {
var s = JSON.parse(localStorage.getItem('highscores'));
if(s) score.scores = s;
};
score.update = function() {
var dd = new Date();
var pts = myship.points;
if(pts > score.high().points)
dialog.open('New High Score!', 'Congratulations, you did it! Your new personal high score is now at ' + pts + ' points.');
score.scores.push({ date : dd, points : pts, level: game.level, player : settings.playerName });
localStorage.setItem('highscores', JSON.stringify(score.scores));
};
score.high = function() {
var max = 0, maxItem = { points : 0, player : '', date : 0, level : 0 };
var s = score.scores;
for(var i = s.length; i--; ) {
if(s[i].points > max) {
max = s[i].points;
maxItem = s[i];
}
}
return maxItem;
};
var statistic = function() {
if(score.isShown || game.isDead) {
var details = [];
if(game.multiplayer) {
var ranking = [];
for(var i = 0; i < ships.length; i++)
ranking.push({ color : ships[i].primaryColor, name : ships[i].name, points : ships[i].points });
for(var i = 0; i < ranking.length; i++) {
for(var j = i + 1; j < ranking.length; j++) {
if(ranking[j].points > ranking[i].points) {
var t = ranking[j];
ranking[j] = ranking[i];
ranking[i] = t;
}
}
details.push('<span class="level" style="color:rgb(' + ranking[i].color + ')">' + ranking[i].name + '</span> with <span class="">' + ranking[i].points + '</span> pts');
}
} else {
var ship = myship;
var high = score.high();
details.push(
'<span class="level">' + game.level + '</span> current level',
'<span class="number">' + ship.shotAsteroids + '</span> asteroids shot',
'<span class="number">' + ship.hitAsteroids + '</span> asteroids hit',
'<span class="number">' + ship.hitByAsteroid + '</span> hits by asteroids',
'<span class="number">' + ship.shotDrones + '</span> drones shot',
'<span class="number">' + ship.hitDrones + '</span> drones hit',
'<span class="number">' + ship.hitByDrone + '</span> hits by drones',
'<span class="points">' + ship.points + '</span> points in total',
'<span class="highscore">' + high.points + '</span> highscore ( level <span class="highscore">' + high.level + '</span> )');
}
document.getElementById('scores').innerHTML = '<li>' + details.join('</li><li>') + '</li>';
}
};
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Florian lives in Munich, Germany. He started his programming career with Perl. After programming C/C++ for some years he discovered his favorite programming language C#. He did work at Siemens as a programmer until he decided to study Physics.
During his studies he worked as an IT consultant for various companies. After graduating with a PhD in theoretical particle Physics he is working as a senior technical consultant in the field of home automation and IoT.
Florian has been giving lectures in C#, HTML5 with CSS3 and JavaScript, software design, and other topics. He is regularly giving talks at user groups, conferences, and companies. He is actively contributing to open-source projects. Florian is the maintainer of AngleSharp, a completely managed browser engine.