Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Dictionary <BookStatModel, int> books = BookStatBLL.GetTopSellingBooks(10);
            int rank = 1;

            foreach (KeyValuePair <BookStatModel, int> book in books)
            {
                TopListElement control = (TopListElement)LoadControl("~/Controls/Element/TopListElement.ascx");
                Panel1.Controls.Add(control);
                control.SetParent(Panel1.ClientID);
                control.SetBook(book.Key, rank, book.Value);
                rank++;
            }
        }
Пример #2
0
    /// <summary>
    /// Выводим ТОП игроков
    /// </summary>
    public void OnScoreChangeTopList()
    {
        if (GroupTop != null)
        {
            for (int i = 0; i < GroupTop.transform.childCount; i++)
            {
                TopListElement element = GroupTop.transform.GetChild(i).GetComponent <TopListElement>();
                element.TopText.text  = GM.GameData.TopListNames[i];
                element.TopScore.text = GM.GameData.TopListScores[i];

                //Хотел сделать красиво, но шрифт имеет разный размер цыфр нет времени подбирать новый (потом включить)
                //string score = "";
                //int scoreLength = GM.GameData.TopListScores[i].Length;
                //for(int n=0;n<5-scoreLength;n++)
                //	score = score + "0";
                //score = score + GM.GameData.TopListScores[i];
                //element.TopScore.text = score;
            }
        }
    }