Esempio n. 1
0
        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;
        }
Esempio n. 2
0
 public void AddRoom(ClientRoom room)
 {
     Monitor.Enter(this);
     try
     {
         _roomList.Add(room);
     }
     finally
     {
         Monitor.Exit(this);
     }
 }