/// <summary> /// Basic auth /// </summary> /// <returns></returns> public async Task <ChampionsList> ChampionList() { ChampionsList champions = new ChampionsList(); try { HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Get, url + "ChampionsList"); var auth = "Basic "; var encoding = Encoding.GetEncoding("iso-8859-1"); auth += Convert.ToBase64String(encoding.GetBytes(username + ":" + password)); requestMessage.Headers.Add(configBasicAuth, auth); HttpResponseMessage response = await client.SendAsync(requestMessage); if (response.IsSuccessStatusCode) { var responseStr = await response.Content.ReadAsStringAsync(); champions = JsonConvert.DeserializeObject <ChampionsList>(responseStr); champions.Error = false; } else { champions.Error = true; } } catch (Exception) { champions = new ChampionsList(); champions.Error = true; } return(champions); }
public async Task <IActionResult> Index() { ChampionsList champions = new ChampionsList(); using (LOLWildRiftService service = new LOLWildRiftService()) { champions = await service.ChampionList(); } return(View()); }
private void OnMouseUp() { spriteName = GetComponent <SpriteRenderer>().sprite.name; GameObject camera = GameObject.Find("Main Camera"); ChampionsList list = camera.GetComponent <ChampionsList>(); list.SelectedName = spriteName; Debug.Log(spriteName); GameObject[] boxToDest = GameObject.FindGameObjectsWithTag("Box"); foreach (GameObject box in boxToDest) { Destroy(box); } list.ChampionSelected(); }
public async Task <ActionResult> Index(string searchString) { ChampionsList champions = new ChampionsList(); try { AlreadyLoggedIn(); champions = await _services.ChampionList(); if (!champions.Error) { foreach (var data in champions.Champions) { if (data.HISTORY != null && data.HISTORY.Length > 10) { data.HISTORY = data.HISTORY.Substring(0, 50) + "..."; } } if (!String.IsNullOrEmpty(searchString)) { @ViewData["CurrentFilter"] = searchString; var resultObj = champions.Champions.Where(c => c.NAME.ToUpper().Contains(searchString.ToUpper()) || c.LANE.ToUpper().Contains(searchString.ToUpper()) || c.ROLE.ToUpper().Contains(searchString.ToUpper())); return(View(resultObj.ToList())); } } else { return(RedirectToAction("ErrorPage")); } } catch (Exception) { return(RedirectToAction("ErrorPage")); } return(View(champions.Champions)); }
static private void Set() { string __airFileName = Path.Combine(Directories.AirClientFolder, _AirGeneratedContent); if (File.Exists(__airFileName)) { _champions = new ChampionsList(); _runes = new RunesList(); _maps = new MapsList(); _featuredGames = new FeaturedGamesList(); _spells = new SpellsList(); _items = new GameItemList(); Tools.Swf.SwfReader __swfReader = new Tools.Swf.SwfReader(__airFileName); __swfReader.DeCompile(); if (__swfReader.CompilationUnit.IsValid) { if (__swfReader.CompilationUnit.Symbols.Count > 0) { foreach (ISwfTag __iSwfTag in __swfReader.CompilationUnit.Tags) { if (__iSwfTag is DoABCTag) { DoABCTag _abctag = (DoABCTag)__iSwfTag; foreach (KeyValuePair <uint, AS3_Class> __class in _abctag.Classes) { if (__class.Value.classname is RTQName) { switch (((RTQName)__class.Value.classname).Name) { case "ChampionGeneratedData": foreach (KeyValuePair <uint, AS3_MethodInfo> __member in __class.Value.traits.methods) { List <object[]> __results = GetParams(__member.Value, "createChampion"); if (__results.Count > 0) { foreach (object[] __result in __results) { _champions.Add(new Champion(__result)); } } } break; case "RuneGeneratedData": foreach (KeyValuePair <uint, AS3_MethodInfo> __member in __class.Value.traits.methods) { List <object[]> __results = GetParams(__member.Value, "createRune"); if (__results.Count > 0) { foreach (object[] __result in __results) { _runes.Add(new Rune(__result)); } } } break; case "MapGeneratedData": foreach (KeyValuePair <uint, AS3_MethodInfo> __member in __class.Value.traits.methods) { List <object[]> __results = GetParams(__member.Value, "createMap"); if (__results.Count > 0) { foreach (object[] __result in __results) { _maps.Add(new Map(__result)); } } } break; case "FeaturedGameGeneratedData": foreach (KeyValuePair <uint, AS3_MethodInfo> __member in __class.Value.traits.methods) { List <object[]> __results = GetParams(__member.Value, "createFeaturedGame"); if (__results.Count > 0) { foreach (object[] __result in __results) { _featuredGames.Add(new FeaturedGame(__result)); } } } break; case "SpellGeneratedData": foreach (KeyValuePair <uint, AS3_MethodInfo> __member in __class.Value.traits.methods) { List <object[]> __results = GetParams(__member.Value, "createSpell"); if (__results.Count > 0) { foreach (object[] __result in __results) { _spells.Add(new Spell(__result)); } } } break; case "GameItemGeneratedData": foreach (KeyValuePair <uint, AS3_MethodInfo> __member in __class.Value.traits.methods) { List <object[]> __results = GetParams(__member.Value, "createGameItem"); if (__results.Count > 0) { foreach (object[] __result in __results) { _items.Add(new GameItem(__result)); } } } break; } } } } } } } } }
public IEnumerator DisplayChampions1(float waitTime) { yield return(new WaitForSeconds(waitTime)); if (!more) { y = 3.37f; for (int i = 0; i < 36; i++) // Displaying all Champions Icons { if (i == 0 || i == 9 || i == 18 || i == 27 || i == 36 || i == 45) { x = -1.95f; } if (i == 5 || i == 14 || i == 23 || i == 32 || i == 41 || i == 50) { x = -1.4625f; } if (i == 5 || i == 9 || i == 18 || i == 27 || i == 36 || i == 45 || i == 14 || i == 23 || i == 32 || i == 41 || i == 50) { y -= 0.88f; } GameObject camera = GameObject.Find("Main Camera"); ChampionsList list = camera.GetComponent <ChampionsList>(); List <Champion> champs = list.champions; spriteName = champs[i].champName; mySprite = Resources.Load <Sprite>("ChampionsIcons/" + spriteName); box.GetComponent <SpriteRenderer>().sprite = mySprite; var newIcon = (GameObject)Instantiate(box, new Vector3(x, y, 0), Quaternion.identity); newIcon.name = spriteName; // Naming instantiated GameObjects with Champion name x += 0.975f; } } else if (more) { GameObject[] boxToDest = GameObject.FindGameObjectsWithTag("Box"); foreach (GameObject box in boxToDest) { Destroy(box); } y = 3.37f; for (int i = 36; i < 50; i++) // Displaying all Champions Icons { if (i == 0 || i == 9 || i == 18 || i == 27 || i == 36 || i == 45) { x = -1.95f; } if (i == 5 || i == 14 || i == 23 || i == 32 || i == 41 || i == 50) { x = -1.4625f; } if (i == 5 || i == 9 || i == 18 || i == 27 || i == 36 || i == 45 || i == 14 || i == 23 || i == 32 || i == 41 || i == 50) { y -= 0.88f; } GameObject camera = GameObject.Find("Main Camera"); ChampionsList list = camera.GetComponent <ChampionsList>(); List <Champion> champs = list.champions; spriteName = champs[i].champName; mySprite = Resources.Load <Sprite>("ChampionsIcons/" + spriteName); box.GetComponent <SpriteRenderer>().sprite = mySprite; var newIcon = (GameObject)Instantiate(box, new Vector3(x, y, 0), Quaternion.identity); newIcon.name = spriteName; // Naming instantiated GameObjects with Champion name x += 0.975f; } } }