private UiImageData LocateMenuControls() { var result = new UiImageData(); result.RightClickMenu.Drop = AllImages.Where(x => x.ImageName == "drop.bmp").FirstOrDefault(); var menuControls = AllImages.Where(x => x.ImageName == "view pack contents.bmp" || x.ImageName == "top left of chat-action window.bmp" || x.ImageName == "combat menu.bmp" || x.ImageName == "bottom left of full ui view.bmp" ).ToList(); var menuControlsScanData = _imageProcessor.SearchScreenForImages(menuControls).ToList(); foreach (var mcsd in menuControlsScanData) { switch (mcsd.ImageData.ImageName) { case "view pack contents.bmp": result.PackContents = mcsd; break; case "top left of chat-action window.bmp": var chatWindow = AllImages.Where(x => x.ImageName == "full chat-action window.bmp").FirstOrDefault(); result.PerformActionOnAll = AddPoints(mcsd.MatchLocations.FirstOrDefault(), chatWindow.CenterOfImage); break; case "combat menu.bmp": var inventoryWindow = AllImages.Where(x => x.ImageName == "inventory list.bmp").FirstOrDefault(); mcsd.ImageData = inventoryWindow; result.Inventory = mcsd; break; case "bottom left of full ui view.bmp": var fullUiWindow = AllImages.Where(x => x.ImageName == "full ui view.bmp").FirstOrDefault(); var gameField = AllImages.Where(x => x.ImageName == "gamefield view.bmp").FirstOrDefault(); var gameFieldData = new OsrsScanData { ImageData = gameField }; var gameFieldLocation = new Point(mcsd.MatchLocations.FirstOrDefault().X, mcsd.MatchLocations.FirstOrDefault().Y - fullUiWindow.ImageBitmap.Height > 0 ? mcsd.MatchLocations.FirstOrDefault().Y - fullUiWindow.ImageBitmap.Height : 0); gameFieldData.MatchLocations.Add(gameFieldLocation); result.GameFieldView = gameFieldData; break; default: break; } } return(result); }
// Start is called before the first frame update public void Create(string pictureName) { var picture = AllImages.Where(x => x.name.Equals(pictureName)).FirstOrDefault(); Create(picture); }