private static void SaveCameraInfo(ref SaveWriter sw) { sw.WriteLine("2"); //scale sw.WriteLine("0"); //centerX sw.WriteLine("0"); //centerY sw.WriteLine("0"); //boundsX sw.WriteLine("0"); //boundsY sw.WriteLine("-1"); //boundsW sw.WriteLine("-1"); //boundsH }
private static void saveAllLevels(String filename) { try { datas.Clear(); Components.ComponentsManager.PreSave(); Components.ComponentsManager.SaveAll(); Components.ComponentsManager.PostSave(); SaveWriter sw = new SaveWriter(filename); sw.WriteLine(SavesVersion); SaveCameraInfo(ref sw); sw.WriteLine("l"); Graphics.GUI.GUIEngine.s_levelSelection.WriteSaveInfo(ref sw); Logics.LevelEngine.Save(ref sw); Logics.PlacableAreasManager.Save(ref sw); for (int i = 0; i < datas.Count; i++) { datas[i].Compile(); datas[i].WriteToFile(sw); } sw.Close(); var sww = new SaveWriter(filename.Substring(0, filename.Length - 3) + "lua"); sww.Write(((char)8).ToString() + MicroWorld.Graphics.GUI.GUIEngine.s_scriptEditor.Text); sww.Close(); sww.Dispose(); sw.Dispose(); } catch (Exception e) { Graphics.GUI.Scene.OKMessageBox.Show("Error occured during saving.\r\nGame has not been saved."); IO.Log.Write(e, 0, false, false); } GlobalEvents.OnLevelSaved(); }
private static void saveAllDefault(String filename) { try { datas.Clear(); Components.ComponentsManager.PreSave(); Components.ComponentsManager.SaveAll(); Components.ComponentsManager.PostSave(); SaveWriter sw = new SaveWriter(filename); sw.WriteLine(SavesVersion); SaveCameraInfo(ref sw); Logics.PlacableAreasManager.Save(ref sw); for (int i = 0; i < datas.Count; i++) { datas[i].Compile(); datas[i].WriteToFile(sw); } sw.Close(); sw.Dispose(); } catch (Exception e) { Graphics.GUI.Scene.OKMessageBox.Show("Error occured during saving.\r\nGame has not been saved."); IO.Log.Write(e, 0, false, false); try { if (System.IO.File.Exists(filename)) { System.IO.File.Delete(filename); } } catch { } } GlobalEvents.OnLevelSaved(); }
internal static void Save(ref SaveWriter sw) { String r = ""; foreach (var rec in areas) { r = r + rec.X.ToString() + ";" + rec.Y.ToString() + ";" + rec.Width.ToString() + ";" + rec.Height.ToString() + "\r\n"; } sw.WriteLine(r.Length.ToString()); sw.WriteLine(r); }
private static void SaveCameraInfo(ref SaveWriter sw) { sw.WriteLine("2");//scale sw.WriteLine("0");//centerX sw.WriteLine("0");//centerY sw.WriteLine("0");//boundsX sw.WriteLine("0");//boundsY sw.WriteLine("-1");//boundsW sw.WriteLine("-1");//boundsH }
private static void saveAllDefault(String filename) { try { datas.Clear(); Components.ComponentsManager.PreSave(); Components.ComponentsManager.SaveAll(); Components.ComponentsManager.PostSave(); SaveWriter sw = new SaveWriter(filename); sw.WriteLine(SavesVersion); SaveCameraInfo(ref sw); Logics.PlacableAreasManager.Save(ref sw); for (int i = 0; i < datas.Count; i++) { datas[i].Compile(); datas[i].WriteToFile(sw); } sw.Close(); sw.Dispose(); } catch (Exception e) { Graphics.GUI.Scene.OKMessageBox.Show("Error occured during saving.\r\nGame has not been saved."); IO.Log.Write(e, 0, false, false); try { if (System.IO.File.Exists(filename)) System.IO.File.Delete(filename); } catch { } } GlobalEvents.OnLevelSaved(); }