public static async void LogixStart(ShowInformation showInformation) { showInformation.Hide(); if (mShowInformation != null) { mShowInformation.ThisWindowClose = true; await Task.Delay(100); mShowInformation.Close(); } mShowInformation = showInformation; Users.Clear(); await CehckStartGame(); if (FileControl.AutoSearching) { GameSearchLogicStart(); await AddUsers(); } else { if (gameType != GameType.무작위_총력전) { BitmapSource capturedImage = ScreenCapture.GetGameType(gameWindowX, gameWindowY); gameType = ImageSearchClass.GetGameType(capturedImage); } Debug.WriteLine("게임 타입 : " + gameType); ShowInformationViewModel.viewModelObject.GameType = gameType; await Task.Delay(2000); NewAddUsers(); } GameLoop(); }
private static async void GameLoop() { while (true) { if (GetProcessStatus.FineGameStartProcess()) { LogixStart(new ShowInformation()); return; } if (logixExit) { logixExit = false; LogixStart(new ShowInformation()); return; } if (ImageSearchClass.NewGame()) { LogixStart(new ShowInformation()); return; } SetWindowPosition(); await Task.Delay(1000); if (gameWindowX == -1 && gameWindowY == -1) { continue; } for (int index = 0; index < Users.Count; index++) { GameUser user = Users[index]; if (user.data.accountID == string.Empty || user.data.userName == "이름 찾지 못함") { continue; } Champion usersChampion = MakeUserChampion(user); if (usersChampion.code == 0) { user.champion = usersChampion; user.championData = null; ShowInformationViewModel.viewModelObject.UserChanged(); continue; } if (user.champion.code != usersChampion.code) { user.champion = usersChampion; SetUserChampionData(user, gameType); } } } }
private static bool SetWindowPosition() { int[] result = ImageSearchClass.GameWindowPostion(); gameWindowX = result[0]; gameWindowY = result[1]; ShowInformationViewModel.viewModelObject.GameWindowWidth = gameWindowX; ShowInformationViewModel.viewModelObject.GameWindowHeight = gameWindowY; return(true); }
public static BitmapSource GetUserChampionOnRank(int gameWindowX, int gameWindowY, GameUser user) { if (user.IsSelect) { gameWindowX += 60; } else if (ImageSearchClass.UserIsSelect(gameWindowY, user.index)) { user.IsSelect = true; gameWindowX += 60; } else { gameWindowX += 22; } return(CaptureRegion(gameWindowX, gameWindowY + 107 + user.index * 80, 60, 60, false)); }
private static async Task CehckStartGame() { gameType = (GameType)(await ImageSearchClass.WaitCatchGame())[2]; SetWindowPosition(); }
private static async Task AddUsers() { BitmapSource capturedImage = await ScreenCapture.GetUsersAllImageAsync(gameWindowX, gameWindowY, gameType); string googleApiResult = SocketObject.GetImageSearching(LoginViewModel.LoginUser, ImageSearchClass.BufferFromImage(capturedImage)); if (googleApiResult == null || googleApiResult == string.Empty) { Debug.Assert(false); return; } string[] googleAPIResuluts = googleApiResult.Split('\n'); if (gameType == GameType.비공개_선택) { for (int index = 0; index < googleAPIResuluts.Length; index++) { if (index % 2 == 0) { continue; } GameUser user = await CreateUserAsync(googleAPIResuluts[index]); user.index = index / 2; Users.Add(user); } } else if (gameType == GameType.무작위_총력전) { for (int index = 0; index < googleAPIResuluts.Length; index++) { GameUser user = await CreateUserAsync(googleAPIResuluts[index]); user.index = index; Users.Add(user); } } else if (gameType == GameType.랭크_게임) { for (int index = 0; index < googleAPIResuluts.Length; index++) { if (googleAPIResuluts[index] == "상단 (탑)" || googleAPIResuluts[index] == "중단 (미드)" || googleAPIResuluts[index] == "정글" || googleAPIResuluts[index] == "하단 (봇)" || googleAPIResuluts[index] == "서포터" || googleAPIResuluts[index] == "희망 챔피언 선택" || googleAPIResuluts[index] == string.Empty) { continue; } GameUser user = await CreateUserAsync(googleAPIResuluts[index]); user.index = index / 2; Users.Add(user); } } }
private static void GameSearchLogicStart() { BitmapSource capturedImage = ScreenCapture.GetGameType(gameWindowX, gameWindowY); string googleApiResult = SocketObject.GetImageSearching(LoginViewModel.LoginUser, ImageSearchClass.BufferFromImage(capturedImage)); if (googleApiResult != null && googleApiResult != string.Empty) { googleApiResult = googleApiResult.Split('\n')[1].Split('\n')[0]; } if (googleApiResult == "비공개 선택") { gameType = GameType.비공개_선택; } else if (googleApiResult == "개인/2인 랭크 게임") { gameType = GameType.랭크_게임; } else if (googleApiResult == "무작위 총력전") { gameType = GameType.무작위_총력전; } else { //Debug.Assert(false); } Debug.WriteLine("게임 타입 : " + googleApiResult); return; }