private void FileNew() { bool drCancel = false; if (bFileIsChanged) { DialogResult dr = MessageBox.Show("File is changed, do you want to save?", "File is changed", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { this.FileSave(); } else if (dr == DialogResult.Cancel) { drCancel = true; } } if (!drCancel) { lstBlocks.Clear(); lstItems.Clear(); levelInfo.Clear(); lstMaterial.Clear(); // Read standard materials MaterialReader matReader = new MaterialReader(); foreach(Material m in matReader.GetMaterialList()) { this.lstMaterial.Add(m); } sFileName = "untitled"; sFilePath = ""; bFileIsSaved = false; bFileIsChanged = false; this.RedrawBlocks(); this.RedrawItems(); this.RedrawTemp(); this.UpdateTitle(); } this.UpdateProperties(); }
public void MapEditor_Load(System.Object sender, System.EventArgs e) { //- Show splash in separate thread Thread tStartSplash; tStartSplash = new Thread(new System.Threading.ThreadStart(this.ShowSplash)); tStartSplash.Start(); //- Load Application Settings appSettings.LoadSettings(); this.entReader = new EntitiesReader(); this.lstEntities = entReader.GetEntityList(); this.UpdateEntitiesMenu(); MaterialReader matReader = new MaterialReader(); this.lstMaterial = matReader.GetMaterialList(); // - Initialize level exporter levelExporter = new Exporter(lstBlocks, lstItems, lstEntities, lstMaterial, levelInfo); //- Set application title this.Text = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.Title + " - " + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.Version.Major + "." + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.Version.Minor; //- Connect SDL Surfaces to the classes viewXY = new View2D(scXY, "XY", lstBlocks, lstItems, appSettings.GridSize,layerStatus); viewZY = new View2D(scZY, "ZY", lstBlocks, lstItems, appSettings.GridSize,layerStatus); viewXZ = new View2D(scXZ, "XZ", lstBlocks, lstItems, appSettings.GridSize,layerStatus); this.glView1.Connect(lstBlocks, lstItems, appSettings.GridSize,lstMaterial); //- Initialize SDL SdlDotNet.Core.Events.Fps = appSettings.FpsLimit; tSDLRun = new Thread(new System.Threading.ThreadStart(SdlDotNet.Core.Events.Run)); tSDLRun.IsBackground = true; tSDLRun.Name = "SDL.NET"; tSDLRun.Priority = ThreadPriority.Normal; tSDLRun.Start(); //- Initialize new file FileNew(); tsbSelectMove_Click(this,null); }