Beispiel #1
0
        private void AddBtnClick(object sender, EventArgs e)
        {
            TerrainGob gob     = (TerrainGob)m_cmboxTerrain.SelectedItem;
            ListBox    listbox = GetActiveList();

            if (gob == null)
            {
                return;
            }
            ImageData hmImg = gob.GetSurface();

            using (var dlg = new CreateTerrainMapDlg(Globals.ResourceRoot.LocalPath, hmImg.Width, hmImg.Height))
            {
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    if (listbox == m_layerList)
                    {
                        LayerMap map = LayerMap.Create(new Uri(dlg.Mask));
                        map.Name = dlg.MapName;
                        GameContext.As <ITransactionContext>().DoTransaction(() =>
                        {
                            gob.LayerMaps.Add(map);
                        }, "Add LayerMap");
                    }
                    else if (listbox == m_decoList)
                    {
                        DecorationMap map = DecorationMap.Create(new Uri(dlg.Mask));
                        map.Name = dlg.MapName;
                        GameContext.As <ITransactionContext>().DoTransaction(() =>
                        {
                            gob.DecorationMaps.Add(map);
                        }, "Add DecorationMap");
                    }
                }
            }
        }
        private void AddBtnClick(object sender, EventArgs e)
        {
            TerrainGob gob = (TerrainGob)m_cmboxTerrain.SelectedItem;
            ListBox listbox = GetActiveList();
            if (gob == null) return;
            ImageData hmImg = gob.GetSurface();

            using (var dlg = new CreateTerrainMapDlg(Globals.ResourceRoot.LocalPath, hmImg.Width, hmImg.Height))
            {
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    if (listbox == m_layerList)
                    {
                        LayerMap map = LayerMap.Create(new Uri(dlg.Mask));
                        map.Name = dlg.MapName;
                        GameContext.As<ITransactionContext>().DoTransaction(() =>
                        {
                            gob.LayerMaps.Add(map);
                        }, "Add LayerMap");
                    }
                    else if (listbox == m_decoList)
                    {
                        DecorationMap map = DecorationMap.Create(new Uri(dlg.Mask));
                        map.Name = dlg.MapName;
                        GameContext.As<ITransactionContext>().DoTransaction(() =>
                        {
                            gob.DecorationMaps.Add(map);
                        }, "Add DecorationMap");

                    }
                }
            }
        }