public UserControl2() { InitializeComponent(); this.Hide(); color4 = System.Drawing.Color.Black; imagefond = string.Empty; this.width = Screen.PrimaryScreen.Bounds.Width; this.height = Screen.PrimaryScreen.Bounds.Height; IHave_control = false; seconde = 0; filepath = string.Empty; sauve = new Sauveguarde(); savefile = new savefile(); savefile.ia_Kamikaze = new List<couple>(); savefile.ia_tireur = new List<quaintuplet>(); savefile.ia_viseur = new List<quaintuplet>(); savefile.levelProfile = new levelProfile(); savefile.bonus = new List<Bonus>(); subdirectory = new List<string>(); type = "SEU"; Initialize(); //8,9,14,16 scrollingM = new Scrolling_ManagerV(new Microsoft.Xna.Framework.Rectangle(0, 0, width, height)); openF = false; playlist = new string[4] { "", "", "", "" }; }
/// <summary> ///jeu level perso chargement /// </summary> /// <param name="level">nom du niveau</param> /// <param name="iamanage_K">manager de ia</param> /// <param name="iamanage_T"></param> /// <param name="iamanage_V"></param> public void load_leveleditor_SEU(ContentManager Content, string level, ref IA_manager_K iamanage_K, ref IA_manager_T iamanage_T, ref IA_manager_V iamanage_V, ref Scrolling_ManagerV scrollM, ref GraphicsDevice grap, ref sripte_V sprite, ref Ovni ovni) { savefile savefile = new savefile(); load_SEU(ref level, ref savefile); for (int j = 0; j < savefile.ia_tireur.Count; ++j) iamanage_T.Add(savefile.ia_tireur[j]); for (int j = 0; j < savefile.ia_viseur.Count; ++j) iamanage_V.Add(savefile.ia_viseur[j]); for (int j = 0; j < savefile.ia_Kamikaze.Count; ++j) iamanage_K.Add(savefile.ia_Kamikaze[j]); for (int j = 0; j < savefile.bonus.Count; ++j) ovni.Add(savefile.bonus[j]); scrollM.Load(Content, savefile.levelProfile, grap); sprite.parametrage(ref savefile.levelProfile); ovni.param(savefile.levelProfile.fc_speed); }
/// <summary> /// jeu normal chargement /// </summary> /// <param name="Content"></param> /// <param name="level">nom du nivau</param> /// <param name="iamanage_K"></param> /// <param name="iamanage_T"></param> /// <param name="iamanage_V"></param> public void load_level_SEU(ContentManager Content, ref string level, ref string next, ref IA_manager_K iamanage_K, ref IA_manager_T iamanage_T, ref IA_manager_V iamanage_V, ref Scrolling_ManagerV scrollM, ref GraphicsDevice grash, ref sripte_V sprite, ref Ovni ovni) { savefile savefil = new savefile(); FileStream file1 = null; XmlSerializer f = null; DirectoryInfo dir = null; dir = new DirectoryInfo(Content.RootDirectory + "\\" + level); if (dir.Exists) { file1 = new FileStream(dir.FullName + "\\level.lvl", FileMode.Open, FileAccess.Read); f = new XmlSerializer(typeof(savefile)); savefil = (savefile)f.Deserialize(file1); file1.Close(); } for (int j = 0; j < savefil.ia_tireur.Count; ++j) iamanage_T.Add(savefil.ia_tireur[j]); for (int j = 0; j < savefil.ia_viseur.Count; ++j) iamanage_V.Add(savefil.ia_viseur[j]); for (int j = 0; j < savefil.ia_Kamikaze.Count; ++j) iamanage_K.Add(savefil.ia_Kamikaze[j]); for (int j = 0; j < savefil.bonus.Count; ++j) ovni.Add(savefil.bonus[j]); scrollM.Load(Content, savefil.levelProfile, grash); sprite.parametrage(ref savefil.levelProfile); ovni.param(savefil.levelProfile.fc_speed); next = savefil.levelProfile.next_level; }
/// <summary> /// save sEU pour editeur de map pas fini manque la copie du fond ds le dossier /// </summary> /// <param name="save"></param> public void save_SEU(ref savefile save) { FileStream file1 = null; XmlSerializer f = null; string sav = path + "\\SEU\\" + save.levelProfile.levelname; DirectoryInfo dir = new DirectoryInfo(sav); string ext = "", nam = "", name = ""; string[] res = new string[save.levelProfile.musique.Length]; if (!dir.Exists) dir.Create(); for (int j = 0; j < save.levelProfile.background_name.Length; ++j) { if (save.levelProfile.background_name[j] == '.') ext = ""; nam += save.levelProfile.background_name[j]; ext += save.levelProfile.background_name[j]; if (save.levelProfile.background_name[j] == '\\') nam = ""; } // copie de backgroung et verif k il n est pas ds le dossier for (int j = 0; j < nam.Length && nam[j] != '.'; ++j) name += nam[j]; if (name != "BackgrounD") System.IO.File.Copy(save.levelProfile.background_name, sav + "\\BackgrounD" + ext, true); save.levelProfile.background_name = "BackgrounD" + ext; // copie des musique + verif pas ds le dossier for (int w = 0; w < res.Length; w++) { for (int j = 0; j < save.levelProfile.musique[w].Length; ++j) { res[w] += save.levelProfile.musique[w][j]; if (save.levelProfile.musique[w][j] == '\\') res[w] = ""; } if (save.levelProfile.musique[w] != null && save.levelProfile.musique[w] != "") { System.IO.File.Copy(save.levelProfile.musique[w], sav + "\\" + res[w], true); save.levelProfile.musique[w] = res[w]; } } file1 = new FileStream(dir.FullName + "\\level.lvl", FileMode.Create, FileAccess.Write); f = new XmlSerializer(typeof(savefile)); f.Serialize(file1, save); file1.Close(); }
/// <summary> /// pour shot em up a utilier ds l editeur de map /// </summary> /// <param name="filename"></param> /// <param name="savefile"></param> public void load_SEU(ref string filename, ref savefile savefile) { FileStream file1 = null; XmlSerializer f = null; DirectoryInfo dir = null; dir = new DirectoryInfo(path + "\\SEU\\" + filename); if (dir.Exists) { file1 = new FileStream(dir.FullName + "\\level.lvl", FileMode.Open, FileAccess.Read); f = new XmlSerializer(typeof(savefile)); savefile = (savefile)f.Deserialize(file1); file1.Close(); } }