Exemplo n.º 1
0
 public GameplayState(Game game, GameStateManager manager, EntityProperties properties)
     : base(game, manager)
 {
     loadedGame = true;
     loadedProps = properties == null ? new EntityProperties() : properties;
     hud = new HUD(this);
 }
Exemplo n.º 2
0
 public void LoadFromData(EntityProperties props)
 {
     Name = props.Name;
     Position = props.Position;
     dir = props.Direction;
     godMode = props.GodMode;
     noClip = props.NoClip;
     superSpeed = props.SuperSpeed;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Saves the player's data
 /// </summary>
 /// <param name="properties"></param>
 public static bool SavePlayerData(EntityProperties properties)
 {
     try
     {
         var stream = File.Create(absolutePath + properties.Name + ".dat");
         serializer.Serialize(stream, properties);
         stream.Close();
         return(true);
     }
     catch (IOException ex)
     {
         Debug.WriteLine(ex.StackTrace);
         return(false);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Loads the data from a given player
        /// </summary>
        /// <param name="name">Name of the player</param>
        public static EntityProperties LoadPlayerData(string name)
        {
            EntityProperties results = new EntityProperties();

            try
            {
                if (File.Exists(absolutePath + name + ".dat"))
                {
                    // The load file was found --> continue
                    var stream = File.Open(absolutePath + name + ".dat", FileMode.Open);
                    results = (EntityProperties)serializer.Deserialize(stream);
                    stream.Close();
                }
                else
                {
                    throw new Exception("That load file was not found!\nFile: " + absolutePath + name + ".dat");
                }
            }
            catch (IOException ex)
            {
                Debug.WriteLine(ex.StackTrace);
            }
            return(results);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Loads the data from a given player
 /// </summary>
 /// <param name="name">Name of the player</param>
 public static EntityProperties LoadPlayerData(string name)
 {
     EntityProperties results = new EntityProperties();
     try
     {
         if (File.Exists(absolutePath + name + ".dat"))
         {
             // The load file was found --> continue
             var stream = File.Open(absolutePath + name + ".dat", FileMode.Open);
             results = (EntityProperties)serializer.Deserialize(stream);
             stream.Close();
         }
         else
         {
             throw new Exception("That load file was not found!\nFile: " + absolutePath + name + ".dat");
         }
     }
     catch (IOException ex)
     {
         Debug.WriteLine(ex.StackTrace);
     }
     return results;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Saves the player's data
 /// </summary>
 /// <param name="properties"></param>
 public static bool SavePlayerData(EntityProperties properties)
 {
     try
     {
         var stream = File.Create(absolutePath + properties.Name + ".dat");
         serializer.Serialize(stream, properties);
         stream.Close();
         return true;
     }
     catch (IOException ex)
     {
         Debug.WriteLine(ex.StackTrace);
         return false;
     }
 }