save() 공개 메소드

public save ( ) : void
리턴 void
        public static Player loadPlayer(int id, Texture2D foto)
        {
            Player player;
            Stream stream ;
            BinaryFormatter bFormatter;
            try
            {
                stream = File.Open(id.ToString() + ".player", FileMode.Open);
                bFormatter = new BinaryFormatter();
                player = (Player)bFormatter.Deserialize(stream);
                stream.Close();
            }
            // si el jugador no existe crea su ficha de nuevo jugador
            catch (System.IO.FileNotFoundException e)
            {
                e.GetType();
                player = new Player(id, foto);
                player.save();

            }
            finally
            {

            }

            return player;
        }
예제 #2
0
        public static Player loadPlayer(int id, Texture2D foto)
        {
            Player          player;
            Stream          stream;
            BinaryFormatter bFormatter;

            try
            {
                stream     = File.Open(id.ToString() + ".player", FileMode.Open);
                bFormatter = new BinaryFormatter();
                player     = (Player)bFormatter.Deserialize(stream);
                stream.Close();
            }
            // si el jugador no existe crea su ficha de nuevo jugador
            catch (System.IO.FileNotFoundException e)
            {
                e.GetType();
                player = new Player(id, foto);
                player.save();
            }
            finally
            {
            }

            return(player);
        }