Esempio n. 1
0
        UcMapEditor CreateNewMapAndTab(Map pPrototype)
        {
            using (FrmNewMap vFrm = new FrmNewMap(pPrototype)) {
                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;
                    vME.LibraryList = this.ucLibView;
                    vTP.Controls.Add(vME);
                    vME.Dock = DockStyle.Fill;
                    tabMaps.TabPages.Add(vTP);
                    tabMaps.SelectedTab = vTP;

                    vME.NewMap       += new EventHandler(MapEditor_NewMap);
                    vME.DuplicateMap += new EventHandler(MapEditor_DuplicateMap);

                    return(vME);
                }
                return(null);
            }
        }
Esempio n. 2
0
        /// <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.");
        }
Esempio n. 3
0
        void MapEditor_DuplicateMap(object sender, EventArgs e)
        {
            //not a fan of doing like that but too lazy to do it right
            Map         vOriginalMap = (tabMaps.SelectedTab.Controls[0] as UcMapEditor).CurrentMap;
            UcMapEditor vME          = CreateNewMapAndTab(vOriginalMap);

            //copy old to new
            if (vME != null)
            {
                vME.CurrentMap.Duplicate(vOriginalMap);
            }
        }
Esempio n. 4
0
        private void LoadGbProject()
        {
            ucLibView.SetLibrary(mCurrentProject.mLibraries[0]);
            tabMaps.TabPages.Clear();
            foreach (Map vM in this.mCurrentProject.mMaps)
            {
                TabPage     vTP = new TabPage(vM.Name);
                UcMapEditor vME = new UcMapEditor();
                vME.CurrentMap  = vM;
                vME.CurrentTile = ucLibView.SelectedTile;
                vME.LibraryList = this.ucLibView;
                vTP.Controls.Add(vME);
                vME.Dock = DockStyle.Fill;
                tabMaps.TabPages.Add(vTP);
                tabMaps.SelectedTab = vTP;

                vME.NewMap       += new EventHandler(MapEditor_NewMap);
                vME.DuplicateMap += new EventHandler(MapEditor_DuplicateMap);
            }
        }
Esempio n. 5
0
        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);
                }
            }
        }