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
        protected virtual void OnJoinRoomEvent(JoinRoomEventArgs args)
        {
            var func = JoinRoom;

            if (func != null)
            {
                func(this, args);
            }
        }
Esempio n. 3
0
        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 ? "*" : "");
            }
        }
Esempio n. 4
0
 protected virtual void OnJoinRoomEvent(JoinRoomEventArgs args)
 {
     var func = JoinRoom;
     if (func != null)
     {
         func(this, args);
     }
 }