Example #1
0
 public void GeneratePlayers()
 {
     if (PlayerManager.TotalPlayers() == 0)
     {
         string[] playerNames = players.Split(',');
         foreach (string pName in playerNames)
         {
             Player player = new Player();
             player.Name = pName;
             player.LastLogin = new DateTime(DateTime.Now.Year, DateTime.Now.Month, random.Next(1, DateTime.Now.Day));
             PlayerManager.SavePlayer(player);
         }
     }
 }
Example #2
0
        public static Player LoadPlayer(string name)
        {
            Siaqodb database = DatabaseFactory.GetInstance();

            Player p = (from Player player in database
                         where player.Name == name
                         select player).FirstOrDefault<Player>();

            if (p == null)//not exists so create and save
            {
                p = new Player();
                p.Name = name;
                p.LastLogin = DateTime.Now;

                database.StoreObject(p);
            }
            return p;
        }
Example #3
0
 public static void SavePlayer(Player p)
 {
     Siaqodb database = DatabaseFactory.GetInstance();
     database.StoreObject(p);
 }
Example #4
0
 //Server
 public void RemovePlayer( Player player )
 {
     player.SetDeleted();
 }