Exemple #1
0
    void Start()
    {
        //fsm = this.GetComponent<PlayMakerFSM>();

        /*BackPack bk = new BackPack();
         * Item_Pack ip = new Item_Pack();
         * ip.Item_Id = 1;
         * Equit_Pack ep = new Equit_Pack();
         * ep.Item_Id = 2;
         * bk.AddItemPack(ip);
         * bk.AddItemPack(ep);
         * Item_Pack_Base ip2 = new Item_Pack_Base();
         * ip2.Item_Id = 3;
         * byte[] bys = ProtobufSerialize(bk);
         * var bk2 = ProtoBufUtils.ProtobufDeserialize<BackPack>(bys);
         */

        GameObject      go  = GameObject.Find("Line");
        LineComponent   com = go.GetComponent <LineComponent>();
        LinePointPlugin lp  = new LinePointPlugin();

        DOTween.To(lp,
                   () => { return(com); },
                   (LineComponent lc) => { },
                   com,
                   2
                   );
    }
Exemple #2
0
        public override void Initialize()
        {
            Context.RemoveAllComponents();

            var center = Context.Bounds.GetCenter();

            hourLine = new LineComponent(center, center, Context)
            {
                Pixel = '#'.White()
            };
            secondLine = new LineComponent(center, center, Context)
            {
                Pixel = 'o'.White()
            };
            minuteLine = new LineComponent(center, center, Context)
            {
                Pixel = '.'.White()
            };

            circle = new CircleComponent(center, Context.Bounds.Height / 2f, Context)
            {
                Filled = false
            };
            circle.Transform.CentralizePivot();
        }
Exemple #3
0
        public GraphDrawer(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager) : base(device)
        {
            this.AddChild(name  = new TextureString(device, "", 16, PPDColors.White));
            this.AddChild(xname = new TextureString(device, Utility.Language["Latest"], 12, PPDColors.White));
            ynames = new TextureString[5];
            for (int i = 0; i < ynames.Length; i++)
            {
                this.AddChild(ynames[i] = new TextureString(device, "", 12, PPDColors.White));
            }
            this.AddChild(yAxis = new RectangleComponent(device, resourceManager, PPDColors.White)
            {
                RectangleWidth = 2
            });
            this.AddChild(xAxis = new RectangleComponent(device, resourceManager, PPDColors.White)
            {
                RectangleHeight = 2
            });
            this.AddChild(line = new LineComponent(device, resourceManager, lineColor)
            {
                LineWidth = 2
            });

            poses     = new List <Vector2>();
            Formatter = FloatToIntFormatter.Formatter;
        }
    public void ClearVector(LineComponent line)
    {
        switch (line)
        {
        case LineComponent.CTSVECTOR:
            CTSVector.SetPosition(0, Vector3.zero);
            CTSVector.SetPosition(1, Vector3.zero);
            break;

        case LineComponent.RELVECTOR:
            RelativeVector.SetPosition(0, Vector3.zero);
            RelativeVector.SetPosition(1, Vector3.zero);
            break;

        case LineComponent.GUIDECRSANDSPEEDVECTOR:
            GuideVector.SetPosition(0, Vector3.zero);
            GuideVector.SetPosition(1, Vector3.zero);
            break;

        case LineComponent.ALLVECTORS:
            CTSVector.SetPosition(0, Vector3.zero);
            CTSVector.SetPosition(1, Vector3.zero);
            RelativeVector.SetPosition(0, Vector3.zero);
            RelativeVector.SetPosition(1, Vector3.zero);
            GuideVector.SetPosition(0, Vector3.zero);
            GuideVector.SetPosition(1, Vector3.zero);
            break;

        default:
            return;
        }
    }
Exemple #5
0
            public void DrawLines(Color color, PointF[] points)
            {
                var line = new LineComponent(Drawer.Device, Drawer.ResourceManager,
                                             new SharpDX.Color4(color.R / 255f, color.G / 255f, color.B / 255f, color.A / 255f))
                {
                    Points    = points.Select(p => new SharpDX.Vector2(p.X, p.Y)).ToArray(),
                    LineWidth = 1
                };

                Drawer.DrawTarget.InsertChild(line, 0);
            }
Exemple #6
0
        public void Constructor_X1Y1AndX2Y2_PointAAndPointB()
        {
            var ctx    = Substitute.For <IWorldContext>();
            var target = new LineComponent(1, 2, 3, 4, ctx);

            Assert.AreEqual(new Point(1, 2), target.PointA);
            Assert.AreEqual(new Point(3, 4), target.PointB);
            Assert.AreEqual(ctx, target.Context);

            target.PointA = Point.Ten;
            Assert.AreEqual(Point.Ten, target.Transform.Position);
        }
