Exemplo n.º 1
0
        public ImageHandlerFactory(IGameWindowTyper gameWindowTyper, IGameWindowClicker gameWindowClicker, IResourceResolver resourceResolver)
        {
            _detectionImagePath = resourceResolver.ResolveResourcePath(ResourceType.DetectionImages);

            // Image original coordinates: (all are relative and normalized to (1024, 576))
            // ChampionPickImageHandler
            // - Chat:   (18, 533)  -> (0.017578125f, 0.9253472222222222f)
            // - Search: (594, 79)  -> (0.580078125f, 0.1371527777777778f)
            // - Pick:   (490, 481) -> (0.478515625f, 0.8350694444444444f)
            // ClickImageHandler
            // - Accept: (480, 440) -> (0.46875f, 0.7638888888888888f)
            // QueueImageHandler
            // - Queue:  (903, 40)  -> (0.8818359375f, 0.06944444444444445f)
            // LobbyImageHandler
            // - Lobby:  (922, 73)  -> (0.900390625f, 0.1267361111111111f)

            var champPickImageHandler = new ChampionPickImageHandler(gameWindowTyper, TemplateFinder("Search.png", new Vector2(0.580078125f, 0.1371527777777778f)), TemplateFinder("Chat.png", new Vector2(0.017578125f, 0.9253472222222222f)), TemplateFinder("Pick.png", new Vector2(0.478515625f, 0.8350694444444444f)), GameStatus.PickingLane);

            SelectedRoleStore = champPickImageHandler;

            _imageHandlers = new IImageHandler[]
            {
                champPickImageHandler,
                new ClickImageHandler(gameWindowClicker, TemplateFinder("Accept.png", new Vector2(0.46875f, 0.7638888888888888f)), GameStatus.AcceptingMatch),
                new DefaultImageHandler(TemplateFinder("Queue.png", new Vector2(0.8818359375f, 0.06944444444444445f)), GameStatus.Searching),
                new DefaultImageHandler(TemplateFinder("Lobby.png", new Vector2(0.900390625f, 0.1267361111111111f)), GameStatus.InLobby)
            };
        }
Exemplo n.º 2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string championName             = (string)value;
            string championSquaresDirectory = _resourceResolver.ResolveResourcePath(_resourceType);

            return(Path.Combine(championSquaresDirectory, string.Concat(championName, ".png")));
        }
Exemplo n.º 3
0
        public Champion[] LoadAllChampions()
        {
            string championNamesFile = _resourceResolver.ResolveResourcePath(ResourceType.ChampionNames);

            return(_resourceReader.ReadResourceFile(championNamesFile)
                   .Select(name => new Champion(name))
                   .ToArray());
        }