コード例 #1
0
        internal void AddLevel(Level level)
        {
            using (var Ctx = new MysqlEntities())
            {
                var player = new Player
                {
                    ID     = level.Avatar.UserId,
                    Avatar = JsonConvert.SerializeObject(level.Avatar, this.Settings),
                };

                Ctx.Player.Add(player);
                Ctx.SaveChanges();
            }
        }
コード例 #2
0
 internal async void Save(List <Level> Levels)
 {
     using (var Ctx = new MysqlEntities())
     {
         foreach (Level pl in Levels)
         {
             lock (pl)
             {
                 Player p = Ctx.Player.Find(pl.Avatar.UserId);
                 if (p != null)
                 {
                     p.Avatar     = JsonConvert.SerializeObject(pl.Avatar, this.Settings);
                     p.Village    = Home.Starting_Home;
                     p.Trophies   = 0;
                     p.FacebookID = "Hi";
                 }
             }
         }
         await Ctx.BulkSaveChangesAsync(false);
     }
 }