当前位置: 首页>>代码示例>>C++>>正文


C++ LogReader::GetState方法代码示例

本文整理汇总了C++中LogReader::GetState方法的典型用法代码示例。如果您正苦于以下问题:C++ LogReader::GetState方法的具体用法?C++ LogReader::GetState怎么用?C++ LogReader::GetState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LogReader的用法示例。


在下文中一共展示了LogReader::GetState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MonitorThread


//.........这里部分代码省略.........
				Log("INFO  | LolSceneSwitch::MonitorThread | LoL client process exited!");
				CloseHandle(clientProcess);
				clientProcess = nullptr;
				clientWindow = nullptr;
				clientStateAddress = 0;
			}
		}

		// we have a game handle
		if (gameProcess != nullptr)
		{
			// check if it's still running
			if (GetExitCodeProcess(gameProcess, &exitCode) && exitCode == STILL_ACTIVE)
			{
				if (gameWindow == nullptr)
				{
					gameWindow = GetWindowById(gamePid);
				}
				if (reader == nullptr)
				{
					HANDLE file = GetLogFile(instance->settings.lolPath, &gameStartTime);
					if (file != nullptr)
					{
						reader = &LogReader(file);
					}
				}
				if (mapAddress == 0)
				{
					mapAddress = PointerPath32::GetThreadAddress(gameProcess, gamePid, 0);
				}

				if (instance->currentMap == Map::UNKNOWN)
				{
					std::string mapString1 = map1Pointer.Deref(gameProcess, mapAddress, 5);
					std::string mapString2 = map2Pointer.Deref(gameProcess, mapAddress, 5);
					if (mapString1.compare("Map1") == 0 || mapString2.compare("Map1") == 0 ||
						mapString1.compare("Map11") == 0 || mapString2.compare("Map11") == 0)
					{
						Log("INFO  | LolSceneSwitch::MonitorThread | Map is Summoners Rift!");
						instance->currentMap = Map::SUMMONERS_RIFT;
						newMapInfo = true;
					}
					else if (mapString1.compare("Map8") == 0 || mapString2.compare("Map8") == 0)
					{
						Log("INFO  | LolSceneSwitch::MonitorThread | Map is Crystal Scar!");
						instance->currentMap = Map::CRYSTAL_SCAR;
						newMapInfo = true;
					}
					else if (mapString1.compare("Map10") == 0 || mapString2.compare("Map10") == 0)
					{
						Log("INFO  | LolSceneSwitch::MonitorThread | Map is Twisted Treeline!");
						instance->currentMap = Map::TWISTED_TREELINE;
						newMapInfo = true;
					}
					else if (mapString1.compare("Map12") == 0 || mapString2.compare("Map12") == 0)
					{
						Log("INFO  | LolSceneSwitch::MonitorThread | Map is Howling Abyss!");
						instance->currentMap = Map::HOWLING_ABYSS;
						newMapInfo = true;
					}
				}

				if (reader != nullptr && (instance->settings.scenes[State::GAMEOUT].single.IsEmpty() ||
					(gameWindow != nullptr && HasFocus(gameWindow))))
				{
					state = reader->GetState();
				}
				else
				{
					state = State::GAMEOUT;
				}
			}
			else
			{
				Log("INFO  | LolSceneSwitch::MonitorThread | LoL game process exited!");
				ingame = false;
				postGame = true;
				CloseHandle(gameProcess);
				gameProcess = nullptr;
				gameWindow = nullptr;
				reader = nullptr;
				instance->currentMap = Map::UNKNOWN;
				mapAddress = 0;
			}
		}

		if (state != oldState || newMapInfo)
		{
			// Something has changed!!!
			Log("INFO  | LolSceneSwitch::MonitorThread | New state:", static_cast<long long>(state));

			oldState = state;
			newMapInfo = false;
			instance->ChangeScene(state);
		}
		Sleep(INTERVALL);
	}

	return 0;
}
开发者ID:Hybris95,项目名称:LolSceneSwitch,代码行数:101,代码来源:LolSceneSwitch.cpp


注:本文中的LogReader::GetState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。