Esempio n. 1
0
        private void treeView2_dat_AfterSelect(object sender, TreeViewEventArgs e)
        {
            var node = e.Node;

            if (node == null || !(node.Tag is Tuple <string, string, int>))
            {
                return;
            }
            var info = node.Tag as Tuple <string, string, int>;

            var temp = AtumZip.ZippedFile.UnzipItems(LoadingData.directory + info.Item1);

            using (var tempstream = new MemoryStream(temp[0].Data))
                _DatData = MapFormatter.Read(tempstream);


            if (info.Item2 == "base")
            {
                string temp5 = info.Item1;
                temp5             = temp5.Remove(temp5.Length - 4, 4);
                pictureBox2.Image = new Bitmap(PaintStuff.GetMapImage(LoadingData.directory + temp5 + ".map"), new Size(512, 512));
                PictureBox cc = new PictureBox();
                cc.Width  = pictureBox2.Width;
                cc.Height = pictureBox2.Height;
                Controls.Add(cc);
                Bitmap   crap = (Bitmap)pictureBox2.Image;
                Graphics g    = Graphics.FromImage(crap);
                Bitmap   ttt  = PaintStuff.GetWaterImage(_DatData);
                // g.DrawImage(ttt, 0, 0, 512, 512);
                SolidBrush sb = new SolidBrush(Color.Red);
                g.FillEllipse(sb, 20, 20, 20, 20);
                g.DrawEllipse(new Pen(Color.Red), 20, 20, 20, 20);
                pictureBox2.Refresh();
            }

            switch (info.Item2)
            {
            case "mapdata":

                var tempdt = MapFormatter.GetFormatter(0).GetSchema();
                tempdt.Rows.Add(_DatData[0] as object[]);
                dataGridView3.DataSource = tempdt;

                // dataGridView3.DataSource = MapFormatter.GetFormatter(0).GetSchema(new object[] { (_DatData[0] as object[] });

                break;

            case "vertexinfo":
                dataGridView3.DataSource = MapFormatter.GetFormatter(1).GetSchema(_DatData[1] as object[][]);
                break;

            case "tileinfo":
                dataGridView3.DataSource = MapFormatter.GetFormatter(2).GetSchema(_DatData[2] as object[][]);
                break;

            case "objectinfo":
                dataGridView3.DataSource = MapFormatter.GetFormatter(3).GetSchema(_DatData[3] as object[][]);
                break;
            }
        }
Esempio n. 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         pictureBox1.Image = new Bitmap(PaintStuff.DrawMonsterRectangles(dataGridView2), new Size(512, 512));
     }catch (Exception ex) { MessageBox.Show(ex.ToString() + "\n" + ex.StackTrace); }
 }
Esempio n. 3
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            var node = e.Node;

            if (node == null || !(node.Tag is Tuple <string, int, int>))
            {
                return;
            }
            var info = node.Tag as Tuple <string, int, int>;

            toolStripLabel2.Text = "Location: " + info.Item1 + " Map: " + info.Item2 + " Size: " + info.Item3;
            if (info.Item2 != -1)//just little handling because if u click [+]xxxx it will want to open file named -1
            {
                var source = File.OpenRead(LoadingData.directory + info.Item2 + ".sma");
                _SmaData = SmaFormatter.Read(source, (uint)info.Item3);
            }

            switch (info.Item1)
            {
            case "header":


                var tempdt = SmaFormatter.GetFormatter(0).GetSchema();
                tempdt.Rows.Add(_SmaData[0] as object[]);
                dataGridView2.DataSource = tempdt;

                //it crashes the program atm!
                // dataGridView2.DataSource = SmaFormatter.GetFormatter(0).GetSchema(_SmaData[0] as object[][]);
                break;

            case "tileinfo":

                dataGridView2.DataSource = SmaFormatter.GetFormatter(1).GetSchema(_SmaData[1] as object[][]);
                makebitmap(pictureBox1, BitmapType.SMA);

                break;

            case "monsterinfo":

                dataGridView2.DataSource = SmaFormatter.GetFormatter(2).GetSchema(_SmaData[2] as object[][]);
                var temp = SmaFormatter.GetFormatter(2).GetSchema(_SmaData[2] as object[][]);

                Draw.MonsterData = null;


                panel1.Controls.Clear();


                Draw.MonsterData       = Draw.PrepareMonsterData(_SmaData[2] as object[][]);
                panel1.BackgroundImage = new Bitmap(PaintStuff.GetMapImage(Directory.GetCurrentDirectory() + @"..\..\..\map\" + info.Item2 + ".map"), new Size(512, 512));
                foreach (var spawn in Draw.MonsterData)
                {
                    //spawn.Item3.BackColor = Color.Red;
                    ToolTip tt = new ToolTip();
                    tt.SetToolTip(spawn.Item3, "Region Name: " + spawn.Item1 + "\n MonsterNum: " + spawn.Item2 + "\n MaxCount: " + spawn.Item4);

                    panel1.Controls.Add(spawn.Item3);
                }


                //   image = new Bitmap(PaintStuff.GetMapImage(@"C:\Ares_Source\BuildResult\Client\Release\Res-Map\" + info.Item2+".map"), new Size(512, 512));
                //   pictureBox1.Image = image;

                //if (dataGridView2.SelectedRows.Count == 1)
                //{
                //  //  Bitmap test = new Bitmap(512, 512);
                //    var selectedrow = dataGridView2.SelectedRows[0];
                //    int sx = GetSize(int.Parse(selectedrow.Cells[2].Value.ToString()));
                //    int sy = GetSize(int.Parse(selectedrow.Cells[3].Value.ToString()));
                //    int ex = GetSize(int.Parse(selectedrow.Cells[4].Value.ToString()));
                //    int ey = GetSize(int.Parse(selectedrow.Cells[5].Value.ToString()));



                //    Graphics g = Graphics.FromImage(image);

                //    g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

                //    //g.DrawRectangle(new Pen(Color.Red), sx,sy,ex-sx,ey-sy);   i think rectangle its abit off so its disabled atm !
                //    g.DrawString("S", new Font(FontFamily.GenericSansSerif, 18, FontStyle.Regular), new SolidBrush(Color.Green), sx - 9, sy - 9);
                //    g.DrawString("E", new Font(FontFamily.GenericSansSerif, 18, FontStyle.Regular), new SolidBrush(Color.Red), sx - 9, ey - 9);
                //    g.Dispose();

                //    pictureBox1.Refresh();
                //}


                break;
            }
        }