Пример #1
0
        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();
        }
Пример #2
0
        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();
        }
Пример #3
0
        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();
        }
Пример #4
0
        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();
        }