Beispiel #1
0
    void OnEnable()
    {
        foreach (Transform trans in m_ListRoot.GetComponentsInChildren <Transform>())
        {
            if (trans == m_ListRoot)
            {
                continue;
            }
            Destroy(trans.gameObject);
        }

        for (int i = 0; i < m_RankingData.m_Items.Length; i++)
        {
            UIRankingSlot slot = GameObject.Instantiate(m_SlotPrefab).GetComponent <UIRankingSlot>();
            slot.transform.SetParent(m_ListRoot);
            slot.transform.localScale = new Vector3(1, 1, 1);
            slot.gameObject.SetActive(true);

            RankingData.Item item = m_RankingData.m_Items[i];

            for (int n = 0; n < m_RankingData.m_Items[i].win.Length; n++)
            {
                UIRankingWinSlot winslot = GameObject.Instantiate(m_WinSlotPrefab).GetComponent <UIRankingWinSlot>();
                winslot.transform.SetParent(slot.m_WinListRoot);
                winslot.transform.localScale = new Vector3(1, 1, 1);
                winslot.gameObject.SetActive(true);
                winslot.Load(m_RankingData.m_Items[i].win[n]);
            }

            Sprite country = GetCountrySprite(item.country.ToString());
            slot.Load(item, country, item.win.Length > 0 ? true : false);
        }
    }
Beispiel #2
0
    public void Load(RankingData.Item item, Sprite flag, bool winlist)
    {
        m_TextRanking.text        = item.ranking.ToString();
        m_TextConstructor.text    = item.constructor;
        m_TextDriver.text         = item.driver;
        m_TextScore.text          = item.score.ToString();
        m_TextPodium.text         = item.podium.ToString();
        m_Flag.sprite             = flag;
        m_ImageCar.overrideSprite = item.icon;

        m_Win.SetActive(winlist);
    }