mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
Added PointerLockManagement, Fixed layer positioning, added fps chart. fixes #120, fixes #121, fixes #123
This commit is contained in:
parent
8d0989844c
commit
60eae208a2
23 changed files with 458 additions and 109 deletions
|
|
@ -3,9 +3,10 @@ define([
|
|||
"Lib/Utilities/NotificationCenter",
|
||||
"Game/Client/Control/Inputs/KeyboardAndMouse",
|
||||
"Game/Client/Control/Inputs/Gamepad",
|
||||
"Game/Client/PointerLockManager"
|
||||
],
|
||||
|
||||
function (Parent, Nc, KeyboardAndMouse, Gamepad) {
|
||||
function (Parent, Nc, KeyboardAndMouse, Gamepad, PointerLockManager) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
|
@ -20,16 +21,19 @@ function (Parent, Nc, KeyboardAndMouse, Gamepad) {
|
|||
PlayerController.prototype = Object.create(Parent.prototype);
|
||||
|
||||
PlayerController.prototype.update = function() {
|
||||
|
||||
Parent.prototype.update.call(this);
|
||||
this.gamepad.update();
|
||||
};
|
||||
|
||||
PlayerController.prototype.moveLeft = function () {
|
||||
if (!PointerLockManager.isLocked()) return;
|
||||
Parent.prototype.moveLeft.call(this);
|
||||
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, 'moveLeft');
|
||||
}
|
||||
|
||||
PlayerController.prototype.moveRight = function () {
|
||||
if (!PointerLockManager.isLocked()) return;
|
||||
Parent.prototype.moveRight.call(this);
|
||||
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, 'moveRight');
|
||||
}
|
||||
|
|
@ -40,54 +44,66 @@ function (Parent, Nc, KeyboardAndMouse, Gamepad) {
|
|||
}
|
||||
|
||||
PlayerController.prototype.jump = function () {
|
||||
if (!PointerLockManager.isLocked()) return;
|
||||
Parent.prototype.jump.call(this);
|
||||
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, 'jump');
|
||||
}
|
||||
|
||||
PlayerController.prototype.jumpStop = function () {
|
||||
if (!PointerLockManager.isLocked()) return;
|
||||
Parent.prototype.jumpStop.call(this);
|
||||
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, 'jumpStop');
|
||||
}
|
||||
|
||||
PlayerController.prototype.setXY = function(x, y) {
|
||||
if (!PointerLockManager.isLocked()) return;
|
||||
var options = {x:x, y:y};
|
||||
Parent.prototype.lookAt.call(this, options);
|
||||
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, 'lookAt', options);
|
||||
};
|
||||
|
||||
PlayerController.prototype.handActionLeft = function() {
|
||||
if (!PointerLockManager.isLocked()) return;
|
||||
this.handActionRequest(-0.5, 0.5);
|
||||
};
|
||||
|
||||
PlayerController.prototype.handActionRight = function() {
|
||||
if (!PointerLockManager.isLocked()) return;
|
||||
this.handActionRequest(0.5, 0.5);
|
||||
};
|
||||
|
||||
PlayerController.prototype.suicide = function() {
|
||||
if (!PointerLockManager.isLocked()) return;
|
||||
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, "suicide");
|
||||
};
|
||||
|
||||
PlayerController.prototype.handActionRequest = function(options) {
|
||||
if (!PointerLockManager.isLocked()) return;
|
||||
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, "handActionRequest", options);
|
||||
};
|
||||
|
||||
PlayerController.prototype.showInfo = function() {
|
||||
if (!PointerLockManager.isLocked()) return;
|
||||
Nc.trigger(Nc.ns.client.game.gameStats.toggle, true);
|
||||
};
|
||||
|
||||
PlayerController.prototype.hideInfo = function() {
|
||||
if (!PointerLockManager.isLocked()) return;
|
||||
Nc.trigger(Nc.ns.client.game.gameStats.toggle, false);
|
||||
};
|
||||
|
||||
PlayerController.prototype.zoomIn = function() {
|
||||
if (!PointerLockManager.isLocked()) return;
|
||||
Nc.trigger(Nc.ns.client.game.zoomIn, true);
|
||||
};
|
||||
|
||||
PlayerController.prototype.zoomOut = function() {
|
||||
if (!PointerLockManager.isLocked()) return;
|
||||
Nc.trigger(Nc.ns.client.game.zoomOut, false);
|
||||
};
|
||||
|
||||
PlayerController.prototype.zoomReset = function() {
|
||||
if (!PointerLockManager.isLocked()) return;
|
||||
Nc.trigger(Nc.ns.client.game.zoomReset, false);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue