Here it is...

This commit is contained in:
Thomas FORGIONE
2015-08-04 18:59:24 +02:00
parent 04a85123f5
commit 3a91a33d74
11 changed files with 352 additions and 138 deletions

View File

@@ -582,6 +582,8 @@ L3D.PointerCamera.prototype.onKeyEvent = function(event, toSet) {
// Log any change
var e = new L3D.DB.Event.KeyboardEvent();
e.camera = this;
e.keypressed = toSet;
e.keycode = event.keyCode;
e.send();
}
};
@@ -667,6 +669,8 @@ L3D.PointerCamera.prototype.onMouseUp = function(event) {
if (this.dragging && this.mouseMoved && !this.moving && !this.movingHermite) {
var e = new L3D.DB.Event.KeyboardEvent();
e.camera = this;
e.keypressed = false;
e.keycode = -1;
e.send();
}

View File

@@ -219,9 +219,17 @@ L3D.generateCoins = function(totalCoins, coin_ids) {
var i = 0;
if (coin_ids === undefined)
L3D.shuffle(totalCoins);
else if (coin_ids === null) {
if (coin_ids === undefined) {
var tmp = [];
// Use global variable coinsId
for (i = 0; i < totalCoins.length; i++) {
tmp.push(totalCoins[i]);
}
totalCoins.length = 0;
for (var i = 0; i < 8; i++) {
totalCoins.push(tmp[coinsId[i]]);
}
} else if (coin_ids === null) {
return [];
} else {
@@ -247,7 +255,9 @@ L3D.generateCoins = function(totalCoins, coin_ids) {
var bound = (coin_ids instanceof Array && coin_ids.length === 0) ? totalCoins.length : 8;
console.log(totalCoins);
for (i = 0; i < bound; i++) {
console.log(i + '/' + totalCoins.length);
coins.push(totalCoins[i].coin);
totalCoins[i].coin.id = totalCoins[i].id;
indices.push(totalCoins[i].id);

View File

@@ -158,7 +158,9 @@ L3D.DB.Event.KeyboardEvent.prototype.send = function() {
var url = "/posts/keyboard-event";
var data = {
camera: L3D.DB.Private.compactCamera(this.camera)
camera: L3D.DB.Private.compactCamera(this.camera),
keycode: this.keycode, // -1 represents mouse event
keypressed: this.keypressed // mousepressed if keycode === -1
};
L3D.DB.Private.sendData(url, data);