Beispiel #1
0
        private void OnClickCopy(object sender, EventArgs e)
        {
            if (listBoxSec.SelectedIndex == -1)
            {
                return;
            }

            int i = int.Parse(listBoxSec.Items[listBoxSec.SelectedIndex].ToString());

            if (!SecondArt.IsValidLand(i))
            {
                return;
            }

            Bitmap copy = new Bitmap(SecondArt.GetLand(i));

            Art.ReplaceLand(i, copy);
            Options.ChangedUltimaClass["Art"] = true;
            ControlEvents.FireLandTileChangeEvent(this, i);
            _mCompare[i] = true;
            listBoxOrg.BeginUpdate();
            bool done = false;

            for (int id = 0; id < 0x4000; id++)
            {
                if (id > i)
                {
                    listBoxOrg.Items.Insert(id, i);
                    done = true;
                    break;
                }
                if (id == i)
                {
                    done = true;
                    break;
                }
            }
            if (!done)
            {
                listBoxOrg.Items.Add(i);
            }

            listBoxOrg.EndUpdate();
            listBoxOrg.Invalidate();
            listBoxSec.Invalidate();
            OnIndexChangedOrg(this, null);
        }
Beispiel #2
0
        private void OnClickReplace(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count != 1)
            {
                return;
            }

            using (OpenFileDialog dialog = new OpenFileDialog())
            {
                dialog.Multiselect     = false;
                dialog.Title           = "Choose image file to replace";
                dialog.CheckFileExists = true;
                dialog.Filter          = "Image files (*.tif;*.tiff;*.bmp)|*.tif;*.tiff;*.bmp";

                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                Bitmap bmp = new Bitmap(dialog.FileName);
                if (bmp.Height != 44 || bmp.Width != 44)
                {
                    MessageBox.Show("Height or Width Invalid", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                    return;
                }
                if (dialog.FileName.Contains(".bmp"))
                {
                    bmp = Utils.ConvertBmp(bmp);
                }

                int id = (int)listView1.SelectedItems[0].Tag;
                if (id == -1)
                {
                    listView1.SelectedItems[0].Tag = id = listView1.SelectedItems[0].Index;
                }

                Art.ReplaceLand(id, bmp);
                ControlEvents.FireLandTileChangeEvent(this, id);
                listView1.Invalidate();
                Options.ChangedUltimaClass["Art"] = true;
            }
        }
        public override void Import(bool direct, ref Dictionary <string, bool> changedClasses)
        {
            if (!Remove)
            {
                Bitmap import = new Bitmap(File);
                if (File.Contains(".bmp"))
                {
                    import = Utils.ConvertBmp(import);
                }
                Ultima.Art.ReplaceLand(Index, import);
            }
            else
            {
                Ultima.Art.RemoveLand(Index);
            }

            if (!direct)
            {
                ControlEvents.FireLandTileChangeEvent(this, Index);
                Options.ChangedUltimaClass["Art"] = true;
            }

            changedClasses["Art"] = true;
        }