Ejemplo n.º 1
0
        private Player getUserInfo(Guid userId)
        {
            var db     = new LevelScoreEntities();
            var player = db.Players.FirstOrDefault(p => p.UserId == userId);

            return(player);
        }
Ejemplo n.º 2
0
        private void setNewHighScore(Player player, int score)
        {
            var db = new LevelScoreEntities();

            db.Players.FirstOrDefault(p => p.UserId == player.UserId).HighScore = score;
            db.SaveChanges();
        }
Ejemplo n.º 3
0
        private void levelUp(Guid guid)
        {
            var db = new LevelScoreEntities();

            db.Players.FirstOrDefault(p => p.UserId == guid).Level++;
            db.SaveChanges();
        }
Ejemplo n.º 4
0
        private void addPlayer(Guid guid, string alias)
        {
            var    db     = new LevelScoreEntities();
            Player player = new Player();

            player.UserId    = guid;
            player.Level     = 0;
            player.HighScore = 0;
            player.Alias     = alias;
            db.Players.Add(player);
            db.SaveChanges();
        }
Ejemplo n.º 5
0
        private Player createNewPlayer(Guid userId)
        {
            var    db     = new LevelScoreEntities();
            Player player = new Player();

            player.UserId    = userId;
            player.Level     = 0;
            player.HighScore = 0;
            db.Players.Add(player);
            db.SaveChanges();
            return(player);
        }
Ejemplo n.º 6
0
        public string InputAlias(string user, string alias)
        {
            Guid guid;

            if (!Guid.TryParse(user, out guid))
            {
                throw new Exception("User Id not Valid.");
            }
            var db = new LevelScoreEntities();

            db.Players.FirstOrDefault(p => p.UserId == guid).Alias = alias;
            db.SaveChanges();
            string output = "Thanks " + alias + "!\nEnjoy Divisicus!";

            return(output);
        }