mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
added Factory
This commit is contained in:
parent
fe7205648d
commit
043f2dbfda
2 changed files with 4 additions and 5 deletions
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue