示例#1
0
        protected Control CreateHeaderControl()
        {
            PanelControl panel = new PanelControl();

            panel.AddChild(new TextControl("Player", headerFont, Color.Turquoise, new Vector2(0, 0)));
            panel.AddChild(new TextControl("Score", headerFont, Color.Turquoise, new Vector2(200, 0)));

            return panel;
        }
示例#2
0
        /// <summary>
        /// </summary>
        /// <returns></returns>
        protected Control CreateHeaderControl()
        {
            var panel = new PanelControl();

            panel.AddChild(new TextControl("Player", _headerFont, Color.Turquoise, new Vector2(0, 0)));
            panel.AddChild(new TextControl("Score", _headerFont, Color.Turquoise, new Vector2(200, 0)));

            return(panel);
        }
示例#3
0
        // Create a Control to display one entry in a leaderboard. The content is broken out into a parameter
        // list so that we can easily create a control with fake data when running under the emulator.
        // For time leaderboards, this function interprets the time as a count in seconds. The
        // value posted is simply a long, so your leaderboard might actually measure time in ticks, milliseconds,
        // or microfortnights. If that is the case, adjust this function to display appropriately.
        protected Control CreateLeaderboardEntryControl(string player, long rating, TimeSpan time)
        {
            var textColor = Color.White;
            var panel     = new PanelControl();

            // Player name
            panel.AddChild(
                new TextControl
            {
                Text     = player,
                Font     = _detailFont,
                Color    = textColor,
                Position = new Vector2(0, 0)
            });

            // Score
            panel.AddChild(
                new TextControl
            {
                Text     = String.Format("{0}", rating),
                Font     = _detailFont,
                Color    = textColor,
                Position = new Vector2(200, 0)
            });

            // Time
            panel.AddChild(
                new TextControl
            {
                Text     = String.Format("Completed in {0:g}", time),
                Font     = _detailFont,
                Color    = textColor,
                Position = new Vector2(400, 0)
            });

            return(panel);
        }
示例#4
0
        /// <summary>
        /// </summary>
        private void PopulateWithFakeData()
        {
            var newList = new PanelControl();
            var rng     = new Random();

            for (var i = 0; i < 50; i++)
            {
                long score = 10000 - i * 10;
                var  time  = TimeSpan.FromSeconds(rng.Next(60, 3600));
                newList.AddChild(CreateLeaderboardEntryControl("player" + i, score, time));
            }
            newList.LayoutColumn(0, 0, 0);

            if (_resultListControl != null)
            {
                RemoveChild(_resultListControl);
            }
            _resultListControl = newList;
            AddChild(_resultListControl);
            LayoutColumn(0, 0, 0);
        }
示例#5
0
        // Create a Control to display one entry in a leaderboard. The content is broken out into a parameter
        // list so that we can easily create a control with fake data when running under the emulator.
        //
        // Note that for time leaderboards, this function interprets the time as a count in seconds. The
        // value posted is simply a long, so your leaderboard might actually measure time in ticks, milliseconds,
        // or microfortnights. If that is the case, adjust this function to display appropriately.
        protected Control CreateLeaderboardEntryControl(string player, long rating, TimeSpan time)
        {
            Color textColor = Color.White;

            var panel = new PanelControl();

            // Player name
            panel.AddChild(
                new TextControl
                {
                    Text = player,
                    Font = detailFont,
                    Color = textColor,
                    Position = new Vector2(0, 0)
                });

            // Score
            panel.AddChild(
                new TextControl
                {
                    Text = String.Format("{0}", rating),
                    Font = detailFont,
                    Color = textColor,
                    Position = new Vector2(200, 0)
                });

            // Time
            panel.AddChild(
                new TextControl
                    {
                        Text = String.Format("Completed in {0:g}", time),
                        Font = detailFont,
                        Color = textColor,
                        Position = new Vector2(400, 0)
                    });

            return panel;
        }
示例#6
0
        private void PopulateWithFakeData()
        {
            PanelControl newList = new PanelControl();
            Random rng = new Random();
            for (int i = 0; i < 50; i++)
            {
                long score = 10000 - i * 10;
                TimeSpan time = TimeSpan.FromSeconds(rng.Next(60, 3600));
                newList.AddChild(CreateLeaderboardEntryControl("player" + i.ToString(), score, time));
            }
            newList.LayoutColumn(0, 0, 0);

            if (resultListControl != null)
            {
                RemoveChild(resultListControl);
            }
            resultListControl = newList;
            AddChild(resultListControl);
            LayoutColumn(0, 0, 0);
        }
        private void Populate()
        {
            try
            {
                List<Score> highSores = new List<Score>();

                PanelControl newList = new PanelControl();

                if (HighScores.scores.Count > 0)
                {
                    Thread.Sleep(3000);

                    highSores = HighScores.scores;
                    foreach (var s in highSores)
                    {
                        newList.AddChild(CreateLeaderboardEntryControl(s.name, s.score, s.time));
                        _count++;
                    }
                    if (_count == HighScores.scores.Count)
                    {
                        Populated = true;
                    }
                   // newList.RemoveChildAt(0);
                }
                else
                {
                    newList.AddChild(CreateLeaderboardEntryControl(Message, " ", " "));
                }
                newList.LayoutColumn(0, 0, 0);

                if (resultListControl != null)
                {
                    RemoveChild(resultListControl);
                }
                resultListControl = newList;
                AddChild(resultListControl);
                LayoutColumn(0, 0, 0);
            }
            catch
            {

            }
        }