public string OCRPlayerName(Mat viewportMat, RECT viewportRect, int index) { var rectRate = pcrTools.GetRectRate(configMgr.PCRRegion.ToString(), $"arena_player_name_{index + 1}"); var playerNameMat = viewportMat.GetChildMatByRectRate(rectRate); var grayMat = playerNameMat.ToGray(); ShowMat($"ArenaSearchName{index}", grayMat); var r = ocrTools.OCR(grayMat); return(r); }
public int GetBattleLeftTime(Mat viewportMat, RECT viewportRect) { var rectRate = pcrTools.GetRectRate("Battle_Time"); var leftTimeMat = viewportMat.GetChildMatByRectRate(rectRate); var s = OCRTools.GetInstance().OCR(leftTimeMat); var ma = Regex.Match(s, "(\\d+):(\\d+)"); if (!ma.Success) { throw new Exception(Trans.T("无法读取战斗剩余时间")); } var mins = Convert.ToInt32(ma.Groups[1].Value); var secs = Convert.ToInt32(ma.Groups[2].Value); var time = mins * 60 + secs; leftTime = time; return(time); }