changed function( to function (

This commit is contained in:
logsol 2012-07-28 13:38:31 +02:00
parent 26f3d22db7
commit 7e5eeb0a27
36 changed files with 209 additions and 209 deletions

View file

@ -1,4 +1,4 @@
define(function(){
define(function (){
function Key () {
this._active = false;
@ -9,51 +9,51 @@ define(function(){
this._keyFrameFunction = null;
}
Key.prototype.setActivityUpdateStatus = function(active) {
Key.prototype.setActivityUpdateStatus = function (active) {
this._activityUpdateStatus = active;
}
Key.prototype.getActivityUpdateStatus = function() {
Key.prototype.getActivityUpdateStatus = function () {
return this._activityUpdateStatus;
}
Key.prototype.setActivityUpdateNeeded = function(need) {
Key.prototype.setActivityUpdateNeeded = function (need) {
this._activityUpdateNeeded = need;
}
Key.prototype.getActivityUpdateNeeded = function() {
Key.prototype.getActivityUpdateNeeded = function () {
return this._activityUpdateNeeded;
}
Key.prototype.setActive = function(active) {
Key.prototype.setActive = function (active) {
this._active = active;
}
Key.prototype.getActive = function() {
Key.prototype.getActive = function () {
return this._active;
}
Key.prototype.setKeyDownFunction = function(f) {
Key.prototype.setKeyDownFunction = function (f) {
this._keyDownFunction = f;
}
Key.prototype.getKeyDownFunction = function() {
Key.prototype.getKeyDownFunction = function () {
return this._keyDownFunction;
}
Key.prototype.setKeyUpFunction = function(f) {
Key.prototype.setKeyUpFunction = function (f) {
this._keyUpFunction = f;
}
Key.prototype.getKeyUpFunction = function() {
Key.prototype.getKeyUpFunction = function () {
return this._keyUpFunction;
}
Key.prototype.setKeyFrameFunction = function(f) {
Key.prototype.setKeyFrameFunction = function (f) {
this._keyFrameFunction = f;
}
Key.prototype.getKeyFrameFunction = function() {
Key.prototype.getKeyFrameFunction = function () {
return this._keyFrameFunction;
}

View file

@ -1,4 +1,4 @@
define(["Game/Core/Control/InputController", "Game/Client/Control/KeyboardInput"], function(InputController, KeyboardInput){
define(["Game/Core/Control/InputController", "Game/Client/Control/KeyboardInput"], function (InputController, KeyboardInput){
function KeyboardController(me, gameController) {
@ -22,7 +22,7 @@ define(["Game/Core/Control/InputController", "Game/Client/Control/KeyboardInput"
this.init(keys);
}
KeyboardController.prototype.init = function(keys) {
KeyboardController.prototype.init = function (keys) {
this.keyboardInput.registerKey(keys.a, 'moveLeft', 'stop', 'moveLeft');
this.keyboardInput.registerKey(keys.left, 'moveLeft', 'stop', 'moveLeft');
@ -40,53 +40,53 @@ define(["Game/Core/Control/InputController", "Game/Client/Control/KeyboardInput"
this.keyboardInput.registerKey(keys.down, 'activateShift', 'activateShift', 'deactivateShift');
}
KeyboardController.prototype.moveLeft = function() {
KeyboardController.prototype.moveLeft = function () {
this.inputController.moveLeft();
this.gameController.sendGameCommand('moveLeft');
}
KeyboardController.prototype.moveRight = function() {
KeyboardController.prototype.moveRight = function () {
this.inputController.moveRight();
this.gameController.sendGameCommand('moveRight');
}
KeyboardController.prototype.stop = function() {
KeyboardController.prototype.stop = function () {
this.inputController.stop();
this.gameController.sendGameCommand('stop');
}
KeyboardController.prototype.jump = function() {
KeyboardController.prototype.jump = function () {
this.inputController.jump();
this.gameController.sendGameCommand('jump');
}
KeyboardController.prototype.jumped = function() {
KeyboardController.prototype.jumped = function () {
this.inputController.jumped();
}
KeyboardController.prototype.jumping = function() {
KeyboardController.prototype.jumping = function () {
this.inputController.jumping();
}
KeyboardController.prototype.duck = function() {
KeyboardController.prototype.duck = function () {
this.inputController.duck();
this.gameController.sendGameCommand('duck');
}
KeyboardController.prototype.standUp = function() {
KeyboardController.prototype.standUp = function () {
this.inputController.standUp();
}
KeyboardController.prototype.activateShift = function() {
KeyboardController.prototype.activateShift = function () {
this.inputController.activateShift();
this.gameController.sendGameCommand('activateShift');
}
KeyboardController.prototype.deactivateShift = function() {
KeyboardController.prototype.deactivateShift = function () {
this.inputController.deactivateShift();
}
KeyboardController.prototype.update = function() {
KeyboardController.prototype.update = function () {
this.keyboardInput.update();
}

View file

@ -1,4 +1,4 @@
define(["Game/Client/Control/Key"], function(Key){
define(["Game/Client/Control/Key"], function (Key){
function KeyboardInput (keyboardController) {
@ -8,13 +8,13 @@ define(["Game/Client/Control/Key"], function(Key){
this.init();
}
KeyboardInput.prototype.init = function() {
KeyboardInput.prototype.init = function () {
// Using window is ok here because it only runs in the browser
window.onkeydown = this._onKeyDown.bind(this);
window.onkeyup = this._onKeyUp.bind(this);
}
KeyboardInput.prototype.registerKey = function(keyCode, onKeyDown, onKeyUp, onKeyFrame) {
KeyboardInput.prototype.registerKey = function (keyCode, onKeyDown, onKeyUp, onKeyFrame) {
var key = new Key();
key.setKeyDownFunction(onKeyDown);
key.setKeyUpFunction(onKeyUp);
@ -22,11 +22,11 @@ define(["Game/Client/Control/Key"], function(Key){
this._registry[keyCode] = key;
}
KeyboardInput.prototype._getKeyByKeyCode = function(keyCode) {
KeyboardInput.prototype._getKeyByKeyCode = function (keyCode) {
return this._registry[keyCode];
}
KeyboardInput.prototype._onKeyDown = function(e) {
KeyboardInput.prototype._onKeyDown = function (e) {
var key = this._getKeyByKeyCode(e.keyCode);
if (key && key.getActive() == false) {
key.setActivityUpdateStatus(true);
@ -34,7 +34,7 @@ define(["Game/Client/Control/Key"], function(Key){
}
}
KeyboardInput.prototype._onKeyUp = function(e) {
KeyboardInput.prototype._onKeyUp = function (e) {
var key = this._getKeyByKeyCode(e.keyCode);
if (key != null) {
key.setActivityUpdateStatus(false);
@ -42,7 +42,7 @@ define(["Game/Client/Control/Key"], function(Key){
}
}
KeyboardInput.prototype.update = function() {
KeyboardInput.prototype.update = function () {
var callback = null;
var self = this;