当前位置: 首页>>代码示例>>C#>>正文


C# Packet.setFireOff方法代码示例

本文整理汇总了C#中Packet.setFireOff方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.setFireOff方法的具体用法?C# Packet.setFireOff怎么用?C# Packet.setFireOff使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Packet的用法示例。


在下文中一共展示了Packet.setFireOff方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FPSAim

        public FPSAim(String vcd)
        {
            InitializeComponent();

              VideoCaptureDevice videoSource = new VideoCaptureDevice(vcd, new Size(320, 240), false);
              OpenVideoSource(videoSource);

              redDot.Location = new Point(gridBox.Width / 2 + gridBox.Left, gridBox.Height / 2 + gridBox.Top);
              servos = new Servos();
              redDot.Location = servos.GetPorportionalMathPosition(gridBox.Bounds);
              redDot.Location = new Point(redDot.Location.X - REDDOT_OFFSET_X, redDot.Location.Y - REDDOT_OFFSET_Y);
              label1.Text = "(-" + servos.CenterServosPosition.X + "," + servos.CenterServosPosition.Y + ")";
              textBoxXServo.Text = servos.ShootingRange.Width.ToString();
              textBoxYServo.Text = servos.ShootingRange.Height.ToString();
              textBoxXCoord.Text = servos.ServosPosition.X.ToString();
              textBoxYCoord.Text = servos.ServosPosition.Y.ToString();

              Packet packet = new Packet(servos.CenterServosPosition);
              packet.setFireOff();
              this.sendData(packet);
              Cursor.Hide();
              cursorhidden = true;
              CoordinateTimer.Start();

              //Point camwindowcenter = new Point(gridBox.PointToScreen(new Point(0, 0)).X , gridBox.PointToScreen(new Point(0, 0)).Y );
              //Cursor.Position = camwindowcenter;
              currentX = Cursor.Position.X;
              currentY = Cursor.Position.Y;
              lastX = 0;
              lastY = 0;
        }
开发者ID:Tob1112,项目名称:405sentry,代码行数:31,代码来源:FPSAim.cs

示例2: centerButton_Click

 private void centerButton_Click(object sender, EventArgs e)
 {
     int x = 0;
       int y = 0;
       servos.ServosPosition = servos.ConvertPositionMathToServos(new Point(x, y));
       XTextBox.Text = servos.GetMathPosition().X.ToString();
       YTextBox.Text = servos.GetMathPosition().Y.ToString();
       redDot.Location = servos.GetPorportionalMathPosition(gridBox.Bounds);
       redDot.Location = new Point(redDot.Location.X - REDDOT_OFFSET_X, redDot.Location.Y - REDDOT_OFFSET_Y);
       textBoxXCoord.Text = servos.CenterServosPosition.X.ToString();
       textBoxYCoord.Text = servos.CenterServosPosition.Y.ToString();
       Packet packet = new Packet(servos.CenterServosPosition);
       packet.setFireOff();
       this.sendData(packet);
 }
开发者ID:Tob1112,项目名称:405sentry,代码行数:15,代码来源:RemoteAim.cs

示例3: RemoteAim

        public RemoteAim(String vcd)
        {
            InitializeComponent();

              VideoCaptureDevice videoSource = new VideoCaptureDevice(vcd, new Size(320, 240), false);
              OpenVideoSource(videoSource);

              redDot.Location = new Point(gridBox.Width / 2 + gridBox.Left, gridBox.Height / 2 + gridBox.Top);
              servos = new Servos();
              XTextBox.Text = servos.GetMathPosition().X.ToString();
              YTextBox.Text = servos.GetMathPosition().Y.ToString();
              redDot.Location = servos.GetPorportionalMathPosition(gridBox.Bounds);
              redDot.Location = new Point(redDot.Location.X - REDDOT_OFFSET_X, redDot.Location.Y - REDDOT_OFFSET_Y);
              label1.Text = "(-" + servos.CenterServosPosition.X + "," + servos.CenterServosPosition.Y + ")";
              PosIncTextBox.Text = positionIncrement.ToString();
              textBoxXServo.Text = servos.ShootingRange.Width.ToString();
              textBoxYServo.Text = servos.ShootingRange.Height.ToString();
              textBoxXCoord.Text = servos.ServosPosition.X.ToString();
              textBoxYCoord.Text = servos.ServosPosition.Y.ToString();

              Packet packet = new Packet(servos.CenterServosPosition);
              packet.setFireOff();
              this.sendData(packet);
        }
开发者ID:Tob1112,项目名称:405sentry,代码行数:24,代码来源:RemoteAim.cs

