added Factory

This commit is contained in:
Jeena Paradies 2012-07-21 00:50:45 +02:00
parent fe7205648d
commit 043f2dbfda
2 changed files with 4 additions and 5 deletions

View file

@ -1,8 +1,6 @@
define(["Chuck/ServerGame", "Server/Factory"], function(ServerGame, Factory) { define(["Chuck/ServerGame"], function(ServerGame) {
function Channel(name) { function Channel(name) {
this.factory = new Factory();
this.name = name; this.name = name;
this.users = {}; this.users = {};
this.serverGame = this.factory.new(ServerGame, this); this.serverGame = this.factory.new(ServerGame, this);

View file

@ -1,4 +1,4 @@
define(["Server/User", "Server/Channel"], function(User, Channel) { define(["Server/User", "Server/Channel", "Server/Factory"], function(User, Channel, Factory) {
function Coordinator() { function Coordinator() {
this.channels = {}; this.channels = {};
@ -30,7 +30,8 @@ define(["Server/User", "Server/Channel"], function(User, Channel) {
var channel = this.channels[channelName]; var channel = this.channels[channelName];
if(!channel) { if(!channel) {
channel = new Channel(channelName); var factory = new Factory();
channel = factory.new(Channel, channelName);
this.channels[channelName] = channel; this.channels[channelName] = channel;
} }