merged from master (use strict)

This commit is contained in:
logsol 2014-12-22 02:00:40 +01:00
commit 1f8f0ef6e1
76 changed files with 157 additions and 60 deletions

View file

@ -2,6 +2,8 @@ define([
],
function () {
"use strict";
function AudioPlayer(path) {
this.audio = new Audio(path);

View file

@ -4,6 +4,8 @@ define([
function (Parent) {
"use strict";
function Detector () {
Parent.call(this);
}

View file

@ -4,6 +4,8 @@ define([
],
function (Parent, Settings) {
"use strict";
function GamepadInput(playerController) {
this.playerController = playerController;

View file

@ -1,55 +0,0 @@
define([
"Game/Client/Control/Key"
],
function (Key) {
function KeyboardInput () {
this._registry = {};
this.init();
}
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) {
var key = new Key();
if(onKeyDown) key.setKeyDownFunction(onKeyDown);
if(onKeyUp) key.setKeyUpFunction(onKeyUp);
this._registry[keyCode] = key;
}
KeyboardInput.prototype._getKeyByKeyCode = function (keyCode) {
return this._registry[keyCode];
}
KeyboardInput.prototype._onKeyDown = function (e) {
var key = this._getKeyByKeyCode(e.keyCode);
if (key && !key.getActive()) {
var callback = key.getKeyDownFunction();
if(callback) callback();
key.setActive(true);
}
// Prevent tab from changing focus
if(e.keyCode == 9) return false;
}
KeyboardInput.prototype._onKeyUp = function (e) {
var key = this._getKeyByKeyCode(e.keyCode);
if (key && key.getActive()) {
var callback = key.getKeyUpFunction();
if(callback) callback();
key.setActive(false);
}
// Prevent tab from changing focus
if(e.keyCode == 9) return false;
}
return KeyboardInput;
});

View file

@ -7,6 +7,8 @@ define([
function (Parent, Nc, KeyboardAndMouse, Gamepad) {
"use strict";
function PlayerController (me) {
Parent.call(this, me);

View file

@ -17,6 +17,8 @@ define([
function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Nc, requestAnimFrame, Settings, GameObject, Doll, DomController, ProtocolHelper, Me, AudioPlayer) {
"use strict";
if (!window.cancelAnimationFrame) {
window.cancelAnimationFrame = function(id) {
clearTimeout(id);

View file

@ -8,6 +8,8 @@ define([
],
function (Parent, Settings, Nc, Exception, ColorConverter, Layer) {
"use strict";
function Doll(physicsEngine, uid, player) {
this.layerId = Layer.ID.SPAWN;

View file

@ -5,6 +5,8 @@ define([
],
function (Parent, Exception, Nc) {
"use strict";
function GameObject(physicsEngine, uid) {
Parent.call(this, physicsEngine, uid);

View file

@ -6,6 +6,8 @@ define([
],
function (Parent, Settings, Nc, Layer) {
"use strict";
function Item(physicsEngine, uid, options) {
this.layerId = Layer.ID.ITEM;

View file

@ -7,6 +7,8 @@ define([
],
function (Parent, CoreItem, Settings, Nc, Layer) {
"use strict";
function RagDoll(physicsEngine, uid, options) {
this.layerId = Layer.ID.SPAWN;

View file

@ -3,6 +3,8 @@ define([
],
function (Parent) {
"use strict";
function Rube(physicsEngine, uid, options) {
Parent.call(this, physicsEngine, uid, options);

View file

@ -3,6 +3,8 @@ define([
],
function (Parent) {
"use strict";
function SpectatorDoll(physicsEngine, uid) {
Parent.call(this, physicsEngine, uid);

View file

@ -6,6 +6,8 @@ define([
],
function (Parent, Settings, Nc, Layer) {
"use strict";
function Tile(physicsEngine, uid, options) {
this.layerId = Layer.ID.TILE;

View file

@ -8,6 +8,8 @@ define([
function (Parent, Settings, Nc, PIXI, AbstractLayer) {
"use strict";
function Level (uid, engine, gameObjects) {
Parent.call(this, uid, engine, gameObjects);
}

View file

@ -5,6 +5,8 @@ define([
],
function (Parent, Settings, Nc) {
"use strict";
function TiledLevel(uid, engine, gameObjects) {
this.layerId = "background";

View file

@ -5,6 +5,8 @@ define([
],
function (Parent, Settings, Nc) {
"use strict";
function Me(id, physicsEngine, user) {
Parent.call(this, id, physicsEngine, user);

View file

@ -9,6 +9,8 @@ define([
function (ProtocolHelper, GameController, User, Nc, Settings, DomController) {
"use strict";
function Networker (socketLink, channelName, nickname) {
this.channelName = channelName;
this.nickname = nickname;

View file

@ -8,6 +8,8 @@ define([
function (Parent, Settings, DomController, Box2D, Nc) {
"use strict";
function Engine () {
Parent.call(this);

View file

@ -5,6 +5,8 @@ define([
],
function (Parent, Nc, Settings) {
"use strict";
function Player(id, physicsEngine, user) {
Parent.call(this, id, physicsEngine, user);

View file

@ -4,6 +4,8 @@ define([
function (Abstract) {
"use strict";
function Layer(name, parallaxSpeed) {
this.name = name;
this.parallaxSpeed = parallaxSpeed;

View file

@ -7,6 +7,8 @@ define([
],
function (Abstract, DomController, Settings, Exception, Nc) {
"use strict";
function AbstractView () {
this.me = null;

View file

@ -7,6 +7,8 @@ define([
function (Settings, Nc, Stats, Screenfull) {
"use strict";
function DomController() {
this.canvas = document.getElementById("canvas");
this.debugCanvas = null;

View file

@ -5,6 +5,8 @@ define([
],
function (Nc, Exception, Layer) {
"use strict";
function LayerManager(container, me) {
this.layers = [];

View file

@ -7,6 +7,8 @@ define([
function (Settings, Nc, Stats, Screenfull) {
"use strict";
function Mesh() {
}

View file

@ -4,6 +4,8 @@ define([
function (PIXI) {
"use strict";
var Parent = PIXI.AbstractFilter;
function ColorRangeReplaceFilter() {

View file

@ -6,6 +6,8 @@ define([
],
function (PIXI, Nc, Settings, ColorConverter) {
"use strict";
function GameStats(container) {

View file

@ -7,6 +7,8 @@ define([
function (Parent, PIXI, ColorRangeReplaceFilter, Settings) {
"use strict";
var AVAILABLE_MESH_FILTERS = {
"blur": PIXI.BlurFilter,
"desaturate": PIXI.GrayFilter,

View file

@ -6,6 +6,8 @@ define([
],
function (Parent, PIXI, Nc, Settings) {
"use strict";
function Ghost() {
Parent.call(this, "ghost", 0);

View file

@ -13,6 +13,8 @@ define([
function (Parent, DomController, PIXI, Settings, Nc, Exception, GameStats, LayerManager, Ghost, Swiper) {
"use strict";
function PixiView () {
Parent.call(this);

View file

@ -6,6 +6,8 @@ define([
],
function (Parent, DomController, Three, Settings) {
"use strict";
function ThreeView () {
Parent.call(this);

View file

@ -8,6 +8,8 @@ define([
],
function (Settings, Exception, AbstractView, PixiView, Nc) {
"use strict";
var ViewManager = {};