Esempio n. 1
0
        public static LayerMap Create(Uri maskuri)
        {
            DomNode node = new DomNode(Schema.layerMapType.Type);

            node.SetAttribute(Schema.layerMapType.maskAttribute, maskuri);
            node.InitializeExtensions();
            LayerMap map = node.As <LayerMap>();

            map.Name = "LayerMap";
            return(map);
        }
Esempio n. 2
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");
                    }
                }
            }
        }