mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
implemented level load, more to do see #1
This commit is contained in:
parent
b02036a019
commit
953159e6bd
12 changed files with 333 additions and 409 deletions
|
|
@ -2,22 +2,26 @@
|
|||
"Game/Server/GameController",
|
||||
"Lib/Utilities/NotificationCenter",
|
||||
"Game/Server/User",
|
||||
"Lib/Utilities/Protocol/Helper"
|
||||
"Lib/Utilities/Protocol/Helper",
|
||||
"Lib/Utilities/Options"
|
||||
],
|
||||
|
||||
function (GameController, NotificationCenter, User, ProtocolHelper) {
|
||||
function (GameController, NotificationCenter, User, ProtocolHelper, Options) {
|
||||
|
||||
function Channel (pipeToLobby, name) {
|
||||
function Channel (pipeToLobby, name, options) {
|
||||
|
||||
var self = this;
|
||||
|
||||
this.options = options = Options.merge(options, {
|
||||
levelUids: ["dungeon"]
|
||||
});
|
||||
|
||||
this.name = name;
|
||||
this.users = {};
|
||||
|
||||
this.pipeToLobby = pipeToLobby;
|
||||
|
||||
this.gameController = new GameController(this);
|
||||
this.gameController.loadLevel("default.json");
|
||||
|
||||
NotificationCenter.on('channel/controlCommand', function (message) {
|
||||
ProtocolHelper.applyCommand(message.data, self);
|
||||
|
|
@ -41,6 +45,11 @@
|
|||
var joinedUsers = Object.keys(this.users);
|
||||
var spawnedPlayers = this.gameController.getSpawnedPlayersAndTheirPositions();
|
||||
var worldUpdate = this.gameController.getWorldUpdateObject(true);
|
||||
|
||||
var levelUid = null;
|
||||
if(this.gameController.level) {
|
||||
levelUid = this.gameController.level.uid;
|
||||
}
|
||||
|
||||
this.users[user.id] = user;
|
||||
|
||||
|
|
@ -49,8 +58,8 @@
|
|||
channelName: this.name,
|
||||
joinedUsers: joinedUsers,
|
||||
spawnedPlayers: spawnedPlayers,
|
||||
worldUpdate: worldUpdate
|
||||
|
||||
worldUpdate: worldUpdate,
|
||||
levelUid: levelUid
|
||||
};
|
||||
|
||||
NotificationCenter.trigger('user/' + user.id + "/joinSuccess", options);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue