Exemple #1
0
        public static void RankingPlayer_Test()
        {
            List <Player> playerList = PlayerDb.GetRankingPlayerListWithLimit(3);

            Assert.AreEqual(playerList.Count, 3);

            //var player1 = new List<string>() { "", "0", "0", "0" };
            //var player2 = new List<string>() { "Ty", "3", "5", "2" };
            //var player3 = new List<string>() { "Suu", "13", "4", "4" };
            var player4 = new List <string>()
            {
                "Dan", "13", "5", "1"
            };
            var player5 = new List <string>()
            {
                "Meo", "14", "3", "3"
            };
            //var player6 = new List<string>() { "Thin", "2", "34", ""39" };
            var player7 = new List <string>()
            {
                "Ty", "17", "0", "0"
            };

            Assert.AreEqual(RankingPlayer(playerList[0]), player7);
            Assert.AreEqual(RankingPlayer(playerList[1]), player5);
            Assert.AreEqual(RankingPlayer(playerList[2]), player4);
            //Assert.AreEqual(RankingPlayer(playerList[3]), player3);
            //Assert.AreEqual(RankingPlayer(playerList[4]), player2);
            //Assert.AreEqual(RankingPlayer(playerList[5]), player6);
            //Assert.AreEqual(RankingPlayer(playerList[6]), player1);
        }
Exemple #2
0
        //// <summary>
        /// Get ranking of own player
        /// </summary>
        /// <returns>int</returns>
        public int GetOwnRanking()
        {
            var ownRanking        = 0;
            var count             = PlayerDb.CountPlayer();
            var playerListRanking = PlayerDb.GetRankingPlayerListWithLimit(count);

            for (int i = 0; i < count; i++)
            {
                if (playerListRanking[i].Pseudo == Pseudo)
                {
                    ownRanking = i + 1;
                    break;
                }
            }
            return(ownRanking);
        }
Exemple #3
0
        public Home()
        {
            InitializeComponent();

            //Display the best players
            icBestPlayerList.ItemsSource = PlayerDb.GetRankingPlayerListWithLimit(5);
            txbWelcome.Text = "Bienvenu " + Services.Player.Pseudo + " !";

            //Display info of player
            tbiPlayer.DataContext = Services.Player;
            lblOwnRanking.Content = Services.Player.Ranking + "/" + Services.PlayerQty;
            lblIsAdmin.Content    = (Services.Player.IsAdmin == 1) ? "Oui" : "Non";
            lblIsDisabled.Content = (Services.Player.IsEnabled == 1) ? "Oui" : "Non";

            //Administration
            if (Services.Player.IsAdmin != 1)
            {
                btnAdmin.Visibility = Visibility;//Hide this button since player is not admin
            }
        }