mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
added lab for local game engine testing (create apache vhost to chuck.js directory and open chuck.local/lab - this runs the gamecode but with an extended networker (worker) which omits all networking
This commit is contained in:
parent
b82b02d4ab
commit
966f709b09
5 changed files with 108 additions and 0 deletions
53
lab/Worker.js
Normal file
53
lab/Worker.js
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
define([
|
||||||
|
"Game/Client/Networker",
|
||||||
|
"Game/Core/Protocol/Helper",
|
||||||
|
"Game/Client/GameController",
|
||||||
|
"Game/Client/User",
|
||||||
|
"Game/Core/NotificationCenter"
|
||||||
|
],
|
||||||
|
|
||||||
|
function (Parent, ProtocolHelper, GameController, User, NotificationCenter) {
|
||||||
|
|
||||||
|
function Worker () {
|
||||||
|
//this.socketLink = socketLink;
|
||||||
|
this.gameController = null;
|
||||||
|
this.users = {};
|
||||||
|
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
Worker.prototype = Object.create(Parent.prototype);
|
||||||
|
|
||||||
|
Worker.prototype.init = function () {
|
||||||
|
|
||||||
|
|
||||||
|
ProtocolHelper.applyCommand({
|
||||||
|
"joinSuccess":{
|
||||||
|
"userId":"k31HvnDM7Jy6mfmKOe3y",
|
||||||
|
"channelName":"dungeon",
|
||||||
|
"joinedUsers":[],
|
||||||
|
"spawnedPlayers":[]
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
ProtocolHelper.applyCommand({
|
||||||
|
"gameCommand":{
|
||||||
|
"spawnPlayer":{
|
||||||
|
"id":"k31HvnDM7Jy6mfmKOe3y",
|
||||||
|
"x":150,
|
||||||
|
"y":50
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
NotificationCenter.on("sendGameCommand", this.sendGameCommand, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
Worker.prototype.sendCommand = function (command, options) {
|
||||||
|
var message = ProtocolHelper.encodeCommand(command, options);
|
||||||
|
//this.socketLink.send(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Worker;
|
||||||
|
|
||||||
|
});
|
||||||
1
lab/app
Symbolic link
1
lab/app
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../app
|
||||||
19
lab/client.js
Executable file
19
lab/client.js
Executable file
|
|
@ -0,0 +1,19 @@
|
||||||
|
requirejs.config({
|
||||||
|
baseUrl: 'app',
|
||||||
|
deps: ['Lib/Utilities/Extensions']
|
||||||
|
});
|
||||||
|
|
||||||
|
var inspector = {};
|
||||||
|
|
||||||
|
requirejs([
|
||||||
|
"Game/Config/Settings",
|
||||||
|
"Worker.js"
|
||||||
|
],
|
||||||
|
|
||||||
|
function (Settings, Worker) {
|
||||||
|
|
||||||
|
var worker = new Worker();
|
||||||
|
|
||||||
|
inspector.worker = worker;
|
||||||
|
inspector.settings = Settings;
|
||||||
|
});
|
||||||
34
lab/index.html
Executable file
34
lab/index.html
Executable file
|
|
@ -0,0 +1,34 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Chuck</title>
|
||||||
|
<style>
|
||||||
|
html, body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
display: table;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: #000;
|
||||||
|
}
|
||||||
|
#canvasContainer {
|
||||||
|
text-align: center;
|
||||||
|
display: table-cell;
|
||||||
|
vertical-align: middle;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
canvas {
|
||||||
|
background: #333;
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
|
#canvasContainer canvas:first-child {
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="canvasContainer">
|
||||||
|
</div>
|
||||||
|
<script data-main="client" src="../node_modules/requirejs/require.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1
lab/static
Symbolic link
1
lab/static
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../static
|
||||||
Loading…
Add table
Add a link
Reference in a new issue