-
-
Save anonymous/8e4c540521e8117823b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User | |
constructor: (@username, @rank, @roll, @hero, @steamurl, @socket) -> | |
class Room | |
constructor: (owner) -> | |
@occupants = [] | |
sendMsg: (msg, user) -> | |
for client in @occupants | |
io.sockets.socket(client.socket).emit 'updateChat', 'user': user, 'msg': msg | |
checkDoubles: (user) -> | |
returnVal = false | |
for client in @occupants | |
if client.username is user | |
returnVal = true | |
returnVal | |
leaveRoom: (user) -> | |
@occupants.forEach (client, index, arr) -> | |
if client.username is user | |
arr.splice index, 1 | |
getUsers: () -> | |
returnOccupants = [] | |
@occupants.forEach (client, index, arr) -> | |
returnOccupants.push client.username | |
returnOccupants |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment