示例#1
0
        private void loadButton_Click(object sender, EventArgs e)
        {
            //Hide();
            WaitWindow ww = new WaitWindow("Loading...");
            ww.Show();
            Application.DoEvents();

            MapLoader loader = new MapLoader();
            WzImage mapImage = null;
            string mapName = null, streetName = "", categoryName = "";
            WzSubProperty strMapProp = null;
            if (HAMSelect.Checked)
            {
                loader.CreateMapFromHam(multiBoard, Tabs, File.ReadAllText(HAMBox.Text), rightClickHandler);
                DialogResult = DialogResult.OK;
                ww.EndWait();
                Close();
                return;
            }
            else if (XMLSelect.Checked)
            {
                try
                {
                    mapImage = (WzImage)new WzXmlDeserializer(false, null).ParseXML(XMLBox.Text)[0];
                }
                catch
                {
                    Warning.Error("Error while loading XML. Aborted.");
                    ww.EndWait();
                    Show();
                    return;
                }
            }
            else if (WZSelect.Checked)
            {
                if (mapBrowser.SelectedItem == "MapLogin")
                {
                    mapImage = (WzImage)Program.WzManager["ui"]["MapLogin.img"];
                    mapName = streetName = categoryName = "MapLogin";
                }
                else if (mapBrowser.SelectedItem == "MapLogin1")
                {
                    mapImage = (WzImage)Program.WzManager["ui"]["MapLogin1.img"];
                    mapName = streetName = categoryName = "MapLogin1";
                }
                else if (mapBrowser.SelectedItem == "CashShopPreview")
                {
                    mapImage = (WzImage)Program.WzManager["ui"]["CashShopPreview.img"];
                    mapName = streetName = categoryName = "CashShopPreview";
                }
                else
                {
                    string mapid = mapBrowser.SelectedItem.Substring(0, 9);
                    string mapcat = "Map" + mapid.Substring(0, 1);
                    mapImage = (WzImage)Program.WzManager["map"]["Map"][mapcat][mapid + ".img"];
                    strMapProp = WzInfoTools.GetMapStringProp(mapid);
                    mapName = WzInfoTools.GetMapName(strMapProp);
                    streetName = WzInfoTools.GetMapStreetName(strMapProp);
                    categoryName = WzInfoTools.GetMapCategoryName(strMapProp);
                }
            }
            loader.CreateMapFromImage(mapImage, mapName, streetName, categoryName, strMapProp, Tabs, multiBoard, rightClickHandler);
            DialogResult = DialogResult.OK;
            ww.EndWait();
            Close();
        }
示例#2
0
        private void LoadButton_Click(object sender, EventArgs e)
        {
            //Hide();
            WaitWindow ww = new WaitWindow("Loading...");

            ww.Show();
            Application.DoEvents();

            WzImage       mapImage = null;
            int           mapid = -1;
            string        mapName = null, streetName = "", categoryName = "";
            WzSubProperty strMapProp = null;


            if (HAMSelect.Checked)
            {
                MapLoader.CreateMapFromHam(multiBoard, Tabs, File.ReadAllText(HAMBox.Text), rightClickHandler);
                DialogResult = DialogResult.OK;
                ww.EndWait();
                Close();
                return;
            }
            else if (XMLSelect.Checked)
            {
                try
                {
                    mapImage = (WzImage) new WzXmlDeserializer(false, null).ParseXML(XMLBox.Text)[0];
                }
                catch
                {
                    MessageBox.Show("Error while loading XML. Aborted.");
                    ww.EndWait();
                    Show();
                    return;
                }
            }
            else if (WZSelect.Checked)
            {
                string selectedName = mapBrowser.SelectedItem;

                if (selectedName.StartsWith("MapLogin")) // MapLogin, MapLogin1, MapLogin2, MapLogin3
                {
                    mapImage = (WzImage)Program.WzManager["ui"][selectedName + ".img"];
                    mapName  = streetName = categoryName = selectedName;
                }
                else if (mapBrowser.SelectedItem == "CashShopPreview")
                {
                    mapImage = (WzImage)Program.WzManager["ui"]["CashShopPreview.img"];
                    mapName  = streetName = categoryName = "CashShopPreview";
                }
                else
                {
                    string mapid_str = mapBrowser.SelectedItem.Substring(0, 9);
                    int.TryParse(mapid_str, out mapid);

                    string mapcat = "Map" + mapid_str.Substring(0, 1);

                    WzDirectory directory = Program.WzManager.FindMapWz(mapcat);
                    mapImage = (WzImage)directory[mapid_str + ".img"];

                    strMapProp   = WzInfoTools.GetMapStringProp(mapid_str);
                    mapName      = WzInfoTools.GetMapName(strMapProp);
                    streetName   = WzInfoTools.GetMapStreetName(strMapProp);
                    categoryName = WzInfoTools.GetMapCategoryName(strMapProp);
                }
            }
            MapLoader.CreateMapFromImage(mapid, mapImage, mapName, streetName, categoryName, strMapProp, Tabs, multiBoard, rightClickHandler);

            DialogResult = DialogResult.OK;
            ww.EndWait();
            Close();
        }
 void ribbon_HaRepackerClicked()
 {
     WaitWindow ww = new WaitWindow("Opening HaRepacker...");
     ww.Show();
     Application.DoEvents();
     HaRepacker.Program.WzMan = new HaRepackerLib.WzFileManager();
     bool firstRun = HaRepacker.Program.PrepareApplication(false);
     HaRepacker.GUI.MainForm mf = new HaRepacker.GUI.MainForm(null, false, firstRun);
     mf.unloadAllToolStripMenuItem.Visible = false;
     mf.reloadAllToolStripMenuItem.Visible = false;
     foreach (KeyValuePair<string, WzFile> entry in Program.WzManager.wzFiles)
         mf.Interop_AddLoadedWzFileToManager(entry.Value);
     ww.EndWait();
     lock (multiBoard)
     {
         mf.ShowDialog();
     }
     HaRepacker.Program.EndApplication(false, false);
 }
