Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ RectTransform:
- {fileID: 3911810628226866637}
- {fileID: 3911810628424708713}
- {fileID: 3911810627461880608}
- {fileID: 7757550704155501701}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
Expand Down Expand Up @@ -5793,7 +5794,7 @@ MonoBehaviour:
_animation: 0
_errorText: {fileID: 3911810627816165819}
_infoPopupPanelPrefab: {fileID: 8067163605015323916, guid: a5a68ec1b8c3c430694abc1729fc5369, type: 3}
_loadingScreenPrefab: {fileID: 3094631411173026328, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
_loadingScreen: {fileID: 181291193031515344}
--- !u!114 &702636062
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -7105,3 +7106,110 @@ MonoBehaviour:
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1001 &2915594493199070920
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 3911810626490335503}
m_Modifications:
- target: {fileID: 3094631411173026328, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_Name
value: LoadingScreen
objectReference: {fileID: 0}
- target: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_RootOrder
value: 3
objectReference: {fileID: 0}
- target: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_AnchorMax.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
--- !u!1 &181291193031515344 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 3094631411173026328, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
m_PrefabInstance: {fileID: 2915594493199070920}
m_PrefabAsset: {fileID: 0}
--- !u!224 &7757550704155501701 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 4890380321044959821, guid: 21aa1af318f304faca1367525db9bc28, type: 3}
m_PrefabInstance: {fileID: 2915594493199070920}
m_PrefabAsset: {fileID: 0}
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Sequence.Authentication;
using Sequence.EmbeddedWallet;
using UnityEngine;
using UnityEngine.UI;
using Random = System.Random;

namespace Sequence.Demo
{
Expand All @@ -15,74 +11,14 @@ public class LoadingScreen : MonoBehaviour
[SerializeField] [Range(0, 255)] private int _maxAlpha = 255;
[SerializeField] [Range(0, 255)] private int _minAlpha = 0;
[SerializeField] private float _animationSpeed = .1f;
private LoginPanel _loginPanel;

private const int DefaultFullAlphaValue = 255;

private void OnEnable()
{
_loginPanel = FindObjectOfType<LoginPanel>();
if (_loginPanel != null)
{
_loginPanel.LoginHandler.OnLoginSuccess += OnLoginSuccessHandler;
_loginPanel.LoginHandler.OnMFAEmailSent += OnMFAEmailSentHandler;
_loginPanel.LoginHandler.OnLoginFailed += OnLoginFailedHandler;
_loginPanel.LoginHandler.OnMFAEmailFailedToSend += OnMFAEmailFailedToSendHandler;
SequenceWallet.OnAccountFederationFailed += OnAccountFederationFailedHandler;
SequenceWallet.OnAccountFederated += OnAccountFederatedHandler;
}
else
{
Debug.LogError("No LoginPanel found!");
Destroy(gameObject);
}

StartCoroutine(LoadingAnimation());
}

private void OnDestroy()
{
if (_loginPanel != null)
{
_loginPanel.LoginHandler.OnLoginSuccess -= OnLoginSuccessHandler;
_loginPanel.LoginHandler.OnMFAEmailSent -= OnMFAEmailSentHandler;
_loginPanel.LoginHandler.OnLoginFailed -= OnLoginFailedHandler;
_loginPanel.LoginHandler.OnMFAEmailFailedToSend -= OnMFAEmailFailedToSendHandler;
SequenceWallet.OnAccountFederationFailed -= OnAccountFederationFailedHandler;
SequenceWallet.OnAccountFederated -= OnAccountFederatedHandler;
}
}

private void OnLoginSuccessHandler(string sessionId, string walletAddress)
{
Destroy(gameObject);
}

private void OnMFAEmailSentHandler(string email)
{
Destroy(gameObject);
}

private void OnLoginFailedHandler(string error, LoginMethod method, string email, List<LoginMethod> loginMethods)
{
Destroy(gameObject);
}

private void OnMFAEmailFailedToSendHandler(string email, string error)
{
Destroy(gameObject);
}

private void OnAccountFederationFailedHandler(string error)
{
Destroy(gameObject);
}

private void OnAccountFederatedHandler(Account account)
{
Destroy(gameObject);
}

private IEnumerator LoadingAnimation()
{
int numberOfCircles = _circles.Length;
Expand Down Expand Up @@ -153,24 +89,5 @@ private int[] ShiftIndices(int[] indicesArray)

return shifted;
}

private void OnApplicationFocus(bool hasFocus)
{
#if !UNITY_IOS
if (hasFocus)
{
StartCoroutine(DestroyIfNotLoggingIn());
}
#endif
}

private IEnumerator DestroyIfNotLoggingIn()
{
yield return new WaitForSecondsRealtime(0.1f);
if (!_loginPanel.LoginHandler.IsLoggingIn())
{
Destroy(gameObject);
}
}
}
}
Loading