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

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

            map.Name = "DecorationMap";
            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");
                    }
                }
            }
        }