예제 #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
        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);
        }
예제 #3
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);
        }
예제 #4
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;
        }
예제 #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);
        }