示例#1
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (!IsReadyToUpdate)
            {
                return;
            }

            Thread.Yield();

            PulsarcTime.Update();

            CheckScreen();

            cursor.SetPos(MouseManager.CurrentState.Position);

            ConvertMaps();

            // Let ScreenManager handle the updating of the current active screen
            ScreenManager.Update(gameTime);

            // See if we're taking a screenshot this frame
            Screenshotter.Update();

            base.Update(gameTime);
        }
示例#2
0
    private void Awake()
    {
        _instance = this.CheckSingleton(_instance);

        // prefix screenshots with the time that the current play session started
        prefix = DateTime.Now.ToString($"{Application.productName}-yyyyMMddhhmmss");
    }
示例#3
0
 public void AfterEach()
 {
     if (TestContext.CurrentContext.Result.Outcome.Status == TestStatus.Failed)
     {
         Screenshotter screenshot = new Screenshotter(Driver);
         screenshot.Snap();
     }
 }
 void CaptureScreenshot(IDictionary <string, string> supplement, string screenshotPath)
 {
     try
     {
         Screenshotter.GetScreenshot().SaveAsFile(screenshotPath, ImageFormat.Png);
         supplement["img-full-page-screenshot"] = screenshotPath;
     }
     catch (Exception error)
     {
         Report(error, "img-full-page-screenshot", supplement);
     }
 }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     SelectedHWND = GetSelectedAppHWND();
     if (SelectedHWND != IntPtr.Zero)
     {
         Task.Run(() =>
         {
             Image image = Screenshotter.CaptureWindow(SelectedHWND);
             OnFrameCaptured(image);
         });
     }
 }
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        Screenshotter sc = (Screenshotter)target;

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Screenshot"))
        {
            sc.TakeScreenshot();
        }
    }
示例#7
0
 private void frmDrawInstance_MouseUp(object sender, MouseEventArgs e)
 {
     if (e.Button.Equals(MouseButtons.Left))
     {
         _isSet         = false;
         Cursor.Current = Cursors.Default;
         this.Hide(); // prevent the form from being visible on the screenshot
         Screenshotter.TakeScreenshot(Application.StartupPath, _rect);
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     else if (e.Button.Equals(MouseButtons.Right))
     {
         this.DialogResult = DialogResult.Cancel;
         this.Close();
     }
 }
        public void BeginCapturing()
        {
            SelectedHWND = GetSelectedAppHWND();

            Task.Run(async() =>
            {
                while (IsCapturing)
                {
                    if (SelectedHWND != IntPtr.Zero)
                    {
                        Image image = Screenshotter.CaptureWindow(SelectedHWND);
                        OnFrameCaptured(image);
                    }
                    await Task.Delay(1000 / FPS);
                }
            });
        }
示例#9
0
    private void SetMapIcon(string path, GameObject display)
    {
        string iconPath = Screenshotter.GetMapIconPath(path);

        MeshRenderer renderer = display.GetComponent <MeshRenderer>();
        Material     mat      = new Material(Shader.Find("Legacy Shaders/Diffuse"));

        if (File.Exists(iconPath))
        {
            Texture2D texture = new Texture2D(Screenshotter.SIZE_X, Screenshotter.SIZE_Y, TextureFormat.RGB24, false);
            byte[]    bytes   = File.ReadAllBytes(iconPath);
            texture.LoadImage(bytes, false);
            texture.Apply();
            mat.mainTexture = texture;
        }

        renderer.material = mat;
    }
示例#10
0
    IEnumerator RedeemAnimalRoutine()
    {
        Screenshotter.ScreenshotAndStore();
        float startingY       = operatingTable.position.y;
        bool  animalAscending = false;
        float timer           = 0f;

        gameStateController.OnRedeemAnimal();
        while (timer <= 1f)
        {
            float curveAdd = redeemAnimalCurve.Evaluate(timer);
            operatingTable.MovePosition(new Vector3(operatingTable.position.x, startingY + curveAdd, operatingTable.position.z));
            timer += Time.deltaTime;
            if (timer > 0.15f && !animalAscending)
            {
                animalAscending = true;
                StartCoroutine(OldAnimalAscender(currentAnimal));
            }

            yield return(null);
        }
    }
示例#11
0
    /// <summary>
    /// Takes screenshot of current map and saves it to JPG file.
    /// </summary>
    private void MakeMapMiniature()
    {
        CameraSettings();

        for (int y = 0; y < mapSize.y; y++)
        {
            for (int x = 0; x < mapSize.x; x++)
            {
                grid[y, x].SetActive(false);
            }
        }

        cam.transform.GetChild(0).GetComponent <Camera>().enabled = false;
        Screenshotter.TakeScreenshot(Screenshotter.GetMapIconPath(mapPath), cam);
        cam.transform.GetChild(0).GetComponent <Camera>().enabled = true;

        for (int y = 0; y < mapSize.y; y++)
        {
            for (int x = 0; x < mapSize.x; x++)
            {
                grid[y, x].SetActive(true);
            }
        }
    }
 public void SetInstance()
 {
     inst = this;
 }
示例#13
0
 // Use this for initialization
 void Start()
 {
     takeAshot = screenshotObject.GetComponent <Screenshotter>();
 }
示例#14
0
 private void Awake()
 {
     instance = this;
 }