static IntroHelper LoadIntro(IntroContainer Intro, Size Size)
        {
            var Helper = new IntroHelper();
            int Steps  = 100;

            Helper.Fade = new Bitmap[Steps];

            using (var Texture = Intro.Texture) {
                Color Pixel = Texture.GetPixel(0, 0);
                Helper.Background = Color.FromArgb(255, Pixel);

                Helper.Position = Texture.Size.GetCenterPoint(Size);
            }


            for (int Step = 0; Step < Steps; Step++)
            {
                using (var Texture = Intro.Texture) {
                    Bitmap Opacity = SetBitmapOpacity(Texture, ((float)Step) / Steps);
                    Bitmap Result  = new Bitmap(Texture.Width, Texture.Height);
                    using (Graphics Draw = Graphics.FromImage(Result)) {
                        Draw.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
                        Draw.SmoothingMode      = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                        Draw.InterpolationMode  = System.Drawing.Drawing2D.InterpolationMode.High;

                        Draw.Clear(Helper.Background);
                        Draw.DrawImage(Opacity, 0, 0);
                        Draw.Flush();
                        Helper.Fade[Step] = Result;
                    }
                    Opacity.Dispose();
                }
            }


            if (Intro.HasSound)
            {
                Helper.Sound = Intro.Wav;
            }
            else
            {
                Helper.Sound = null;
            }

            return(Helper);
        }
Пример #2
0
    private void SkipIntroSequence()
    {
        bool        skipIntroFailed  = false;
        IntroHelper intro            = FindObjectOfType <IntroHelper>();
        Controller  playerController = FindObjectOfType <Controller>();
        FPSChar     playerPawn       = FindObjectOfType <FPSChar>();

        if (playerController)
        {
            if (playerController.ControlledPawn == playerPawn)
            {
                Debug.Log("[DebugMenu] Already past intro sequence.");
                return;
            }
        }
        else
        {
            Debug.LogError("[DebugMenu] Failed to skip intro sequence, no player controller found!");
            skipIntroFailed = true;
        }
        if (!playerPawn)
        {
            Debug.LogError("[DebugMenu] Failed to skip intro sequence, no player pawn found!");
            skipIntroFailed = true;
        }
        if (!intro)
        {
            Debug.LogError("[DebugMenu] Failed to skip intro sequence, no IntroHelper found!");
            skipIntroFailed = true;
        }
        if (skipIntroFailed)
        {
            return;
        }

        intro.FinishFlying();
        intro.gameObject.SetActive(false);
    }
Пример #3
0
        static void Main(string[] args)
        {
            IntroHelper helper = new IntroHelper();
            Mat         image  = helper.CreateEmptyGreenImage();
            var         color  = helper.GetPixelColor(image, new Point(10, 10));

            Console.WriteLine("Mizu?");

            // Save all test images into PNG files.
            ConnectedComponentsTestImages genCC = new ConnectedComponentsTestImages();
            int dummy;

            Cv2.ImWrite("TrivialImage.png", genCC.TrivialImage(out dummy));
            Cv2.ImWrite("SingleRectImage.png", genCC.SingleRectImage(out dummy));
            Cv2.ImWrite("ComplexShapeImage.png", genCC.ComplexShapeImage(out dummy));
            Cv2.ImWrite("ThinLineShapeImage.png", genCC.ThinLineShapeImage(out dummy));
            Cv2.ImWrite("CirclesInGridSkipDiagonalImage.png", genCC.CirclesInGridSkipDiagonalImage(out dummy));
            Cv2.ImWrite("ImageWithText.png", genCC.ImageWithText(out dummy));
            Cv2.ImWrite("ThinLinksAndGapsImage.png", genCC.ThinLinksAndGapsImage());

            BoundingBoxTestImages genBBox = new BoundingBoxTestImages();
            int d1, d2, d3, d4; // Dummy variables

            Cv2.ImWrite("SimpleRectangleImage.png", genBBox.SimpleRectangleImage(out d1, out d2, out d3, out d4));
            Cv2.ImWrite("RandomPolygonImage.png", genBBox.RandomPolygonImage(out d1, out d2, out d3, out d4));

            BlobSizeHistogramTestImages genBlobSizeHist = new BlobSizeHistogramTestImages();

            Cv2.ImWrite("RandomBlobs.png", genBlobSizeHist.RandomBlobs(100, 200, out dummy));



            // Show window until keypress or max. 5 seconds
            Mat img = genCC.CirclesInGridSkipDiagonalImage(out dummy);

            Cv2.ImShow("CirclesInGridSkipDiagonalImage", img);
            Cv2.WaitKey(5000);
        }
Пример #4
0
 public void TestIntroBasics()
 {
     IntroHelper helper = new IntroHelper();
     Mat         image  = helper.CreateEmptyGreenImage();
 }