Beispiel #1
0
        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_subtext.text  = StaticDB.GetString("REQUIRES_CLASS_HALL", null);
                component.m_subtext.color = Color.red;
                flag = false;
            }
            else if (realmName == "unknown")
            {
                component.m_subtext.text = string.Empty;
                flag = false;
            }
            else
            {
                if (online)
                {
                    component.m_subtext.text = realmName;
                }
                else
                {
                    component.m_subtext.text = realmName + " (" + StaticDB.GetString("OFFLINE", null) + ")";
                }
                component.m_subtext.color = Color.yellow;
            }
            component.m_subtext.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());
        }
        public void SortCharacterList()
        {
            CharacterListButton[]      componentsInChildren = this.charListContents.transform.GetComponentsInChildren <CharacterListButton>(true);
            List <CharacterListButton> characterListButtons = new List <CharacterListButton>();

            CharacterListButton[] characterListButtonArray = componentsInChildren;
            for (int i = 0; i < (int)characterListButtonArray.Length; i++)
            {
                characterListButtons.Add(characterListButtonArray[i]);
            }
            characterListButtons.Sort(new CharacterListView.CharacterButtonComparer());
            for (int j = 0; j < characterListButtons.Count; j++)
            {
                CharacterListButton[] characterListButtonArray1 = componentsInChildren;
                int num = 0;
                while (num < (int)characterListButtonArray1.Length)
                {
                    CharacterListButton characterListButton = characterListButtonArray1[num];
                    if (characterListButton.m_characterEntry.PlayerGuid != characterListButtons[j].m_characterEntry.PlayerGuid)
                    {
                        num++;
                    }
                    else
                    {
                        characterListButton.transform.SetSiblingIndex(j);
                        break;
                    }
                }
            }
            for (int k = 0; k < characterListButtons.Count; k++)
            {
                FancyEntrance component = characterListButtons[k].GetComponent <FancyEntrance>();
                component.m_timeToDelayEntrance = this.m_listItemInitialEntranceDelay + this.m_listItemEntranceDelay * (float)k;
                component.Activate();
            }
        }