Exemplo n.º 1
0
 internal void Show(ref int[,] ids, ref List <ColorNote> colors)
 {
     if (ids.GetLength(0) > 128 * maxImage || ids.GetLength(1) > 128 * maxImage)
     {
         MessageBox.Show(Lang.GetHint("BigImageError"), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Close();
         return;
     }
     this.colors = colors;
     blockMap    = ids;
     LoadTextures();
     pictureBox1.Image  = new Bitmap(ids.GetLength(0) * blockSize, ids.GetLength(1) * blockSize);
     pictureBox1.Width  = ids.GetLength(0) * blockSize;
     pictureBox1.Height = ids.GetLength(1) * blockSize;
     CreateImage();
     originalImage = pictureBox1.Image;
     PrintMesh(pictureBox1.Image);
     PrintChunkMesh(pictureBox1.Image);
     PrintMapMesh(pictureBox1.Image);
     Show();
     if (!Properties.Settings.Default.HideTips)
     {
         MessageBox.Show(Lang.GetHint("TopTopMostHint"), "Hint", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 2
0
 internal void Show(ref SettedBlock[,] blockMap, int maxHeight, ref List <ColorNote> colors)
 {
     if (blockMap.GetLength(0) > 129 * maxImage || blockMap.GetLength(1) > 129 * maxImage)
     {
         MessageBox.Show(Lang.GetHint("BigImageError"), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Close();
         return;
     }
     this.colors    = colors;
     this.blockMap  = blockMap;
     this.maxHeight = maxHeight;
     LoadTextures();
     pictureBox1.Image = CreateLayer(0);
     label3.Text      += maxHeight;
     Show();
     FormCrossView_Resize(null, null);
 }
Exemplo n.º 3
0
 private void CreateButton_Click(object sender, EventArgs e)
 {
     progressBar1.Maximum = (rawImage.Width * rawImage.Height) / 128;
     progressBar1.Value   = 0;
     startTime            = DateTime.Now;
     convertTask?.Abort();
     convertTask = new Thread(() =>
     {
         ArtGenerator gen = new ArtGenerator(ref colorsNote);
         gen.SetProgress(progressBar1);
         gen.SetStateLabel(label4);
         gen.Done += () =>
         {
             label4.BeginInvoke(new Action(() => { label4.Text = DateTime.Now.Subtract(startTime).ToString(); }));
             FinalImageButton.BeginInvoke(new Action(() => { FinalImageButton.Enabled = true; }));
             TopViewButton.BeginInvoke(new Action(() => { TopViewButton.Enabled = true; }));
             CrossViewButton.BeginInvoke(new Action(() => { CrossViewButton.Enabled = true; }));
             UsedMaterialsButton.BeginInvoke(new Action(() => { UsedMaterialsButton.Enabled = true; }));
             SchematicButton.BeginInvoke(new Action(() => { SchematicButton.Enabled = true; }));
         };
         convertedImage = (Image)rawImage.Clone();
         ArtType type   = ArtType.Flat;
         if (radioButton2.Checked)
         {
             type = ArtType.Lite;
         }
         else if (radioButton3.Checked)
         {
             type = ArtType.Full;
         }
         blockMap          = gen.CreateScheme(ref convertedImage, type, out maxHeight);
         pictureBox1.Image = convertedImage;
         GC.Collect();
         if (maxHeight > 250)
         {
             MessageBox.Show(Lang.GetHint("UnbuildArt").Replace("{0}", maxHeight.ToString()), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else if (maxHeight > 150)
         {
             MessageBox.Show(Lang.GetHint("TooHeightArt").Replace("{0}", maxHeight.ToString()), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         label4.BeginInvoke(new Action(() => label4.Text += $" Max={maxHeight}"));
     });
     convertTask.Start();
 }
Exemplo n.º 4
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         try { originalImage = Image.FromFile(openFileDialog1.FileName); }
         catch (Exception ex)
         {
             if (MessageBox.Show(Lang.GetHint("NoImage"), "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
             {
                 MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK);
             }
             return;
         }
         if (!checkBox1.Checked)
         {
             if (originalImage.Width < 128 || originalImage.Height < 128)
             {
                 rawImage = new Bitmap(originalImage, 128, 128);
             }
             else
             {
                 rawImage = new Bitmap(originalImage, originalImage.Width - (originalImage.Width % 128), originalImage.Height - (originalImage.Height % 128));
             }
             textBox1.Text = (rawImage.Width / 128).ToString();
             textBox2.Text = (rawImage.Height / 128).ToString();
         }
         else
         {
             rawImage      = originalImage;
             textBox1.Text = rawImage.Width.ToString();
             textBox2.Text = rawImage.Height.ToString();
         }
         pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
         pictureBox1.Image    = rawImage;
         CreateButton.Enabled = true;
         GC.Collect();
     }
 }
Exemplo n.º 5
0
 private void FormMain_DragDrop(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent(DataFormats.FileDrop) && e.Effect == DragDropEffects.Move)
     {
         try { originalImage = Image.FromFile(((string[])e.Data.GetData(DataFormats.FileDrop))[0]); }
         catch (Exception ex)
         {
             if (MessageBox.Show(Lang.GetHint("NoImage"), "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
             {
                 MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK);
             }
             return;
         }
     }
     if (!checkBox1.Checked)
     {
         if (originalImage.Width < 128 || originalImage.Height < 128)
         {
             rawImage = new Bitmap(originalImage, 128, 128);
         }
         else
         {
             rawImage = new Bitmap(originalImage, originalImage.Width - (originalImage.Width % 128), originalImage.Height - (originalImage.Height % 128));
         }
         textBox1.Text = (rawImage.Width / 128).ToString();
         textBox2.Text = (rawImage.Height / 128).ToString();
     }
     else
     {
         rawImage      = originalImage;
         textBox1.Text = rawImage.Width.ToString();
         textBox2.Text = rawImage.Height.ToString();
     }
     pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
     pictureBox1.Image    = rawImage;
     CreateButton.Enabled = true;
 }
Exemplo n.º 6
0
 private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     MessageBox.Show(Lang.GetHint("MixedHeightDesc"), "Help", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
Exemplo n.º 7
0
 private void buttonNext_MouseEnter(object sender, EventArgs e)
 {
     isOnControl      = true;
     textBoxHint.Text = Lang.GetHint("CrossNextButton");
     ShowHint();
 }
Exemplo n.º 8
0
 private void label3_MouseEnter(object sender, EventArgs e)
 {
     isOnControl      = true;
     textBoxHint.Text = Lang.GetHint("CrossMaxHeight");
     ShowHint();
 }
Exemplo n.º 9
0
 private void checkBox1_MouseEnter(object sender, EventArgs e)
 {
     isOnControl      = true;
     textBoxHint.Text = Lang.GetHint("TopMost");
     ShowHint();
 }
Exemplo n.º 10
0
 private void textBox1_MouseEnter(object sender, EventArgs e)
 {
     isOnControl      = true;
     textBoxHint.Text = Lang.GetHint("CrossCurTextBox");
     ShowHint();
 }
Exemplo n.º 11
0
 private void label4_MouseEnter(object sender, EventArgs e)
 {
     isOnControl      = true;
     textBoxHint.Text = Lang.GetHint("ProgressTimer");
     ShowHint();
 }
Exemplo n.º 12
0
 private void SchematicButton_MouseEnter(object sender, EventArgs e)
 {
     isOnControl      = true;
     textBoxHint.Text = Lang.GetHint("SchemButton");
     ShowHint();
 }
Exemplo n.º 13
0
 private void UsedMaterialsButton_MouseEnter(object sender, EventArgs e)
 {
     isOnControl      = true;
     textBoxHint.Text = Lang.GetHint("MatButton");
     ShowHint();
 }
Exemplo n.º 14
0
 private void FinalImageButton_MouseEnter(object sender, EventArgs e)
 {
     isOnControl      = true;
     textBoxHint.Text = Lang.GetHint("ViewImgButton");
     ShowHint();
 }
Exemplo n.º 15
0
 private void CreateButton_MouseEnter(object sender, EventArgs e)
 {
     isOnControl      = true;
     textBoxHint.Text = Lang.GetHint("GenerateButton");
     ShowHint();
 }
Exemplo n.º 16
0
 private void radioButton3_MouseEnter(object sender, EventArgs e)
 {
     isOnControl      = true;
     textBoxHint.Text = Lang.GetHint("FullRadio");
     ShowHint();
 }