Exemplo n.º 1
0
    public static void CaptureScreenShot(CaptureScreenShotCallbackMethod captureScreenShotCallback)
    {
        if (ReignServices.captureScreenShotCallback != null)
        {
            Debug.LogError("You must wait until CaptureScreenShot has finished!");
            return;
        }

        ReignServices.captureScreenShotCallback = captureScreenShotCallback;
        RequestEndOfFrame(captureScreenShotEndOfFrame);
    }
Exemplo n.º 2
0
    private static void captureScreenShotEndOfFrame()
    {
        var width   = Screen.width;
        var height  = Screen.height;
        var texture = new Texture2D(width, height, TextureFormat.RGB24, false);

        texture.ReadPixels(new Rect(0, 0, width, height), 0, 0);
        texture.Apply();
        var data = texture.EncodeToPNG();

        GameObject.Destroy(texture);

        if (captureScreenShotCallback != null)
        {
            captureScreenShotCallback(data);
        }
        captureScreenShotCallback = null;
    }
Exemplo n.º 3
0
	public static void CaptureScreenShot(CaptureScreenShotCallbackMethod captureScreenShotCallback)
	{
		if (ReignServices.captureScreenShotCallback != null)
		{
			Debug.LogError("You must wait until CaptureScreenShot has finished!");
			return;
		}

		ReignServices.captureScreenShotCallback = captureScreenShotCallback;
		RequestEndOfFrame(captureScreenShotEndOfFrame);
	}
Exemplo n.º 4
0
	private static void captureScreenShotEndOfFrame()
	{
		var width = Screen.width;
		var height = Screen.height;
		var texture = new Texture2D(width, height, TextureFormat.RGB24, false);
		texture.ReadPixels(new Rect(0, 0, width, height), 0, 0);
		texture.Apply();
		var data = texture.EncodeToPNG();
		GameObject.Destroy(texture);

		if (captureScreenShotCallback != null) captureScreenShotCallback(data);
		captureScreenShotCallback = null;
	}