示例4: FPSAim_FormClosing

        private void FPSAim_FormClosing(object sender, FormClosingEventArgs e)
        {
            CoordinateTimer.Stop();
            CloseVideoSource();
            Cursor.Show();

            Packet packet = new Packet(servos.CenterServosPosition);
            packet.setFireOff();
            sendData(packet);
        }
开发者ID:Tob1112,项目名称:405sentry,代码行数:10,代码来源:FPSAim.cs

示例5: CoordinateTimer_Tick

        private void CoordinateTimer_Tick(object sender, EventArgs e)
        {
            int deltaX = Cursor.Position.X - currentX;
            int deltaY = Cursor.Position.Y - currentY;
            lastX += deltaX/sensitivity;
            lastY -= deltaY/sensitivity;

            if (lastX > servos.ShootingRange.Width / 2)
            {
            lastX = servos.ShootingRange.Width / 2;
            }
            else if (lastX < -servos.ShootingRange.Width / 2)
            {
            lastX = -servos.ShootingRange.Width / 2;
            }
            if (lastY > servos.ShootingRange.Height / 2)
            {
            lastY = servos.ShootingRange.Height / 2;
            }
            else if (lastY < -servos.ShootingRange.Height / 2)
            {
            lastY = -servos.ShootingRange.Height / 2;
            }
            //MessageBox.Show(lastX.ToString() + " " + lastY.ToString());
            servos.ServosPosition = servos.ConvertPositionMathToServos(new Point(lastX, lastY));
            //servos.SetPorportionalMathPosition(gridBox.Bounds, new Point(lastX, lastY));
            Packet packet = new Packet(servos.ServosPosition);
            textBoxXCoord.Text = servos.ServosPosition.X.ToString();
            textBoxYCoord.Text = servos.ServosPosition.Y.ToString();
            if (fireOK == true)
            packet.setFireOn();
            else
            packet.setFireOff();
            this.sendData(packet);
            Cursor.Position = new Point(currentX, currentY);
        }
开发者ID:Tob1112,项目名称:405sentry,代码行数:36,代码来源:FPSAim.cs

示例6: RemoteAim_FormClosing

        private void RemoteAim_FormClosing(object sender, FormClosingEventArgs e)
        {
            CloseVideoSource();

            Packet packet = new Packet(servos.CenterServosPosition);
            packet.setFireOff();
            sendData(packet);
        }
开发者ID:Tob1112,项目名称:405sentry,代码行数:8,代码来源:RemoteAim.cs

示例7: remoteAim

 private void remoteAim()
 {
     int x = int.Parse(XTextBox.Text);
       int y = int.Parse(YTextBox.Text);
       servos.ServosPosition = servos.ConvertPositionMathToServos(new Point(x, y));
       XTextBox.Text = servos.GetMathPosition().X.ToString();
       YTextBox.Text = servos.GetMathPosition().Y.ToString();
       redDot.Location = servos.GetPorportionalMathPosition(gridBox.Bounds);
       redDot.Location = new Point(redDot.Location.X - REDDOT_OFFSET_X, redDot.Location.Y - REDDOT_OFFSET_Y);
       Packet packet = new Packet(servos.ServosPosition);
       if (fireOK == true)
       packet.setFireOn();
       else
       packet.setFireOff();
       this.sendData(packet);
 }
开发者ID:Tob1112,项目名称:405sentry,代码行数:16,代码来源:RemoteAim.cs

示例8: CoordinateTimer_Tick

 private void CoordinateTimer_Tick(object sender, EventArgs e)
 {
     servos.SetPorportionalMathPosition(gridBox.Bounds, new Point(redDot.Location.X + REDDOT_OFFSET_X, redDot.Location.Y + REDDOT_OFFSET_Y));
     XTextBox.Text = servos.GetMathPosition().X.ToString();
     YTextBox.Text = servos.GetMathPosition().Y.ToString();
     Packet packet = new Packet(servos.ServosPosition);
     textBoxXCoord.Text = servos.ServosPosition.X.ToString();
     textBoxYCoord.Text = servos.ServosPosition.Y.ToString();
     if (fireOK == true)
     packet.setFireOn();
     else
     packet.setFireOff();
     this.sendData(packet);
 }
开发者ID:Tob1112,项目名称:405sentry,代码行数:14,代码来源:RemoteAim.cs

