예제 #1
0
void ChapterMenu::ProcessOptionKeyPress(std::string key)
{
	// Convert the input to an int.
	unsigned int keyAsInt = std::stoi(key);

	// Check if the exit key was pressed.
	if (keyAsInt == optionKeys.size())
	{
		GetGame().EndGame();
	}

	// Check if a story option was selected.
	if (keyAsInt < optionKeys.size() && keyAsInt >= 0)
	{
		ProcessChoice(keyAsInt);
		GetGame().GetDM().GoToNextChapter();
		ChangeChapter(GetGame().GetDM().GetStory().GetCurrentChapter());
	}

	// Was having issues doing this as a switch so I had to do the key checking with an ugly else if block.
	/*if (keyAsInt <= storyIDs.size() && keyAsInt >= 0)
	{
		Tools::Debug::Print("Story Selected.", Tools::Debug::PRIORITY::LOW);

		GetGame().GetDM().LoadNewStory(storyIDs.at(keyAsInt - 1));
	}
	else if (keyAsInt == storyIDs.size() + 1)
		GetGame().GoBackToPreviousMenu();
	else if (keyAsInt == storyIDs.size() + 2)
		GetGame().EndGame();*/
}
예제 #2
0
/************************************************************************
*  玩家经验值改变
************************************************************************/
bool Controller::CheckPlayerIsInPortal()
{
	Player* myPlayer = GetMyPlayer();//GetPlayerManager()->GetPlayer(m_strMyPlayerID);
	Point playerPosition = myPlayer->getPosition();
	if (GetCurrentChapter() != CHAPTER_4 && Game()->GetPathManager()->IsInRect(Game()->GetSkillManager()->GetPortalAnimation()->GetScope(),playerPosition))
	{
		if (GetCurrentChapter() == CHAPTER_1)
		{
			ChangeChapter(CHAPTER_2);
		}
		else if (GetCurrentChapter() == CHAPTER_2)
		{
			ChangeChapter(CHAPTER_3);
		}
		else if (GetCurrentChapter() == CHAPTER_3)
		{
			ChangeChapter(CHAPTER_4);
		}
		return true;
	}
	return false;
}