Login page converted
This commit is contained in:
@@ -14,7 +14,7 @@ public class LoginManager : MonoBehaviour
|
||||
public TMP_InputField reg_password;
|
||||
public Button regBtn;
|
||||
|
||||
public OtherUIbuttons otherUI;
|
||||
// public OtherUIbuttons otherUI;
|
||||
public BuildingData defaultBuilding;
|
||||
|
||||
void Start()
|
||||
@@ -39,17 +39,11 @@ public class LoginManager : MonoBehaviour
|
||||
|
||||
public void OnLoginClicked(){
|
||||
if(login_username.text.Length < 2){
|
||||
if(otherUI!=null){
|
||||
otherUI.ErrorAuth();
|
||||
}
|
||||
// MessageDialogInstance.messageDialog.ShowDialog("Error", "Please use a valid Username (should be more than 2 characters)");
|
||||
MessageDialog.instance.ShowDialog("Invalid!", "The username you entered is invalid");
|
||||
return;
|
||||
}
|
||||
if(login_password.text.Length < 5){
|
||||
if(otherUI!=null){
|
||||
otherUI.ErrorAuth();
|
||||
}
|
||||
// MessageDialogInstance.messageDialog.ShowDialog("Error", "Please use a Strong password (should be more than 5 characters)");
|
||||
MessageDialog.instance.ShowDialog("Invalid!", "The password you entered is invalid");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -57,11 +51,11 @@ public class LoginManager : MonoBehaviour
|
||||
}
|
||||
public void OnRegisterClicked(){
|
||||
if(reg_username.text.Length < 2){
|
||||
MessageDialogInstance.messageDialog.ShowDialog("Error", "Please use a valid Username (should be more than 2 characters)");
|
||||
MessageDialog.instance.ShowDialog("Couldn't Register", "Please use a valid Username (should be more than 2 characters)");
|
||||
return;
|
||||
}
|
||||
if(reg_password.text.Length < 5){
|
||||
MessageDialogInstance.messageDialog.ShowDialog("Error", "Please use a Strong password (should be more than 5 characters)");
|
||||
MessageDialog.instance.ShowDialog("Couldn't Register", "Please use a Strong password (should be more than 5 characters)");
|
||||
return;
|
||||
}
|
||||
Debug.Log("Clicked register");
|
||||
@@ -104,6 +98,7 @@ public class LoginManager : MonoBehaviour
|
||||
else
|
||||
{
|
||||
Debug.Log("User Login failed. Error #" + www.text);
|
||||
MessageDialog.instance.ShowDialog("Error!", "Sorry, We couldn't log you in,\n Error: " + www.text);
|
||||
}
|
||||
loginBtn.interactable=true;
|
||||
}
|
||||
@@ -130,6 +125,8 @@ public class LoginManager : MonoBehaviour
|
||||
else
|
||||
{
|
||||
Debug.Log("User creation failed " + www.text);
|
||||
MessageDialog.instance.ShowDialog("Error!", "Sorry, We couldn't Register you,\n Error: " + www.text);
|
||||
|
||||
}
|
||||
regBtn.interactable=true;
|
||||
}
|
||||
|
||||
@@ -6,15 +6,18 @@ using UnityEngine.UI;
|
||||
[RequireComponent(typeof(CanvasGroup))]
|
||||
public class MessageDialog : MonoBehaviour
|
||||
{
|
||||
public Text titleTxt;
|
||||
public Text messageTxt;
|
||||
|
||||
private static MessageDialog m_instance;
|
||||
public static MessageDialog instance=>m_instance;
|
||||
public TMPro.TMP_Text titleTxt;
|
||||
public TMPro.TMP_Text messageTxt;
|
||||
public Button actionBtn;
|
||||
|
||||
public bool showing => GetComponent<CanvasGroup>().blocksRaycasts;
|
||||
|
||||
void Start()
|
||||
{
|
||||
MessageDialogInstance.messageDialog = this;
|
||||
m_instance = this;
|
||||
actionBtn.onClick.AddListener(OnAction);
|
||||
SetActive(false);
|
||||
}
|
||||
@@ -38,7 +41,3 @@ public class MessageDialog : MonoBehaviour
|
||||
GetComponent<CanvasGroup>().alpha= (value) ? 1: 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static class MessageDialogInstance{
|
||||
public static MessageDialog messageDialog;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user