示例9: TrackingTimer_Tick

        //125ms refresh rate as of right now
        //Timer that tracks refresh of position tracking
        private void TrackingTimer_Tick(object sender, EventArgs e)
        {
            if (cameraWindow1.Camera != null && cameraWindow1.Camera.MotionDetector != null)
              {
            CountingMotionDetector cmd = (CountingMotionDetector)cameraWindow1.Camera.MotionDetector;
            Rectangle[] rectmotion = cmd.ObjectRectangles;

            if (rectmotion.Length != 0)
            {
              if (!firingsoundplayed && soundOn)
              {
            switch (soundTracker % 4)
            {
              case 0:
                PlaySound(pwd + "\\Sounds\\Sentry Sounds\\Target Found\\firing.wav", IntPtr.Zero, SoundFlags.SND_FILENAME | SoundFlags.SND_ASYNC);
                firingsoundplayed = true;
                break;
              case 1:
                PlaySound(pwd + "\\Sounds\\Sentry Sounds\\Target Found\\i_see_you.wav", IntPtr.Zero, SoundFlags.SND_FILENAME | SoundFlags.SND_ASYNC);
                firingsoundplayed = true;
                break;
              case 2:
                PlaySound(pwd + "\\Sounds\\Sentry Sounds\\Target Found\\target_acquired.wav", IntPtr.Zero, SoundFlags.SND_FILENAME | SoundFlags.SND_ASYNC);
                firingsoundplayed = true;
                break;
              case 3:
                PlaySound(pwd + "\\Sounds\\Sentry Sounds\\Target Found\\there_you_are.wav", IntPtr.Zero, SoundFlags.SND_FILENAME | SoundFlags.SND_ASYNC);
                firingsoundplayed = true;
                break;
            }
              }
              ceasefiringsoundplayed = false;
              aimDot.BackColor = Color.Red;
              //aimDot.Visible = true;
              //calculate largest detected motion area
              Rectangle largest = rectmotion[0];
              for (int i = 1; i < rectmotion.Length; i++)
              {
            if (rectmotion[i].Width * rectmotion[i].Height > largest.Width * largest.Height)
            {
              largest = rectmotion[i];
            }
              }

              //get center of largest motion area
              int x = largest.X + largest.Width / 2 + cameraWindow1.Location.X;
              int y = largest.Y + largest.Height / 2 + cameraWindow1.Location.Y;

              //calculate difference from last center point and adjust target lead depending on speed
              if (lastCenterPosition.IsEmpty)
              {
            lastCenterPosition = new Point(x, y);
            lastLeadingPosition = new Point(lastCenterPosition.X, lastCenterPosition.Y);
              }
              else if (!lastCenterPosition.IsEmpty)
              {
            int xdiff = x - lastCenterPosition.X;
            int ydiff = y - lastCenterPosition.Y;
            lastLeadingPosition = new Point(x + multiplier*xdiff, y + ydiff);
            lastCenterPosition = new Point(x, y);
            Console.WriteLine(xdiff.ToString());
              }

              //set aimdot location
              aimDot.Location = new Point(lastLeadingPosition.X - 2, lastLeadingPosition.Y - 2);

              //create packet, set servo position, and fire
              servos.SetPorportionalMathPosition(cameraWindow1.Bounds, lastLeadingPosition);
              Packet packet = new Packet(servos.ServosPosition);
              //Console.WriteLine("(" + servos.Position.X + "," + servos.Position.Y + ")");
              //MessageBox.Show("(" + servos.Position.X + "," + servos.Position.Y + ")");
              packet.setFireOff();
              if (firingOn)
              {
            packet.setFireOn();
              }
              sendData(packet);
            }
            else if (rectmotion.Length == 0)
            {
              if (!ceasefiringsoundplayed && soundOn)
              {
            switch (soundTracker % 4)
            {
              case 0:
                PlaySound(pwd + "\\Sounds\\Sentry Sounds\\Target lost\\searching.wav", IntPtr.Zero, SoundFlags.SND_FILENAME | SoundFlags.SND_ASYNC);

                ceasefiringsoundplayed = true;
                break;
              case 1:
                PlaySound(pwd + "\\Sounds\\Sentry Sounds\\Target lost\\is_anyone_there.wav", IntPtr.Zero, SoundFlags.SND_FILENAME | SoundFlags.SND_ASYNC);
                ceasefiringsoundplayed = true;
                break;
              case 2:
                PlaySound(pwd + "\\Sounds\\Sentry Sounds\\Target lost\\target_lost.wav", IntPtr.Zero, SoundFlags.SND_FILENAME | SoundFlags.SND_ASYNC);
                ceasefiringsoundplayed = true;
                break;
              case 3:
//.........这里部分代码省略.........
开发者ID:Tob1112,项目名称:405sentry,代码行数:101,代码来源:MainForm.cs

示例10: exitToolStripMenuItem_Click

 private void exitToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Packet packet = new Packet(servos.CenterServosPosition);
       packet.setFireOff();
       sendData(packet);
       Application.Exit();
 }
开发者ID:Tob1112,项目名称:405sentry,代码行数:7,代码来源:MainForm.cs


注:本文中的Packet.setFireOff方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。