예제 #1
0
    public override void HandleNotification(PureMVC.Interfaces.INotification notification)
    {
        CamerBasic cb = notification.Body as CamerBasic;

        switch (notification.Name)
        {
        //执行和显示有关的命令

        /*初始时获取player和摄像机的相对位置*/
        case NotificationConstant.CameraMediator.SetCameraPlayerDistance:
        {
            CameraProxy proxy = (CameraProxy)Facade.RetrieveProxy("CameraProxy");
            proxy.setCameraPlayerDistance(player, Main_Camera);
        } break;


        case NotificationConstant.CameraMediator.CameraFollowMove:
        {
            if (!cb.isReStart)
            {
                Main_Camera.transform.position = cb.player_camera_distance + new Vector3(player.transform.position.x, 0, 0);
            }
        } break;
        }
    }
예제 #2
0
 public override void Execute(PureMVC.Interfaces.INotification notification)
 {
     switch (notification.Name)
     {
     case NotificationConstant.CameraCommand.CameraMove:
     {
         CameraProxy proxy = (CameraProxy)Facade.RetrieveProxy("CameraProxy");            //通过名字获取Proxy
         proxy.CamerMove();
     } break;
     }
 }
예제 #3
0
        public void TestLaser(int laserIndex, double theshold, int minLaserWidth, int maxLaserWidth)
        {
            if (!Available)
            {
                this.ReferencePictureBox.Image  = global::Sardauscan.Properties.Resources.Denied;
                this.LaserPictureBox.Image      = global::Sardauscan.Properties.Resources.Denied;
                this.DifferencePictureBox.Image = global::Sardauscan.Properties.Resources.Denied;
                this.ResultPictureBox.Image     = global::Sardauscan.Properties.Resources.Denied;
                return;
            }
            try
            {
                int fadeTime = Settings.Get <Settings>().Read(Settings.LASER_COMMON, Settings.FADE_DELAY, 100);
                // turn all laser off and take reference picture
                LaserProxy.TurnAll(false);
                Thread.Sleep(fadeTime); // wait fade laser
                Bitmap refImg = CameraProxy.AcquireImage();
                SetPicture(ReferencePictureBox, refImg);

                // take laser picture
                LaserProxy.Turn(laserIndex, true);
                Thread.Sleep(fadeTime); // wait fade laser
                Bitmap laserImg = CameraProxy.AcquireImage();
                SetPicture(LaserPictureBox, laserImg);

                Bitmap debuggingImage = new Bitmap(refImg.Width, refImg.Height);

                ImageProcessor imgproc = new ImageProcessor(theshold, minLaserWidth, maxLaserWidth);

                List <PointF> laserloc = imgproc.Process(refImg, laserImg, debuggingImage);

                SetPicture(DifferencePictureBox, debuggingImage);

                // Write the pixel image
                debuggingImage = BitmapExtention.SavePixels(laserloc, refImg.Width, refImg.Height);
                SetPicture(ResultPictureBox, debuggingImage);
            }
            catch { }
        }