void EngineJoinRoom(object sender, JoinRoomEventArgs e) { var joinRoomEvent = e.Event; if (RoomManager == null) return; var room = RoomManager.FindById(joinRoomEvent.RoomId); if (room == null) { room = new ClientRoom(joinRoomEvent.RoomId) { Name = joinRoomEvent.RoomName }; RoomManager.AddRoom(room); } room.Description = joinRoomEvent.RoomDescription; room.IsProtected = joinRoomEvent.Protected; room.Capacity = joinRoomEvent.Capacity; room.IsHidden = joinRoomEvent.Hidden; //foreach (SharedObject roomVariable in joinRoomEvent.RoomVariables) //{ // room.AddRoomVariable(roomVariable.Name, roomVariable); //} foreach (var userListEntry in joinRoomEvent.Users) { var u = UserManager.AddUser(UserListEntryToUser(userListEntry)); room.AddUser(u); } if (UserManager != null) UserManager.Me.Room = room; }
protected virtual void OnJoinRoomEvent(JoinRoomEventArgs args) { var func = JoinRoom; if (func != null) { func(this, args); } }
void EngineJoinRoom(JoinRoomEventArgs e = null) { if (e == null) throw new ArgumentNullException("e"); var room = _engine.Managers.RoomManager.FindById(e.Event.RoomId); Console.WriteLine("You have entered {0}.", room.Name); Console.WriteLine("Users:"); foreach (var user in room.Users) { Console.WriteLine("{1}{0}", user.UserName, user.IsMe ? "*" : ""); } }