Commit da1d4f8c authored by Corantin Hoffert's avatar Corantin Hoffert 💥
Browse files

Merge branch 'hotfix/friends' into 'develop'

Fixed register screen + friends

See merge request fauchezlegouic/projet-integrateur!424
parents 21906476 2243044f
......@@ -4902,6 +4902,7 @@ MonoBehaviour:
passwordInput: {fileID: 5822302927594249008}
password2Input: {fileID: 5822302926895277140}
countryInput: {fileID: 7754588143257939735}
loadingScreen: {fileID: 7928303119564865627}
--- !u!1 &7754588144395110285
GameObject:
m_ObjectHideFlags: 0
......
......@@ -35,6 +35,7 @@ public class ConnectionFields : MonoBehaviour
private void OnDisable()
{
GameManager.Instance.networkManager.OnAuthenticationError -= OnAuthError;
GameManager.Instance.networkManager.OnAuthSuccess -= Loading;
}
private void Loading()
......
......@@ -18,6 +18,8 @@ public class CreationFields : MonoBehaviour
public InputFieldError password2Input;
public InputFieldError countryInput;
public GameObject loadingScreen;
// Input Fields
private TMP_InputField _id;
private TMP_InputField _email;
......@@ -37,11 +39,21 @@ public class CreationFields : MonoBehaviour
_country = countryInput.GetComponentInChildren<TMP_InputField>();
_dropDown = countryInput.GetComponentInChildren<TMP_Dropdown>();
GameManager.Instance.networkManager.OnAuthenticationError += OnAuthError;
GameManager.Instance.networkManager.OnAuthSuccess += Loading;
}
private void OnDisable()
{
GameManager.Instance.networkManager.OnAuthenticationError -= OnAuthError;
GameManager.Instance.networkManager.OnAuthSuccess -= Loading;
}
private void Loading()
{
loadingScreen.SetActive(true);
gameObject.SetActive(false);
loadingScreen.SetActive(true);
GameManager.Instance.networkManager.OnAuthSuccess -= Loading;
}
private void OnAuthError(RejectionReason reason)
......@@ -64,7 +76,6 @@ public class CreationFields : MonoBehaviour
{
PopupManager.ShowPopup("Ooops", TranslationManager.Tr("Une erreur inconnue est survenue..."));
}
}
}
......
......@@ -756,8 +756,8 @@ public class NetworkManager : MonoBehaviour
*/
public void AccountCreation(string username, string password, string email, string country)
{
_username = username;
if (_client != null) return;
_username = username;
ClientSetup();
_client.Send(new CreateAccountMessage(_username, password, email, country));
......
......@@ -128,6 +128,22 @@ public class FriendsUIManager : Singleton<FriendsUIManager>
invitationNotif.onAccept = OnLobbyInvitationAccept;
invitationNotif.onReject = OnLobbyInvitationReject;
NetworkManager.Instance.OnDisconnect += OnDisconnect;
}
private void OnDisable()
{
NetworkManager.Instance.OnDisconnect -= OnDisconnect;
}
private void OnDisconnect()
{
FriendsManager.friendList = new Game.UserInfo[0];
FriendsManager.friendRequestReceivedList = new Game.UserInfo[0];
friendsPanel.ClearFriends();
friendsPanel.ClearFriendRequests();
}
internal void LobbyInvitationCancel(RejectionReason reason, bool timeout)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment