示例#1
0
文件: TTarget.cs 项目: rwsh/StarWars
        public void Crush()
        {
            Live       = false;
            Visibility = Visibility.Hidden;

            Exp = new Ellipse[ExpN];

            for (int n = 0; n < ExpN; n++)
            {
                Exp[n]      = TCircle.O(xs, ys, 10, Brushes.Red);
                Exp[n].Fill = Brushes.Yellow;

                g.Children.Add(Exp[n]);
            }

            Timer          = new DispatcherTimer();
            Timer.Tick    += new EventHandler(onTick);
            Timer.Interval = new TimeSpan(0, 0, 0, 0, 10);
            Timer.Start();
        }
示例#2
0
文件: TTarget.cs 项目: rwsh/StarWars
        public void Draw(Brush Color = null)
        {
            if (Color == null)
            {
                Color = Brushes.Gray;
            }

            O            = TCircle.O(xs, ys, R, Brushes.White);
            O.Fill       = Color;
            O.Visibility = Visibility.Hidden;

            L1                 = new Line();
            L1.X1              = xs - W;
            L1.Y1              = ys;
            L1.X2              = xs + W;
            L1.Y2              = ys;
            L1.Stroke          = Color;
            L1.StrokeThickness = 3;
            L1.Visibility      = Visibility.Hidden;

            L2                 = new Line();
            L2.X1              = xs - W;
            L2.Y1              = ys - H;
            L2.X2              = xs - W;
            L2.Y2              = ys + H;
            L2.Stroke          = Color;
            L2.StrokeThickness = 3;
            L2.Visibility      = Visibility.Hidden;

            L3                 = new Line();
            L3.X1              = xs + W;
            L3.Y1              = ys - H;
            L3.X2              = xs + W;
            L3.Y2              = ys + H;
            L3.Stroke          = Color;
            L3.StrokeThickness = 3;
            L3.Visibility      = Visibility.Hidden;

            //Image f = new Image();
        }
示例#3
0
        public void Draw()
        {
            Line l = new Line();

            l.X1 = W2;
            l.Y1 = H2 - H / 10;
            l.X2 = W2;
            l.Y2 = H2 + H / 10;
            l.StrokeThickness = 1;
            l.Stroke          = Brushes.White;
            g.Children.Add(l);

            l = new Line();

            l.X1 = W2 - W / 10;
            l.Y1 = H2;
            l.X2 = W2 + W / 10;
            l.Y2 = H2;
            l.StrokeThickness = 1;
            l.Stroke          = Brushes.White;
            g.Children.Add(l);

            g.Children.Add(TCircle.O(W2, H2, W / 10, Brushes.White));

            TextXY = new TextBlock();

            TextXY.Text = "X = 0 Y = 0";

            TextXY.Foreground = Brushes.White;

            Canvas.SetLeft(TextXY, W * (3.0 / 4.0));

            Canvas.SetTop(TextXY, H - 20);

            g.Children.Add(TextXY);

            for (int i = 0; i < Stars.Count; i++)
            {
                g.Children.Add(Stars[i].O);
            }

            for (int i = 0; i < Targets.Count; i++)
            {
                Targets[i].Add(g);
            }

            //

            int Name = -1;

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    Name++;

                    TTarget T = Targets2[Name];
                    T.H /= 2.0;
                    T.W /= 2.0;
                    T.R /= 2.0;

                    T.xs = T.W + T.W * 4 * j;
                    T.ys = T.H + T.H * 4 * i;

                    T.Draw(Brushes.Red);
                    T.Visibility = Visibility.Visible;

                    T.Add(g2);
                }
            }
        }