Skip to content

Commit

Permalink
feat: adds image confirmation element
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxAndreassenRPM committed Nov 23, 2023
1 parent face150 commit d049399
Show file tree
Hide file tree
Showing 8 changed files with 1,458 additions and 739 deletions.
24 changes: 24 additions & 0 deletions Runtime/AvatarCreator/Elements/ImageConfirmationElement.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

public class ImageConfirmationElement : MonoBehaviour
{
[Header("Settings")]
[SerializeField] private RawImage imageTextureTarget;

[Header("Events")]
public UnityEvent<Texture2D> onImageConfirmed;

public void SetTexture(Texture2D texture)
{
imageTextureTarget.texture = texture;
}

public void ConfirmPhoto()
{
var texture = new Texture2D(imageTextureTarget.texture.width, imageTextureTarget.texture.height, TextureFormat.ARGB32, false);

onImageConfirmed?.Invoke(texture);
}
}
21 changes: 0 additions & 21 deletions Runtime/AvatarCreator/Elements/PhotoCaptureConfirmElement.cs

This file was deleted.

1 change: 0 additions & 1 deletion Runtime/AvatarCreator/Elements/PhotoCaptureElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ private void SetupPhotoBoothTexture(string textureName)
{
var size = cameraTextureTarget.rectTransform.sizeDelta;
cameraTexture = new WebCamTexture(textureName, (int) size.x, (int) size.y);
cameraTextureTarget.color = Color.white;
cameraTextureTarget.texture = cameraTexture;
}

Expand Down
Loading

0 comments on commit d049399

Please sign in to comment.