ExitGames::Common::JVector<int> NetworkLogic::getCurrentRoomPlayerNumbers(){
	ExitGames::Common::JVector<int> players;
	ExitGames::Common::JVector<ExitGames::LoadBalancing::Player> mPlayers = mLoadBalancingClient.getCurrentlyJoinedRoom().getPlayers();
	for (unsigned int i=0; i<mPlayers.getSize(); i++){
		players.addElement(mPlayers[i].getNumber());
	}
	return players;
}
void NetworkLogic::joinRoomReturn(int localPlayerNr, const ExitGames::Common::Hashtable& /*gameProperties*/, const ExitGames::Common::Hashtable& /*playerProperties*/, int errorCode, const ExitGames::Common::JString& errorString)
{
	EGLOG(ExitGames::Common::DebugLevel::INFO, L"");
	if(errorCode)
	{
		EGLOG(ExitGames::Common::DebugLevel::ERRORS, L"%ls", errorString.cstr());
		mOutputListener->writeLine(L"opJoinRoom() failed: " + errorString);
		mStateAccessor.setState(STATE_CONNECTED);
		return;
	}
	EGLOG(ExitGames::Common::DebugLevel::INFO, L"localPlayerNr: %d", localPlayerNr);
	mOutputListener->writeLine(L"game room \"" + mLoadBalancingClient.getCurrentlyJoinedRoom().getName() + "\" has been successfully joined");
	mOutputListener->writeLine(L"regularly sending dummy events now");
	S3DX::user.sendEvent(S3DX::application.getCurrentUser(), S3DX::AIVariable("myPhotonCloud_AI"), S3DX::AIVariable("onCurrentUserEnterRoom"), S3DX::AIVariable(localPlayerNr));
	//Add other players to the session right now:
	ExitGames::Common::JVector<ExitGames::LoadBalancing::Player> mPlayers = mLoadBalancingClient.getCurrentlyJoinedRoom().getPlayers();
	for (unsigned int i=0; i<mPlayers.getSize(); i++){
		S3DX::user.sendEvent(S3DX::application.getCurrentUser(), S3DX::AIVariable("myPhotonCloud_AI"), S3DX::AIVariable("onUserEnterRoom"), S3DX::AIVariable(mPlayers[i].getNumber()));
	}
	mStateAccessor.setState(STATE_JOINED);
}
예제 #3
0
void LoadBalancingListener::onLobbyStatsResponse(const ExitGames::Common::JVector<LobbyStatsResponse>& res)
{
	mpView->info("===================== lobby stats response");
	for(unsigned int i=0; i<res.getSize(); ++i) 
		mpView->info(res[i].toString().UTF8Representation().cstr());
}