Added a Screenshot save, but it's temporarily disabled.
This commit is contained in:
@@ -342,10 +342,10 @@ LineRenderer:
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Positions:
|
||||
- {x: -0.15602553, y: 4.074945, z: 0}
|
||||
- {x: -0.1566351, y: 3.973638, z: 0}
|
||||
- {x: -0.1572447, y: 3.8729856, z: 0}
|
||||
- {x: -0.15785426, y: 3.7729874, z: 0}
|
||||
- {x: -0.15602553, y: 4.0749445, z: 0}
|
||||
- {x: -0.1566351, y: 3.9736376, z: 0}
|
||||
- {x: -0.1572447, y: 3.8729854, z: 0}
|
||||
- {x: -0.15785426, y: 3.772987, z: 0}
|
||||
- {x: -0.15846384, y: 3.6736436, z: 0}
|
||||
- {x: -0.15907341, y: 3.574954, z: 0}
|
||||
- {x: -0.15968299, y: 3.4769192, z: 0}
|
||||
@@ -823,6 +823,9 @@ MonoBehaviour:
|
||||
square: {fileID: 1946128997}
|
||||
flashInDuration: 0.05
|
||||
flashOutDuration: 0.2
|
||||
photoCanvas: {fileID: 1287627001}
|
||||
photoScale: {x: 0.08, y: 0.08, z: 1}
|
||||
photoPosition: {x: -2.44, y: 2.96, z: 0}
|
||||
--- !u!4 &553184968
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -837,6 +840,7 @@ Transform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1946128999}
|
||||
- {fileID: 1287627002}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &730962732
|
||||
@@ -964,7 +968,7 @@ Transform:
|
||||
m_GameObject: {fileID: 747976396}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 3.197517, z: 0}
|
||||
m_LocalPosition: {x: 0, y: 3.1975174, z: 0}
|
||||
m_LocalScale: {x: 0.57574, y: 0.57574, z: 0.57574}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
@@ -1416,10 +1420,10 @@ LineRenderer:
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Positions:
|
||||
- {x: -0.15602553, y: 4.0749445, z: 0}
|
||||
- {x: -0.11662118, y: 3.879622, z: 0}
|
||||
- {x: -0.07721684, y: 3.7057445, z: 0}
|
||||
- {x: -0.03781248, y: 3.5533106, z: 0}
|
||||
- {x: -0.15602553, y: 4.074945, z: 0}
|
||||
- {x: -0.11662118, y: 3.8796225, z: 0}
|
||||
- {x: -0.07721684, y: 3.7057447, z: 0}
|
||||
- {x: -0.03781248, y: 3.5533109, z: 0}
|
||||
- {x: 0.0015918687, y: 3.4223216, z: 0}
|
||||
- {x: 0.040996216, y: 3.3127766, z: 0}
|
||||
- {x: 0.08040057, y: 3.2246761, z: 0}
|
||||
@@ -1854,6 +1858,96 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2106431002}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1287627001
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1287627002}
|
||||
- component: {fileID: 1287627003}
|
||||
m_Layer: 0
|
||||
m_Name: PhotoCanvas
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1287627002
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1287627001}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -9.57, y: -3.06, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 553184968}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &1287627003
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1287627001}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||
m_RayTracingAccelStructBuildFlags: 1
|
||||
m_SmallMeshCulling: 1
|
||||
m_ForceMeshLod: -1
|
||||
m_MeshLodSelectionBias: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_GlobalIlluminationMeshLod: 0
|
||||
m_SortingLayerID: -1132846201
|
||||
m_SortingLayer: 1
|
||||
m_SortingOrder: 20
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 0.16, y: 0.16}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 0
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &1435210807
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1959,14 +2053,14 @@ LineRenderer:
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Positions:
|
||||
- {x: -0.15602553, y: 4.0749445, z: 0}
|
||||
- {x: -0.18956745, y: 3.8764973, z: 0}
|
||||
- {x: -0.22310936, y: 3.7000232, z: 0}
|
||||
- {x: -0.25665125, y: 3.5455203, z: 0}
|
||||
- {x: -0.15602553, y: 4.074945, z: 0}
|
||||
- {x: -0.18956745, y: 3.8764977, z: 0}
|
||||
- {x: -0.22310936, y: 3.7000234, z: 0}
|
||||
- {x: -0.25665125, y: 3.5455208, z: 0}
|
||||
- {x: -0.29019317, y: 3.412991, z: 0}
|
||||
- {x: -0.32373506, y: 3.3024335, z: 0}
|
||||
- {x: -0.35727698, y: 3.2138484, z: 0}
|
||||
- {x: -0.39081886, y: 3.1472359, z: 0}
|
||||
- {x: -0.35727698, y: 3.2138486, z: 0}
|
||||
- {x: -0.39081886, y: 3.147236, z: 0}
|
||||
- {x: -0.4243608, y: 3.1025958, z: 0}
|
||||
- {x: -0.45790267, y: 3.0799282, z: 0}
|
||||
- {x: -0.4914446, y: 3.079233, z: 0}
|
||||
|
||||
@@ -7,34 +7,57 @@ public class FlashBehaviour : MonoBehaviour
|
||||
public float flashInDuration = 0.05f;
|
||||
public float flashOutDuration = 0.2f;
|
||||
|
||||
//Photo display settings
|
||||
/*public GameObject photoCanvas;
|
||||
private SpriteRenderer photoSpriteRenderer;
|
||||
public Vector3 photoScale = new Vector3(0.2f, 0.2f, 1f);
|
||||
public Vector3 photoPosition = new Vector3(2, 2, 0);*/
|
||||
|
||||
private Color squareColor;
|
||||
private Coroutine flashCoroutine;
|
||||
private SpriteRenderer spriteRenderer;
|
||||
private SpriteRenderer flashSpriteRenderer;
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
||||
if (square == null)
|
||||
square = transform.Find("Square")?.gameObject;
|
||||
|
||||
if (square != null)
|
||||
spriteRenderer = square.GetComponent<SpriteRenderer>();
|
||||
flashSpriteRenderer = square.GetComponent<SpriteRenderer>();
|
||||
|
||||
if (spriteRenderer != null)
|
||||
if (flashSpriteRenderer != null)
|
||||
{
|
||||
squareColor = spriteRenderer.color;
|
||||
squareColor = flashSpriteRenderer.color;
|
||||
squareColor.a = 0;
|
||||
}
|
||||
|
||||
|
||||
// Initialize photoSpriteRenderer if photoCanvas is assigned
|
||||
/*if (photoCanvas != null)
|
||||
{
|
||||
photoSpriteRenderer = photoCanvas.GetComponent<SpriteRenderer>();
|
||||
}*/
|
||||
}
|
||||
|
||||
public void TriggerFlash()
|
||||
{
|
||||
// Use coroutine to ensure capture happens after rendering
|
||||
//StartCoroutine(CaptureAndShow());
|
||||
|
||||
// Flash Effect:
|
||||
if (flashCoroutine != null)
|
||||
StopCoroutine(flashCoroutine);
|
||||
flashCoroutine = StartCoroutine(FlashRoutine());
|
||||
}
|
||||
|
||||
// Capture screen and show photo
|
||||
/*private IEnumerator CaptureAndShow()
|
||||
{
|
||||
yield return new WaitForEndOfFrame();
|
||||
Texture2D screenTexture = ScreenCapture.CaptureScreenshotAsTexture();
|
||||
Debug.Log("Captured Screen Texture: " + screenTexture.width + "x" + screenTexture.height);
|
||||
StartCoroutine(ShowCapturedImage(screenTexture));
|
||||
}*/
|
||||
|
||||
private IEnumerator FlashRoutine()
|
||||
{
|
||||
// Fade in
|
||||
@@ -60,10 +83,35 @@ public class FlashBehaviour : MonoBehaviour
|
||||
|
||||
private void SetAlpha(float alpha)
|
||||
{
|
||||
if (spriteRenderer != null)
|
||||
if (flashSpriteRenderer != null)
|
||||
{
|
||||
squareColor.a = alpha;
|
||||
spriteRenderer.color = squareColor;
|
||||
flashSpriteRenderer.color = squareColor;
|
||||
}
|
||||
}
|
||||
// Show captured image on photo canvas
|
||||
/*private IEnumerator ShowCapturedImage(Texture2D texture)
|
||||
{
|
||||
byte[] pngData = texture.EncodeToPNG();
|
||||
System.IO.File.WriteAllBytes(Application.dataPath + "/../CapturedScreen.png", pngData);
|
||||
Debug.Log("Saved screenshot to: " + Application.dataPath + "/../CapturedScreen.png");
|
||||
|
||||
if (photoSpriteRenderer == null)
|
||||
{
|
||||
Debug.LogWarning("photoSpriteRenderer is not assigned or photoCanvas is missing a SpriteRenderer.");
|
||||
yield break;
|
||||
}
|
||||
|
||||
Sprite capturedSprite = Sprite.Create(
|
||||
texture,
|
||||
new Rect(0, 0, texture.width, texture.height),
|
||||
new Vector2(0.5f, 0.5f),
|
||||
100f
|
||||
);
|
||||
|
||||
photoSpriteRenderer.sprite = capturedSprite;
|
||||
photoCanvas.transform.position = photoPosition;
|
||||
photoCanvas.transform.localScale = photoScale;
|
||||
yield return null;
|
||||
}*/
|
||||
}
|
||||
|
||||
BIN
CapturedScreen.png
Normal file
BIN
CapturedScreen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 782 KiB |
Reference in New Issue
Block a user