示例#4
0
        private void loadButton_Click(object sender, EventArgs e)
        {
            //Hide();
            WaitWindow ww = new WaitWindow("Loading...");

            ww.Show();
            Application.DoEvents();

            MapLoader     loader = new MapLoader();
            WzImage       mapImage = null;
            string        mapName = null, streetName = "", categoryName = "";
            WzSubProperty strMapProp = null;

            if (HAMSelect.Checked)
            {
                loader.CreateMapFromHam(multiBoard, Tabs, File.ReadAllText(HAMBox.Text), rightClickHandler);
                DialogResult = DialogResult.OK;
                ww.EndWait();
                Close();
                return;
            }
            else if (XMLSelect.Checked)
            {
                try
                {
                    mapImage = (WzImage) new WzXmlDeserializer(false, null).ParseXML(XMLBox.Text)[0];
                }
                catch
                {
                    Warning.Error("Error while loading XML. Aborted.");
                    ww.EndWait();
                    Show();
                    return;
                }
            }
            else if (WZSelect.Checked)
            {
                if (mapBrowser.SelectedItem == "MapLogin")
                {
                    mapImage = (WzImage)Program.WzManager["ui"]["MapLogin.img"];
                    mapName  = streetName = categoryName = "MapLogin";
                }
                else if (mapBrowser.SelectedItem == "MapLogin1")
                {
                    mapImage = (WzImage)Program.WzManager["ui"]["MapLogin1.img"];
                    mapName  = streetName = categoryName = "MapLogin1";
                }
                else if (mapBrowser.SelectedItem == "CashShopPreview")
                {
                    mapImage = (WzImage)Program.WzManager["ui"]["CashShopPreview.img"];
                    mapName  = streetName = categoryName = "CashShopPreview";
                }
                else
                {
                    string mapid  = mapBrowser.SelectedItem.Substring(0, 9);
                    string mapcat = "Map" + mapid.Substring(0, 1);
                    mapImage     = (WzImage)Program.WzManager["map"]["Map"][mapcat][mapid + ".img"];
                    strMapProp   = WzInfoTools.GetMapStringProp(mapid);
                    mapName      = WzInfoTools.GetMapName(strMapProp);
                    streetName   = WzInfoTools.GetMapStreetName(strMapProp);
                    categoryName = WzInfoTools.GetMapCategoryName(strMapProp);
                }
            }
            loader.CreateMapFromImage(mapImage, mapName, streetName, categoryName, strMapProp, Tabs, multiBoard, rightClickHandler);
            DialogResult = DialogResult.OK;
            ww.EndWait();
            Close();
        }
 void multiBoard_ImageDropped(Board selectedBoard, System.Drawing.Bitmap bmp, string name, Microsoft.Xna.Framework.Point pos)
 {
     WaitWindow ww = new WaitWindow("Processing \"" + name + "\"...");
     ww.Show();
     Application.DoEvents();
     ObjectInfo oi = null;
     try
     {
         oi = multiBoard.UserObjects.Add(bmp, name);
     }
     catch (NameAlreadyUsedException)
     {
         MessageBox.Show("\"" + name + "\" could not be added because an object with the same name already exists.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     finally
     {
         ww.EndWait();
     }
     selectedBoard.BoardItems.Add(oi.CreateInstance(selectedBoard.SelectedLayer, selectedBoard, pos.X, pos.Y, 0, false), true);
     objPanel.OnL1Changed(UserObjectsManager.l1);
 }