public void SortCharacterList() { CharacterListButton[] componentsInChildren = this.charListContents.get_transform().GetComponentsInChildren <CharacterListButton>(true); List <CharacterListButton> list = new List <CharacterListButton>(); CharacterListButton[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { CharacterListButton characterListButton = array[i]; list.Add(characterListButton); } CharacterListView.CharacterButtonComparer characterButtonComparer = new CharacterListView.CharacterButtonComparer(); list.Sort(characterButtonComparer); for (int j = 0; j < list.get_Count(); j++) { CharacterListButton[] array2 = componentsInChildren; for (int k = 0; k < array2.Length; k++) { CharacterListButton characterListButton2 = array2[k]; if (characterListButton2.m_characterEntry.PlayerGuid == list.get_Item(j).m_characterEntry.PlayerGuid) { characterListButton2.get_transform().SetSiblingIndex(j); break; } } } for (int l = 0; l < list.get_Count(); l++) { FancyEntrance component = list.get_Item(l).GetComponent <FancyEntrance>(); component.m_timeToDelayEntrance = this.m_listItemInitialEntranceDelay + this.m_listItemEntranceDelay * (float)l; component.Activate(); } }
public void AddCharacterButton(JamJSONCharacterEntry charData, string subRegion, string realmName, bool online) { this.m_characterEntry = charData; GameObject gameObject = Object.Instantiate <GameObject>(this.charListItemPrefab); gameObject.transform.SetParent(this.charListContents.transform, false); CharacterListButton component = gameObject.GetComponent <CharacterListButton>(); component.SetGUID(charData.PlayerGuid); component.m_characterEntry = charData; component.m_subRegion = subRegion; Sprite sprite = GeneralHelpers.LoadClassIcon((int)charData.ClassID); if (sprite != null) { component.m_characterClassIcon.sprite = sprite; } component.m_characterName.text = charData.Name; bool flag = online; if (!charData.HasMobileAccess) { component.m_missingRequirement.text = StaticDB.GetString("REQUIRES_CLASS_HALL", null); component.m_missingRequirement.color = Color.red; flag = false; } else if (realmName == "unknown") { component.m_missingRequirement.text = string.Empty; flag = false; } else { if (online) { component.m_missingRequirement.text = realmName; } else { component.m_missingRequirement.text = realmName + " (" + StaticDB.GetString("OFFLINE", null) + ")"; } component.m_missingRequirement.color = Color.yellow; } component.m_missingRequirement.gameObject.SetActive(true); if (!flag) { Button component2 = gameObject.GetComponent <Button>(); component2.interactable = false; component.m_characterName.color = Color.grey; component.m_characterLevel.color = Color.grey; } int num = (int)charData.ExperienceLevel; if (num < 1) { num = 1; } component.m_characterLevel.text = GeneralHelpers.TextOrderString(CharacterListView.m_levelText, num.ToString()); }