Ejemplo n.º 1
0
 public void LoadGame(zipgame zip)
 {
     HideHelpEffect();
     ComebackDefault();
     KindGame = zip.kindgame;
     Information.CurrentKindGame = zip.sumfirstpokemon;
     argument.Matrix             = zip.Matrix;
     Information.PokemonNumber   = zip.number_pokemon;
     Information.CurrentKindGame = Information.defaultPokemonNumber + (KindGame - 1) * 6;
     Score = zip.score;
     argument.RemainPokemon = zip.Remainpokemon;
     limittime.percent      = zip.percent;
     percent            = limittime.percent;
     timeplay.hour      = zip.hour;
     timeplay.minute    = zip.minute;
     timeplay.second    = zip.second;
     Level              = zip.level;
     HelpPokemonClick   = zip.helpclick;
     RandomPokemonClick = zip.randomclick;
     lifetime.Life      = zip.Lifetime;
     lifetime.Invalidate();
     SmartEye = zip.smarteye;
     templateScreen.Show();
     InitialImage();
     time.Start();
     ListHelp          = argument.FindCouple();
     Information.Level = Level;
     limittime.UpdatePercent();
     limittime.updateTime();
     PieceUpdate();
     templateScreen.Hide();
     draw           = true;
     argument.Level = Level;
     this.Invalidate();
 }
Ejemplo n.º 2
0
        //savegame
        private void button2_MouseClick(Object obj, MouseEventArgs e)
        {
            if (display.gameover == true)
            {
                return;
            }
            if (display.LockGame == true)
            {
                return;
            }
            SaveFileDialog gamesave = new SaveFileDialog();

            gamesave.Title            = "UIT Pokemon save game";
            gamesave.Filter           = "Only file (*uitp)|*uitp";
            gamesave.InitialDirectory = Information.directories;
            if (gamesave.ShowDialog() == DialogResult.OK)
            {
                zipgame zip = display.SaveGame();
                LoadSaveGame.SaveGame(zip, gamesave.FileName + ".uitp");
            }
            try
            {
                gamesave.Dispose();
                GC.Collect();
            }
            catch
            {
                // write report file
            }
        }
Ejemplo n.º 3
0
        public static zipgame LoadGame(String filename)
        {
            Stream          s      = File.Open(filename, FileMode.Open);
            BinaryFormatter binary = new BinaryFormatter();
            zipgame         zip    = (zipgame)binary.Deserialize(s);

            s.Close();
            try
            {
                GC.Collect();
            }
            catch
            {
            }
            return(zip);
        }
Ejemplo n.º 4
0
        //open game
        private void button1_MouseClick(Object obj, MouseEventArgs e)
        {
            OpenFileDialog gameload = new OpenFileDialog();

            gameload.Title            = "UIT Pokemon load game";
            gameload.Filter           = "Only file (*uitp)|*uitp";
            gameload.InitialDirectory = Information.directories;
            if (gameload.ShowDialog() == DialogResult.OK)
            {
                zipgame zip = LoadSaveGame.LoadGame(gameload.FileName);
                display.LoadGame(zip);
            }
            try
            {
                gameload.Dispose();
                GC.SuppressFinalize(gameload);
                GC.Collect();
            }
            catch { }
        }
Ejemplo n.º 5
0
 public static void SaveGame(zipgame zip, String filename)
 {
     Stream s = File.Open(filename, FileMode.Create);
     BinaryFormatter binary = new BinaryFormatter();
     try
     {
         binary.Serialize(s, zip);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Loi 7 :File khong the luu \n " + ex.Message);
     }
     s.Close();
     try
     {
         GC.Collect();
     }
     catch
     {
     }
 }
Ejemplo n.º 6
0
        public static void SaveGame(zipgame zip, String filename)
        {
            Stream          s      = File.Open(filename, FileMode.Create);
            BinaryFormatter binary = new BinaryFormatter();

            try
            {
                binary.Serialize(s, zip);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Loi 7 :File khong the luu \n " + ex.Message);
            }
            s.Close();
            try
            {
                GC.Collect();
            }
            catch
            {
            }
        }
Ejemplo n.º 7
0
        public zipgame SaveGame()
        {
            zipgame zip = new zipgame(KindGame, Information.CurrentKindGame, lifetime.Life, argument.Matrix, Level, Information.PokemonNumber, Score, argument.RemainPokemon, limittime.percent, HelpPokemonClick, RandomPokemonClick, SmartEye, timeplay.hour, timeplay.minute, timeplay.second);

            return(zip);
        }
Ejemplo n.º 8
0
 public zipgame SaveGame()
 {
     zipgame zip = new zipgame(KindGame,Information.CurrentKindGame,lifetime.Life, argument.Matrix,Level, Information.PokemonNumber, Score,argument.RemainPokemon,limittime.percent,HelpPokemonClick, RandomPokemonClick,SmartEye, timeplay.hour, timeplay.minute, timeplay.second);
     return zip;
 }
Ejemplo n.º 9
0
 public void LoadGame(zipgame zip)
 {
     HideHelpEffect();
     ComebackDefault();
     KindGame = zip.kindgame;
     Information.CurrentKindGame = zip.sumfirstpokemon;
     argument.Matrix = zip.Matrix;
     Information.PokemonNumber = zip.number_pokemon;
     Information.CurrentKindGame = Information.defaultPokemonNumber + (KindGame - 1) * 6;
     Score = zip.score;
     argument.RemainPokemon = zip.Remainpokemon;
     limittime.percent = zip.percent;
     percent = limittime.percent;
     timeplay.hour = zip.hour;
     timeplay.minute = zip.minute;
     timeplay.second = zip.second;
     Level = zip.level;
     HelpPokemonClick = zip.helpclick;
     RandomPokemonClick = zip.randomclick;
     lifetime.Life = zip.Lifetime;
     lifetime.Invalidate();
     SmartEye = zip.smarteye;
     templateScreen.Show();
     InitialImage();
     time.Start();
     ListHelp = argument.FindCouple();
     Information.Level = Level;
     limittime.UpdatePercent();
     limittime.updateTime();
     PieceUpdate();
     templateScreen.Hide();
     draw = true;
     argument.Level = Level;
     this.Invalidate();
 }