Skip to content

Commit

Permalink
feat: add account creaation element
Browse files Browse the repository at this point in the history
  • Loading branch information
rYuuk committed Dec 4, 2023
1 parent bfdc1af commit 281dee2
Show file tree
Hide file tree
Showing 9 changed files with 1,100 additions and 18 deletions.
1,074 changes: 1,074 additions & 0 deletions Runtime/AvatarCreator/Prefabs/Elements/AccountCreationElement.prefab

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
using System;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.AvatarCreator
{
public class AccountCreationPopup : MonoBehaviour
public class AccountCreationElement : MonoBehaviour
{
[SerializeField] private InputField emailField;
[SerializeField] private Button sendEmailButton;
[SerializeField] private Button continueWithoutSignupButton;
[SerializeField] private Button closeButton;

public event Action<string> OnSendEmail;
public event Action OnContinueWithoutSignup;
public UnityEvent<string> onSendEmail;
public UnityEvent onContinueWithoutSignup;

private void Update()
{
Expand All @@ -24,27 +23,24 @@ private void OnEnable()
{
sendEmailButton.onClick.AddListener(OnSendEmailButton);
continueWithoutSignupButton.onClick.AddListener(OnContinueWithoutSignupButton);
closeButton.onClick.AddListener(OnContinueWithoutSignupButton);
}

private void OnDisable()
{
sendEmailButton.onClick.RemoveListener(OnSendEmailButton);
continueWithoutSignupButton.onClick.RemoveListener(OnContinueWithoutSignupButton);
closeButton.onClick.RemoveListener(OnContinueWithoutSignupButton);
}


private void OnSendEmailButton()
{
var email = emailField.text;
OnSendEmail?.Invoke(email);
onSendEmail?.Invoke(email);
gameObject.SetActive(false);
}

private void OnContinueWithoutSignupButton()
{
OnContinueWithoutSignup?.Invoke();
onContinueWithoutSignup?.Invoke();
gameObject.SetActive(false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &8393542494968090121
RectTransform:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16668,6 +16668,11 @@ PrefabInstance:
propertyPath: accountCreationPopup
value:
objectReference: {fileID: 1181375370}
- target: {fileID: 57378948363611735, guid: 94e6adc5c795ff348bce129db0368b1f,
type: 3}
propertyPath: accountCreationElement
value:
objectReference: {fileID: 1181375370}
- target: {fileID: 426946072540919372, guid: 94e6adc5c795ff348bce129db0368b1f,
type: 3}
propertyPath: m_AnchorMax.y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class AvatarCreatorSelection : State, IDisposable
[SerializeField] private Button saveButton;
[SerializeField] private AvatarConfig inCreatorConfig;
[SerializeField] private RuntimeAnimatorController animator;
[SerializeField] private AccountCreationPopup accountCreationPopup;
[SerializeField] private AccountCreationElement accountCreationElement;

private PartnerAssetsManager partnerAssetManager;
private AvatarManager avatarManager;
Expand All @@ -43,17 +43,17 @@ private void Start()
public override void ActivateState()
{
saveButton.onClick.AddListener(OnSaveButton);
accountCreationPopup.OnSendEmail += OnSendEmail;
accountCreationPopup.OnContinueWithoutSignup += Save;
accountCreationElement.onSendEmail.AddListener(OnSendEmail);
accountCreationElement.onContinueWithoutSignup.AddListener(Save);
categoryUICreator.OnCategorySelected += OnCategorySelected;
Setup();
}

public override void DeactivateState()
{
saveButton.onClick.RemoveListener(OnSaveButton);
accountCreationPopup.OnSendEmail -= OnSendEmail;
accountCreationPopup.OnContinueWithoutSignup -= Save;
accountCreationElement.onSendEmail.RemoveListener(OnSendEmail);
accountCreationElement.onContinueWithoutSignup.RemoveListener(Save);
categoryUICreator.OnCategorySelected -= OnCategorySelected;
Cleanup();
}
Expand Down Expand Up @@ -236,7 +236,7 @@ private void OnSaveButton()
}
else
{
accountCreationPopup.gameObject.SetActive(true);
accountCreationElement.gameObject.SetActive(true);
}
}

Expand Down

0 comments on commit 281dee2

Please sign in to comment.