Exemple #7
0
        public void Draw_Context_LineDrawn()
        {
            var ctx     = Substitute.For <IWorldContext>();
            var drawCtx = Substitute.For <IDrawContext>();
            var canvas  = Substitute.For <ICanvas>();

            drawCtx.Canvas.Returns(canvas);

            var target = new LineComponent(new Point(10, 20), new Point(15, 25), ctx);

            target.Draw(drawCtx);

            canvas.Received().Draw(target, '#'.White());
        }
Exemple #8
0
            public void DrawLine(Color color, PointF p1, PointF p2)
            {
                var line = new LineComponent(Drawer.Device, Drawer.ResourceManager,
                                             new SharpDX.Color4(color.R / 255f, color.G / 255f, color.B / 255f, color.A / 255f))
                {
                    Points = new SharpDX.Vector2[] {
                        new SharpDX.Vector2(p1.X, p1.Y),
                        new SharpDX.Vector2(p2.X, p2.Y)
                    },
                    LineWidth = 1
                };

                Drawer.DrawTarget.InsertChild(line, 0);
            }
Exemple #9
0
            public void DrawEllipse(Color color, RectangleF rect)
            {
                var center    = new SharpDX.Vector2(rect.X + rect.Width / 2, rect.Y + rect.Height / 2);
                var maxRadius = (int)Math.Ceiling(Math.Max(rect.Width / 2, rect.Height / 2));
                var points    = new SharpDX.Vector2[maxRadius * 4 + 1];

                for (var i = 0; i < points.Length; i++)
                {
                    var rad = Math.PI * 2 * i / points.Length;
                    points[i] = center + new SharpDX.Vector2(rect.Width / 2 * (float)Math.Cos(rad), rect.Height / 2 * (float)Math.Sin(rad));
                }
                var line = new LineComponent(Drawer.Device, Drawer.ResourceManager,
                                             new SharpDX.Color4(color.R / 255f, color.G / 255f, color.B / 255f, color.A / 255f))
                {
                    Points    = points,
                    LineWidth = 1
                };

                Drawer.DrawTarget.InsertChild(line, 0);
            }
Exemple #10
0
 public MainGame(PPDDevice device, MyGame mygame, PPDFramework.Resource.ResourceManager resourceManager, SquareGrid squareGrid) : base(device)
 {
     this.resourceManager = resourceManager;
     AddChild(mpd         = new MarkPointDrawer(device, resourceManager));
     AddChild(kasi        = new TextureString(device, "", 20, true, PPDColors.White)
     {
         Position = new Vector2(400, 415)
     });
     AddChild(mgt         = new MainGameTop(device, resourceManager));
     AddChild(mgb         = new MainGameBottom(device, resourceManager));
     AddChild(up          = new PictureObject(device, resourceManager, Utility.Path.Combine("assist", "up.png")));
     AddChild(upSelect    = new PictureObject(device, resourceManager, Utility.Path.Combine("assist", "upselect.png")));
     AddChild(right       = new PictureObject(device, resourceManager, Utility.Path.Combine("assist", "right.png")));
     AddChild(rightSelect = new PictureObject(device, resourceManager, Utility.Path.Combine("assist", "rightselect.png")));
     AddChild(area        = new PictureObject(device, resourceManager, Utility.Path.Combine("assist", "area.png")));
     AddChild(angleLine   = new LineComponent(device, resourceManager, PPDColors.Blue)
     {
         LineWidth = 3
     });
     AddChild(dummy = new DummyDrawComponent(device));
     AddChild(grid  = new GridComponent(device, resourceManager, squareGrid));
 }
 public override void Visit(LineComponent cmp)
 {
     HookToParentBox(cmp);
 }
Exemple #12
0
 public HotkeyIndicator()
 {
     Line     = new LineComponent(3, Color.White);
     Cache    = new GraphicsCache();
     Settings = new HotkeyIndicatorSettings();
 }
Exemple #13
0
 public override void Visit(LineComponent cmp)
 {
     VisitComponent(cmp);
 }
Exemple #14
0
 public virtual void Visit(LineComponent cmp)
 {
 }
 public void SetComponent(LineComponent lineComponent)
 {
     this.lineComponent      = lineComponent;
     this.Component          = lineComponent;
     this.lineComponent.View = this;
 }
 public override void Visit(LineComponent cmp)
 {
     BoxMoved(cmp);
 }