Ejemplo n.º 1
0
//Callback for the LeftClick event listener on the logout button
//param:buttonClicked->Pointer to the button clicked
//param:thisClass->Main menu class, in case we need it
 void MainMenu::LogoutClickListener(MenuButton* buttonClicked, void* thisClass)
 {
	MenuManager* networkManager = MenuManager::GetInstance();

	//Make sure we aren't logged in
	if(networkManager->GetLoggedIn())
	{
		//Create a Login Data Gamedata stucture to indicate logout
		GameData dataToSend = GameDataBuilder::CreateLoginData(
			networkManager->network.GetClientID(), false, (char*)networkManager->GetUsername().c_str(),
			"");

		//Send the login
		networkManager->network.SendData(dataToSend);
	}
	else
	{
		std::cout<< "Not Logged In" << std::endl;
	}
 }
Ejemplo n.º 2
0
 //Callback for the LeftClick event listener on the logout button
//param:buttonClicked->Pointer to the button clicked
//param:thisClass->Main menu class, in case we need it
 void MainMenu::StatsClickListener(MenuButton* buttonClicked, void* thisClass)
 {
	MenuManager* networkManager = MenuManager::GetInstance();

	//Make sure we aren't logged in
	if(networkManager->GetLoggedIn())
	{
		//Create a Login Data Gamedata stucture to indicate logout
		GameData dataToSend = GameDataBuilder::CreateStatsData(networkManager->network.GetClientID(),
			networkManager->GetUsername(), -1, -1, -1);

		//Send the login
		networkManager->network.SendData(dataToSend);

		networkManager->SetScreen(MenuManager::MenuState::STATE_STATS);
	}
	else
	{
		std::cout<< "Not Logged In" << std::endl;
	}
 }