How to remove virtual player

0 votes
I am adding vitrual player in this way '
 
                IUser user = new VirtualUser("0-0", (Room) this.gameRoom, (Zone) this.izone);
               Player newUser = new Player(user, 0, 0, 0, 0, new ArrayList<Integer>(), new ArrayList<ArrayList<String>>());
               newUser.setReadyToPlay(true);  
 
and player remove code in this way
 
 List<IUser> vUser = new ArrayList<IUser>();
vUser = gameRoom.getJoinedUsers();
LOGGER.info("Size  {}", vUser.size());
for (int i = 0; i < vUser.size(); i++) {
vUser.get(i).getName();
LOGGER.info("User {}", vUser.get(i).getName());
 
i am getting vUser size 1 and not get virtual player. So how can remove it 
i am getting only whoes player which is join throw my application 
please solve this issue

 

asked May 6, 2015 in App42 Cloud API-BaaS by deepakjain.mobifly (10 points)

1 Answer

0 votes
Hi,

You need to perform an additional step while adding virtual user, which is as follows:
   gameRoom.addUser(virtualUser);
i.e. write an extra statement for adding player into the room. Then you will get virtual user in joined users list.

You can also save the reference for virtual user during its creation, and then use it to remove it from room later. This can save you from iterating all users.

Thanks
answered May 6, 2015 by Suyash Mohan (900 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...