예제 #1
0
    // internal routine to make a screenshot
    private IEnumerator TakeScreenShootCrt()
    {
        // Turns elements off, to make a "clean" screenshot
        SetUIElementsActive(false);

        // Wait for the next frame
        yield return(new WaitForEndOfFrame());

        // Make a screenshot itself
        var screenShotTexture = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);

        screenShotTexture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
        screenShotTexture.Apply();

        // Turn elements back
        SetUIElementsActive(true);

        // Entity, responsible for handling delete, save and share for screenshot
        var photoOptionsHandler = new PhotoOptionsHandler(screenShotTexture,
                                                          screenShotPreview, cameraOptionsScreen);

        // Pass handler to the options screen, so the screen is relies on handler
        cameraOptionsScreen.InjectHandler(photoOptionsHandler);
        cameraOptionsScreen.Enable();
    }
    /// <summary>
    /// Delete screenshot texture and hide options screen
    /// </summary>
    public override void ResetThing()
    {
        previewImage.gameObject.SetActive(true);
        Destroy(screenShotTexture);
        optionsScreen.Disable();
        ScreenManager.Instance.cameraScreen.Enable();

        var a = new PhotoOptionsHandler(null, null, null);
    }