private void Form1_Load(object sender, EventArgs e) { Pro = ItemsProcessor.Process("grass/map.json"); Pro.ProcessItem(); //pro.Run(); TiledExportOptions teo = Pro.SampleSet.ExportOptions as TiledExportOptions; if (teo != null) { var basePath = Path.GetDirectoryName(teo.SrcFileName); pictureBox2.Image = FromImage(Path.Combine(basePath, teo.Template.Tilesets[0].ImagePath)); } }
private void pictureBox1_Click2(object sender, EventArgs e) { MouseEventArgs me = (MouseEventArgs)e; var pos = me.Location; pos.X -= pos.X % 16; pos.Y -= pos.Y % 16; int x = pos.X / 16; int y = pos.Y / 16; //Pro.Propagator.SeletctPattern(x + y * 20, 1); //Pro.Export("test.png"); //pictureBox1.Image = FromImage("test.png"); //pictureBox1.Update(); var pro = ItemsProcessor.Process("grass/map2.json"); pro.ProcessItem(); //pro.Propagator.Select() //pro.Propagator.Select(3 , 3 , 0 ,new Tile( SelectedPatten)); for (int sy = 0; sy < 5; sy++) { for (int sx = 0; sx < 5; sx++) { if (sx == 0 || sx == 4 || sy == 0 || sy == 4) { int i = sx + x - 2 + (sy + y - 2) * 20; var pattern = Pro.Propagator.GetTile(i); //pro.Propagator.SeletctPattern(sx + sy * 5, pattern); System.Diagnostics.Debug.WriteLine($"I : {i} ,pattern : {pattern}"); pro.Propagator.Select(sx + 1, sy + 1, 0, pattern); } else if (sx == 3 && sy == 3) { } else { //model.Clear(sx, sy); } } } pro.Propagator.SetStatus(Resolution.Undecided); pro.Run2((String path) => { pictureBox4.Image = FromImage(path); pictureBox4.Update(); //BeginInvoke((Action)(() => //{ // //button1.Text = path; //})); }); }