private void picShape_MouseDown(object sender, MouseEventArgs e) { switch(_tool) { case TypesOfTool.Paint: if(e.Button == MouseButtons.Left || e.Button == MouseButtons.Right) if(e.Button == MouseButtons.Left) SetPixelLock(e.X, e.Y, true, false); else SetPixelLock(e.X, e.Y, false, false); break; case TypesOfTool.Zone: switch(_zoneMode) { case ModesOfZone.SetCentre: _zone = new Zone(_shape); _zone.X = e.X; _zone.Y = e.Y; float mx = e.X, my = e.Y; MapXY(ref mx, ref my); _zone.X = mx; _zone.Y = my; _shape.Zones.Add(_zone); _zoneMode = ModesOfZone.SetEnterRadiusAngle; break; case ModesOfZone.SetExitRadiusAngle: _zoneMode = ModesOfZone.SetExitArc; break; } break; } }
private void Open(StreamReader stream, TreeNode parentNode) { int zc; int cc; Shape shape = new Shape(parentNode.Nodes.Add(stream.ReadLine())); shape.Node.SelectedImageIndex = shape.Node.ImageIndex = 1; shape.Node.EnsureVisible(); shape.SID = uint.Parse(stream.ReadLine()); shape.Type = (TypesOfShape)(int.Parse(stream.ReadLine())); shape.Dampen = float.Parse(stream.ReadLine()); shape.Width = int.Parse(stream.ReadLine()); shape.Height = int.Parse(stream.ReadLine()); shape.HBound = int.Parse(stream.ReadLine()); shape.VBound = int.Parse(stream.ReadLine()); shape.WindowPosition = new Rectangle ( int.Parse(stream.ReadLine()), int.Parse(stream.ReadLine()), int.Parse(stream.ReadLine()), int.Parse(stream.ReadLine()) ); shape.ZoneReverse = bool.Parse(stream.ReadLine()); shape.ZoneAnyStart = bool.Parse(stream.ReadLine()); zc = int.Parse(stream.ReadLine()); cc = int.Parse(stream.ReadLine()); for(int y = 0; y < shape.Height; y++) for(int x = 0; x < shape.Width; x++) { shape.Pixels.Pixel[x, y].Weight = float.Parse(stream.ReadLine()); shape.Pixels.Pixel[x, y].Radius = float.Parse(stream.ReadLine()); shape.Pixels.Pixel[x, y].Falloff = float.Parse(stream.ReadLine()); } for(int zi = 0; zi < zc; zi++) { Zone zone = new Zone(shape); zone.X = float.Parse(stream.ReadLine()); zone.Y = float.Parse(stream.ReadLine()); zone.EnterRadius = float.Parse(stream.ReadLine()); zone.ExitRadius = float.Parse(stream.ReadLine()); zone.EnterAngle = float.Parse(stream.ReadLine()); zone.ExitAngle = float.Parse(stream.ReadLine()); zone.EnterArc = float.Parse(stream.ReadLine()); zone.ExitArc = float.Parse(stream.ReadLine()); shape.Zones.Add(zone); } for(int ci = 0; ci < cc; ci++) Open(stream, shape.Node); }