Esempio n. 1
0
        /// <summary>
        /// Button on create map
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonCreateFrmClone_Click(object sender, EventArgs e)
        {
            if (numericUpDown1.Value == -1)
            {
                return;
            }

            long   mapid              = (long)numericUpDown1.Value;         // should be int, but anyway in case the future version uses more than 2.1b
            string mapId_str          = mapid.ToString();
            string mapId_PaddingZeros = mapId_str.PadLeft(9, '0') + ".img"; // 100000000.img.xml
            string mapcat             = "Map" + mapId_PaddingZeros.Substring(0, 1);

            WzDirectory directory = Program.WzManager.FindMapWz(mapcat);
            WzImage     mapImage  = (WzImage)directory[mapId_PaddingZeros];

            if (mapImage == null)
            {
                MessageBox.Show("Map is null.");
                return;
            }

            WzSubProperty strMapProp        = WzInfoTools.GetMapStringProp(mapId_str);
            string        cloneMapName      = WzInfoTools.GetMapName(strMapProp);
            string        cloneStreetName   = WzInfoTools.GetMapStreetName(strMapProp);
            string        cloneCategoryName = WzInfoTools.GetMapCategoryName(strMapProp);

            MapLoader.CreateMapFromImage(-1 /*mapid*/, mapImage.DeepClone(), cloneMapName, cloneStreetName, cloneCategoryName, (WzSubProperty)strMapProp.DeepClone(), Tabs, multiBoard, rightClickHandler);

            Close();
        }