Skip to content

Commit

Permalink
chore: fix naming and namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
HarrisonHough committed Jan 11, 2024
1 parent 9375eca commit 46c5ac7
Show file tree
Hide file tree
Showing 30 changed files with 92 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
using UnityEditor;
using UnityEngine;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator.Editor
{
[CustomEditor(typeof(AvatarCreatorStateMachine)), CanEditMultipleObjects]
public class AvatarCreatorStateMachineEditor : Editor
public class AvatarCreatorStateMachineEditor : UnityEditor.Editor
{
private AvatarCreatorStateMachine avatarCreatorStateMachine;
private string[] genderOptions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "ReadyPlayerMe.Core.LegacyAvatarCreator.Editor",
"name": "ReadyPlayerMe.Samples.LegacyAvatarCreator.Editor",
"rootNamespace": "",
"references": [
"ReadyPlayerMe.Core",
"ReadyPlayerMe.Core.LegacyAvatarCreator",
"ReadyPlayerMe.Samples.LegacyAvatarCreator",
"ReadyPlayerMe.AvatarCreator"
],
"includePlatforms": [
Expand Down

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,5 +1,5 @@
{
"name": "ReadyPlayerMe.Core.LegacyAvatarCreator",
"name": "ReadyPlayerMe.Samples.LegacyAvatarCreator",
"rootNamespace": "",
"references": [
"ReadyPlayerMe.Core",
Expand Down

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,7 +1,7 @@
using ReadyPlayerMe.AvatarCreator;
using UnityEngine;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
[CreateAssetMenu(fileName = "AvatarCreatorData", menuName = "Ready Player Me/Avatar Creator Data", order = 1)]
public class AvatarCreatorData : ScriptableObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using ReadyPlayerMe.Core;
using UnityEngine;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public class GameManager : MonoBehaviour
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using ReadyPlayerMe.Core;
using UnityEngine;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public class ProfileManager : MonoBehaviour
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using UnityEngine;
using UnityEngine.UI;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public class AssetButtonCreator : MonoBehaviour
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using UnityEngine;
using UnityEngine.UI;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public class AvatarCreatorStateMachine : StateMachine
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using UnityEngine;
using UnityEngine.UI;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public class AssetButton : MonoBehaviour
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using UnityEngine.EventSystems;
using UnityEngine.UI;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public class AvatarButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using UnityEngine;
using UnityEngine.UI;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public class CategoryButton : MonoBehaviour
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using ReadyPlayerMe.Core;
using UnityEngine;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public class CategoryUICreator : MonoBehaviour
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using UnityEngine;
using UnityEngine.UI;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public class DebugPanel : MonoBehaviour
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using UnityEngine;
using UnityEngine.UI;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public class LoadingManager : MonoBehaviour
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using ReadyPlayerMe.AvatarCreator;
using UnityEngine;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public static class PanelSwitcher
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using UnityEngine;
using UnityEngine.UI;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public class ProfileUI : MonoBehaviour
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using UnityEngine;
using UnityEngine.UI;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public class AvatarCreatorSelection : State, IDisposable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using UnityEngine;
using UnityEngine.UI;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public class AvatarSelection : State
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using UnityEngine;
using UnityEngine.UI;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public class BodyTypeSelection : State
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using UnityEngine;
using UnityEngine.UI;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public class CameraPhotoSelection : State
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using UnityEngine;
using UnityEngine.UI;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public class DefaultAvatarSelection : State
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using UnityEngine;
using UnityEngine.UI;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public class GenderSelection : State
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,77 +4,80 @@
using UnityEngine;
using UnityEngine.UI;

public class LoginWithEmailSelection : State
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
private const string TAG = nameof(LoginWithEmailSelection);
public class LoginWithEmailSelection : State
{
private const string TAG = nameof(LoginWithEmailSelection);

[SerializeField] private Button sendActivationCodeButton;
[SerializeField] private Button haveCodeButton;
[SerializeField] private Button changeEmailButton;
[SerializeField] private Button loginButton;
[SerializeField] private Button sendActivationCodeButton;
[SerializeField] private Button haveCodeButton;
[SerializeField] private Button changeEmailButton;
[SerializeField] private Button loginButton;

[SerializeField] private InputField emailField;
[SerializeField] private InputField codeField;
[SerializeField] private InputField emailField;
[SerializeField] private InputField codeField;

[SerializeField] private GameObject emailPanel;
[SerializeField] private GameObject codePanel;
[SerializeField] private GameObject emailPanel;
[SerializeField] private GameObject codePanel;

public override StateType StateType => StateType.LoginWithCodeFromEmail;
public override StateType NextState => StateType.BodyTypeSelection;
public override StateType StateType => StateType.LoginWithCodeFromEmail;
public override StateType NextState => StateType.BodyTypeSelection;

public override void ActivateState()
{
sendActivationCodeButton.onClick.AddListener(OnSendActivationCode);
haveCodeButton.onClick.AddListener(OnHaveCodeButton);
changeEmailButton.onClick.AddListener(OnChangeEmail);
loginButton.onClick.AddListener(OnLogin);
}
public override void ActivateState()
{
sendActivationCodeButton.onClick.AddListener(OnSendActivationCode);
haveCodeButton.onClick.AddListener(OnHaveCodeButton);
changeEmailButton.onClick.AddListener(OnChangeEmail);
loginButton.onClick.AddListener(OnLogin);
}

public override void DeactivateState()
{
sendActivationCodeButton.onClick.RemoveListener(OnSendActivationCode);
haveCodeButton.onClick.RemoveListener(OnHaveCodeButton);
changeEmailButton.onClick.RemoveListener(OnChangeEmail);
loginButton.onClick.RemoveListener(OnLogin);
}
public override void DeactivateState()
{
sendActivationCodeButton.onClick.RemoveListener(OnSendActivationCode);
haveCodeButton.onClick.RemoveListener(OnHaveCodeButton);
changeEmailButton.onClick.RemoveListener(OnChangeEmail);
loginButton.onClick.RemoveListener(OnLogin);
}

private void OnSendActivationCode()
{
AuthManager.SendEmailCode(emailField.text);
OnHaveCodeButton();
}
private void OnSendActivationCode()
{
AuthManager.SendEmailCode(emailField.text);
OnHaveCodeButton();
}

private void OnHaveCodeButton()
{
emailPanel.SetActive(false);
codePanel.SetActive(true);
}
private void OnHaveCodeButton()
{
emailPanel.SetActive(false);
codePanel.SetActive(true);
}

private void OnChangeEmail()
{
emailPanel.SetActive(true);
codePanel.SetActive(false);
}
private void OnChangeEmail()
{
emailPanel.SetActive(true);
codePanel.SetActive(false);
}

private async void OnLogin()
{
LoadingManager.EnableLoading("Signing In");
private async void OnLogin()
{
LoadingManager.EnableLoading("Signing In");

AuthManager.OnSignInError += OnSignInError;
AuthManager.OnSignInError += OnSignInError;

if (await AuthManager.LoginWithCode(codeField.text))
{
OnChangeEmail();
LoadingManager.DisableLoading();
StateMachine.SetState(StateType.AvatarSelection);
SDKLogger.Log(TAG, "Login successful");
if (await AuthManager.LoginWithCode(codeField.text))
{
OnChangeEmail();
LoadingManager.DisableLoading();
StateMachine.SetState(StateType.AvatarSelection);
SDKLogger.Log(TAG, "Login successful");
}
}
}

private void OnSignInError(string error)
{
AuthManager.OnSignInError -= OnSignInError;
LoadingManager.EnableLoading(error, LoadingManager.LoadingType.Popup, false);
SDKLogger.Log(TAG, $"Login failed with error: {error}");
private void OnSignInError(string error)
{
AuthManager.OnSignInError -= OnSignInError;
LoadingManager.EnableLoading(error, LoadingManager.LoadingType.Popup, false);
SDKLogger.Log(TAG, $"Login failed with error: {error}");
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using UnityEngine;
using UnityEngine.UI;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public class SeflieSelection : State
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using UnityEngine;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public enum StateType
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using UnityEngine;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public abstract class StateMachine : MonoBehaviour
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using ReadyPlayerMe.AvatarCreator;
using UnityEngine;

namespace ReadyPlayerMe
namespace ReadyPlayerMe.Samples.LegacyAvatarCreator
{
public class CameraZoom : MonoBehaviour
{
Expand Down
Loading

0 comments on commit 46c5ac7

Please sign in to comment.