Example #1
0
 public void RequestMusicStatus(int roomId, int userId)
 {
     if (musicCache.ContainsKey(roomId))
     {
         UserNCallback callBack = userCache[roomId][musicCache[roomId].PlayerId];
         if (callBack != null)
         {
             callBack.Callback.ReportMusicStatus(roomId, userId);
         }
     }
 }
Example #2
0
 public void UpadateMusicStatus(int roomId, int userId, MusicStatus status, int targetUserId)
 {
     if (musicCache.ContainsKey(roomId))
     {
         if (musicCache[roomId].PlayerId == userId)
         {
             musicCache[roomId] = status;
         }
         UserNCallback callBack = userCache[roomId][targetUserId];
         if (callBack != null)
         {
             callBack.Callback.UpdateMusicStatus(roomId, status);
         }
     }
 }
Example #3
0
 public bool EnterRoom(int roomId, User user)
 {
     if (userCache.ContainsKey(roomId))
     {
         var info = client.GetUserInfo(user.Id);
         OperationContext.Current.Channel.Faulted += Channel_Faulted;
         this.unc = new UserNCallback {
             User = user, RoomId = roomId, Callback = OperationContext.Current.GetCallbackChannel <IRoomServiceCallback>(), UserInfo = info
         };
         userCache[roomId][user.Id] = unc;
         BroadCast(roomId, (u) => u.Callback.UserEnteredRoom(roomId, unc.User), user.Id);
         return(true);
     }
     return(false);
 }
Example #4
0
        public bool EnterRoom(int roomId, User user)
        {
            if (userCache.ContainsKey(roomId))
            {
				var info = client.GetUserInfo(user.Id);
                OperationContext.Current.Channel.Faulted += Channel_Faulted;
                this.unc = new UserNCallback { User = user, RoomId = roomId, Callback = OperationContext.Current.GetCallbackChannel<IRoomServiceCallback>(), UserInfo = info };
				userCache[roomId][user.Id] = unc;
                BroadCast(roomId, (u) => u.Callback.UserEnteredRoom(roomId, unc.User),user.Id);
                return true;
            }
            return false;
        }