Ejemplo n.º 1
0
        public Iso(int _x, int _y,   string _color,RaphaelPaper _context)
        {
            X = _x;
            Y = _y;

            Color = _color;
            Selected = false;
            Neighbors = false;
            Glow = false;
            HighlightedNeighbors = false;

            RaphaelPaperSet element;

            if (Math.Random() * 100 < 70) {
                Block block = new Block((float)Math.Min(Math.Random(), 0.6f), (float)Math.Min(Math.Random(), 0.6f), Color);
                Blocks.Add(block);
                element = block.build(_context, X, Y);

                block.LeftWall.MouseOver(e =>
                {
                    element.Attribute(new RaphaelElementAttributes() { StrokeWidth =  3 });
                });
                block.LeftWall.MouseOut(e =>
                {
                    element.Attribute(new RaphaelElementAttributes() { StrokeWidth = 1 });
                });
                block.LeftWall.MouseDown(e =>
                {
                    block.Click(Wall.Left);
                });

                block.RightWall.MouseOver(e =>
                {
                    element.Attribute(new RaphaelElementAttributes() { StrokeWidth = 3 });
                });
                block.RightWall.MouseOut(e =>
                {
                    element.Attribute(new RaphaelElementAttributes() { StrokeWidth =1});
                });
                block.RightWall.MouseDown(e =>
                {
                    block.Click(Wall.Right);
                });

                block.TopWall.MouseOver(e =>
                {
                    element.Attribute(new RaphaelElementAttributes() { StrokeWidth = 3 });
                });
                block.TopWall.MouseOut(e =>
                {
                    element.Attribute(new RaphaelElementAttributes() { StrokeWidth = 1 });
                });
                block.TopWall.MouseDown(e =>
                {
                    block.Click(Wall.Top);
                });

            }
        }
Ejemplo n.º 2
0
        public static void buildBottomEmpty(RaphaelPaper _context, int x, int y)
        {
            var xxx = ( y % 2 == 1 ? ( ( x + 0.5f ) * ArmLength ) : ( x * ArmLength ) ) + IsoGame.Offset.X;
            var yyy = y * ArmLength / 4f + IsoGame.Offset.Y;

            var em = _context.Set();

            RaphaelElement elem;
            elem=_context.Path(string.Format("M{0} {1}L{2} {3}L{4} {5}L{6} {7}L{0} {1}",
                                                            xxx - ArmLength / 2 ,
                                                            yyy,
                                                            xxx,
                                                            yyy - ArmLength / 4 ,
                                                            xxx + ArmLength / 2 ,
                                                            yyy,
                                                            xxx,
                                                            yyy + ArmLength / 4 )) ;

            elem.Attribute(new RaphaelElementAttributes() { Fill = "rgba(0,0,0,0)", StrokeWidth =1, Stroke = "black" });
            elem.MouseOver((e) =>
            {
                elem.Attribute(new RaphaelElementAttributes() { Fill = "rgba(0,0,0,0)", StrokeWidth = 4, Stroke = "black" });
            });
            elem.MouseOut((e) =>
            {
                elem.Attribute(new RaphaelElementAttributes() { Fill = "rgba(0,0,0,0)", StrokeWidth = 1, Stroke = "black" });
            });

            em.Push(_context.Circle(xxx - ArmLength / 2, yyy, 3));
            //            em.Push(_context.Circle(xxx, yyy - ArmLength / 4, 3));
            //            em.Push(_context.Circle(xxx + ArmLength / 2, yyy, 3));
            //            em.Push(_context.Circle(xxx, yyy + ArmLength / 4, 3));

            em.Attribute(new RaphaelElementAttributes() {StrokeLineCap = RaphaelLineCap.Round, StrokeLineJoin = RaphaelLineJoin.Round});
            em.Attribute(new RaphaelElementAttributes() {Fill = "black", StrokeWidth = 4, Stroke = "black"});
        }
Ejemplo n.º 3
0
 public CanvasInformation(RaphaelPaper context, jQueryObject domCanvas)
 {
     Context = context;
     JCanvas = domCanvas;
     Canvas  = domCanvas[0];
 }
Ejemplo n.º 4
0
 public CanvasInformation(RaphaelPaper context, jQueryObject domCanvas)
 {
     Context = context;
     JCanvas = domCanvas;
     Canvas = domCanvas[0];
 }
Ejemplo n.º 5
0
        public RaphaelElement buildTop(RaphaelPaper _context)
        {
            float xxx = startxxx;
            float yyy = startyyy;

            yyy -= ArmLength / 2 * VerticalLength;

            if (top != null) {
                top.Attribute("path",
                              string.Format("M{0} {1}L{2} {3}L{4} {5}L{6} {7}L{0} {1}",
                                            xxx - ArmLength / 2 * HorizontalLength,
                                            yyy,
                                            xxx,
                                            yyy - ArmLength / 4 * HorizontalLength,
                                            xxx + ArmLength / 2 * HorizontalLength,
                                            yyy,
                                            xxx,
                                            yyy + ArmLength / 4 * HorizontalLength));
                return null;
            }

            var element = top = _context.Path(string.Format("M{0} {1}L{2} {3}L{4} {5}L{6} {7}L{0} {1}",
                                                            xxx - ArmLength / 2 * HorizontalLength,
                                                            yyy,
                                                            xxx,
                                                            yyy - ArmLength / 4 * HorizontalLength,
                                                            xxx + ArmLength / 2 * HorizontalLength,
                                                            yyy,
                                                            xxx,
                                                            yyy + ArmLength / 4 * HorizontalLength));

            return element;
        }
Ejemplo n.º 6
0
        public RaphaelPaperSet build(RaphaelPaper context, int X, int Y)
        {
            myContext = context;
            var x = X;
            var y = Y;
            var xxx = ( y % 2 == 1 ? ( ( x + 0.5f ) * ArmLength ) : ( x * ArmLength ) ) + IsoGame.Offset.X;
            var yyy = y * ArmLength / 4f + IsoGame.Offset.Y;

            startxxx = xxx;
            startyyy = yyy;
            var set = context.Set();
            set.Push(LeftWall = buildLeft(context));
            set.Push(RightWall = buildRight(context));
            set.Push(TopWall = buildTop(context));

            set.MouseOver(e => { set.Attribute(new RaphaelElementAttributes() {StrokeWidth = 3}); });
            set.MouseOut(e => { set.Attribute(new RaphaelElementAttributes() {StrokeWidth = 1}); });

            set.Attribute(new RaphaelElementAttributes() {StrokeLineCap = RaphaelLineCap.Round, StrokeLineJoin = RaphaelLineJoin.Round});
            set.Attribute(new RaphaelElementAttributes() {Fill = Color, StrokeWidth = 1, Stroke = "black"});

            return set;
        }