Exemple #1
0
 /// <summary>
 /// Called when the champion info has been retrieved.
 /// </summary>
 private void OnChampionInfoLoaded(ChampionAttributes champInfo)
 {
     animator.NewFrameReady += (_, ls, mode) => DispatchNewFrame(ls, mode);
     AbilityCast            += OnAbilityCast;
     AbilityRecast          += OnAbilityRecast;
     KeyboardHookService.Instance.OnMouseClicked += MouseClicked;
 }
Exemple #2
0
        /// <summary>
        /// Retrieves the attributes for a given champ (ability cooldowns, mana costs, etc.)
        /// </summary>
        /// <param name="championName">Internal champion name (i.e. Vel'Koz -> Velkoz)</param>
        /// <returns></returns>
        private async Task <ChampionAttributes> GetChampionInformation(string championName)
        {
            string latestVersion;

            try
            {
                string versionJSON = await WebRequestUtil.GetResponse(VERSION_ENDPOINT);

                List <string> versions = JsonConvert.DeserializeObject <List <string> >(versionJSON);
                latestVersion = versions[0];
            }
            catch (WebException e)
            {
                throw new InvalidOperationException("Error retrieving game version", e);
            }

            string championJSON;

            try
            {
                championJSON = await WebRequestUtil.GetResponse(String.Format(CHAMPION_INFO_ENDPOINT, latestVersion, championName));
            }
            catch (WebException e)
            {
                throw new InvalidOperationException("Error retrieving champion data for '" + championName + "'", e);
            }
            dynamic championData = JsonConvert.DeserializeObject <dynamic>(championJSON);

            return(ChampionAttributes.FromData(championData.data[championName]));
        }
Exemple #3
0
 private void LoadChampionInformation(string champName)
 {
     Task.Run(async() =>
     {
         ChampionInfo = await GetChampionInformation(champName);
         AddInputHandlers();
         ChampionInfoLoaded?.Invoke(ChampionInfo);
     });
 }
Exemple #4
0
 private void LoadChampionInformation(string champName)
 {
     Task.Run(async() =>
     {
         ChampionInfo = await GetChampionInformation(champName);
         KeyboardHookService.Instance.OnMouseClicked += OnMouseClick; // TODO. Abstract this to league of legends module, so it pairs with summoner spells and items.
         KeyboardHookService.Instance.OnKeyPressed   += OnKeyPress;
         KeyboardHookService.Instance.OnKeyReleased  += OnKeyRelease;
         ChampionInfoLoaded?.Invoke(ChampionInfo);
     });
 }
 /// <summary>
 /// Called when the champion info has been retrieved.
 /// </summary>
 private void OnChampionInfoLoaded(ChampionAttributes champInfo)
 {
     animator.NewFrameReady += (_, ls, mode) => DispatchNewFrame(ls, mode);
     AbilityCast            += OnAbilityCast;
     AbilityRecast          += OnAbilityRecast;
 }
Exemple #6
0
 /// <summary>
 /// Called when the champion info has been retrieved.
 /// </summary>
 protected virtual void OnChampionInfoLoaded(ChampionAttributes champInfo)
 {
     AddAnimatorEvent();
     AbilityCast   += OnAbilityCast;
     AbilityRecast += OnAbilityRecast;
 }
Exemple #7
0
 protected ChampionModule(string champName, ActivePlayer playerInfo)
 {
     Name         = champName;
     PlayerInfo   = playerInfo;
     ChampionInfo = GetChampionInformation(champName);
 }