private void CreateNewMapAndTab() { using (FrmNewMap vFrm = new FrmNewMap()) { if (DialogResult.OK == vFrm.ShowDialog(this)) { Map vNew = new Map(vFrm.CreateWidth, vFrm.CreateHeight); vNew.Name = vFrm.CreateName; this.mCurrentProject.AddMap(vNew); TabPage vTP = new TabPage(vNew.Name); UcMapEditor vME = new UcMapEditor(); vME.CurrentMap = vNew; vME.CurrentTile = ucLibView.SelectedTile; vTP.Controls.Add(vME); vME.Dock = DockStyle.Fill; tabMaps.TabPages.Add(vTP); tabMaps.SelectedTab = vTP; vME.NewMap += new EventHandler(MapEditor_NewMap); } } }
/// <summary> /// Loads a GB project /// </summary> private void LoadGbProject(string pFilename) { SetStatus("Loading project " + pFilename + " ..."); try { //StartEmptyNewProject(); this.mCurrentProject = GbProject.LoadFromFile(pFilename); this.mCurrentProject.LatestKnownFilename = pFilename; } catch (Exception) { StartEmptyNewProject(); } ucLibView.SetLibrary(mCurrentProject.mLibraries[0]); foreach (Map vM in this.mCurrentProject.mMaps) { TabPage vTP = new TabPage(vM.Name); UcMapEditor vME = new UcMapEditor(); vME.CurrentMap = vM; vME.CurrentTile = ucLibView.SelectedTile; vTP.Controls.Add(vME); vME.Dock = DockStyle.Fill; tabMaps.TabPages.Add(vTP); tabMaps.SelectedTab = vTP; vME.NewMap += new EventHandler(MapEditor_NewMap); } SetStatus("Loading project " + pFilename + " completed."); }