Bazooka Manager is basically complete now (after 2+ weeks) and start working on server rewrite
This commit is contained in:
@@ -37,8 +37,8 @@ public class AccountChangePassword : MonoBehaviour
|
||||
EncryptedWWWForm dataForm = new();
|
||||
dataForm.AddField("inputPassword", changePasswordCurrentPasswordInput.text);
|
||||
dataForm.AddField("inputNewPassword", changePasswordNewPasswordInput.text);
|
||||
dataForm.AddField("session", PlayerPrefs.GetString("gameSession"));
|
||||
dataForm.AddField("userName", PlayerPrefs.GetString("userName"));
|
||||
dataForm.AddField("session", BazookaManager.Instance.GetAccountSession());
|
||||
dataForm.AddField("userName", BazookaManager.Instance.GetAccountName());
|
||||
using UnityWebRequest request = UnityWebRequest.Post(SensitiveInfo.SERVER_DATABASE_PREFIX + "changeAccountPassword.php", dataForm.GetWWWForm());
|
||||
request.SetRequestHeader("Requester", "BerryDashClient");
|
||||
request.SetRequestHeader("ClientVersion", Application.version);
|
||||
@@ -82,7 +82,7 @@ public class AccountChangePassword : MonoBehaviour
|
||||
}
|
||||
if (Regex.IsMatch(response, "^[a-zA-Z0-9]{512}$"))
|
||||
{
|
||||
PlayerPrefs.SetString("gameSession", response);
|
||||
BazookaManager.Instance.SetAccountSession(response);
|
||||
AccountHandler.instance.SwitchPanel(0);
|
||||
AccountHandler.UpdateStatusText(AccountHandler.instance.accountLoggedIn.loggedInText, "Password changed successfully", Color.green);
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ public class AccountChangeUsername : MonoBehaviour
|
||||
EncryptedWWWForm dataForm = new();
|
||||
dataForm.AddField("inputUserName", changeUsernameCurrentUsernameInput.text);
|
||||
dataForm.AddField("inputNewUserName", changeUsernameNewUsernameInput.text);
|
||||
dataForm.AddField("session", PlayerPrefs.GetString("gameSession"));
|
||||
dataForm.AddField("userName", PlayerPrefs.GetString("userName"));
|
||||
dataForm.AddField("session", BazookaManager.Instance.GetAccountSession());
|
||||
dataForm.AddField("userName", BazookaManager.Instance.GetAccountName());
|
||||
using UnityWebRequest request = UnityWebRequest.Post(SensitiveInfo.SERVER_DATABASE_PREFIX + "changeAccountUsername.php", dataForm.GetWWWForm());
|
||||
request.SetRequestHeader("Requester", "BerryDashClient");
|
||||
request.SetRequestHeader("ClientVersion", Application.version);
|
||||
@@ -57,7 +57,7 @@ public class AccountChangeUsername : MonoBehaviour
|
||||
AccountHandler.UpdateStatusText(changeUsernameStatusText, "Can't send requests on self-built instance", Color.red);
|
||||
break;
|
||||
case "1":
|
||||
PlayerPrefs.SetString("userName", changeUsernameNewUsernameInput.text);
|
||||
BazookaManager.Instance.SetAccountName(changeUsernameNewUsernameInput.text);
|
||||
AccountHandler.instance.SwitchPanel(0);
|
||||
AccountHandler.UpdateStatusText(AccountHandler.instance.accountLoggedIn.loggedInText, "Username changed successfully", Color.green);
|
||||
break;
|
||||
|
||||
@@ -19,7 +19,7 @@ public class AccountHandler : MonoBehaviour
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (PlayerPrefs.HasKey("gameSession") && PlayerPrefs.HasKey("userName") && PlayerPrefs.HasKey("userId"))
|
||||
if (BazookaManager.Instance.GetAccountID() != null && BazookaManager.Instance.GetAccountName() != null && BazookaManager.Instance.GetAccountSession() != null)
|
||||
{
|
||||
SwitchPanel(0);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using System.Numerics;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
@@ -35,7 +37,7 @@ public class AccountLoggedIn : MonoBehaviour
|
||||
{
|
||||
loggedInSaveButton.interactable = true;
|
||||
loggedInLoadButton.interactable = true;
|
||||
loggedInText.text = "Logged in as: " + PlayerPrefs.GetString("userName");
|
||||
loggedInText.text = "Logged in as: " + BazookaManager.Instance.GetAccountName();
|
||||
}
|
||||
|
||||
async void SaveAccount()
|
||||
@@ -43,23 +45,23 @@ public class AccountLoggedIn : MonoBehaviour
|
||||
loggedInLoadButton.interactable = false;
|
||||
loggedInSaveButton.interactable = false;
|
||||
EncryptedWWWForm dataForm = new();
|
||||
dataForm.AddField("userName", PlayerPrefs.GetString("userName", ""));
|
||||
dataForm.AddField("gameSession", PlayerPrefs.GetString("gameSession", ""));
|
||||
dataForm.AddField("highScore", PlayerPrefs.GetString("HighScoreV2", "0"));
|
||||
dataForm.AddField("icon", PlayerPrefs.GetInt("icon", 1).ToString());
|
||||
dataForm.AddField("overlay", PlayerPrefs.GetInt("overlay", 0).ToString());
|
||||
dataForm.AddField("totalNormalBerries", PlayerPrefs.GetString("TotalNormalBerries", "0"));
|
||||
dataForm.AddField("totalPoisonBerries", PlayerPrefs.GetString("TotalPoisonBerries", "0"));
|
||||
dataForm.AddField("totalSlowBerries", PlayerPrefs.GetString("TotalSlowBerries", "0"));
|
||||
dataForm.AddField("totalUltraBerries", PlayerPrefs.GetString("TotalUltraBerries", "0"));
|
||||
dataForm.AddField("totalSpeedyBerries", PlayerPrefs.GetString("TotalSpeedyBerries", "0"));
|
||||
dataForm.AddField("totalAttempts", PlayerPrefs.GetString("TotalAttempts", "0"));
|
||||
dataForm.AddField("birdR", PlayerPrefs.GetString("BirdColor", "255;255;255").Split(';')[0]);
|
||||
dataForm.AddField("birdG", PlayerPrefs.GetString("BirdColor", "255;255;255").Split(';')[1]);
|
||||
dataForm.AddField("birdB", PlayerPrefs.GetString("BirdColor", "255;255;255").Split(';')[2]);
|
||||
dataForm.AddField("overlayR", PlayerPrefs.GetString("OverlayColor", "255;255;255").Split(';')[0]);
|
||||
dataForm.AddField("overlayG", PlayerPrefs.GetString("OverlayColor", "255;255;255").Split(';')[1]);
|
||||
dataForm.AddField("overlayB", PlayerPrefs.GetString("OverlayColor", "255;255;255").Split(';')[2]);
|
||||
dataForm.AddField("userName", BazookaManager.Instance.GetAccountName());
|
||||
dataForm.AddField("gameSession", BazookaManager.Instance.GetAccountSession());
|
||||
dataForm.AddField("highScore", BazookaManager.Instance.GetGameStoreHighScore().ToString());
|
||||
dataForm.AddField("icon", BazookaManager.Instance.GetBirdIcon().ToString());
|
||||
dataForm.AddField("overlay", BazookaManager.Instance.GetBirdOverlay().ToString());
|
||||
dataForm.AddField("totalNormalBerries", BazookaManager.Instance.GetGameStoreTotalNormalBerries().ToString());
|
||||
dataForm.AddField("totalPoisonBerries", BazookaManager.Instance.GetGameStoreTotalPoisonBerries().ToString());
|
||||
dataForm.AddField("totalSlowBerries", BazookaManager.Instance.GetGameStoreTotalSlowBerries().ToString());
|
||||
dataForm.AddField("totalUltraBerries", BazookaManager.Instance.GetGameStoreTotalUltraBerries().ToString());
|
||||
dataForm.AddField("totalSpeedyBerries", BazookaManager.Instance.GetGameStoreTotalSpeedyBerries().ToString());
|
||||
dataForm.AddField("totalAttempts", BazookaManager.Instance.GetGameStoreTotalAttepts().ToString());
|
||||
dataForm.AddField("birdR", BazookaManager.Instance.GetColorSettingIcon()[0].ToString());
|
||||
dataForm.AddField("birdG", BazookaManager.Instance.GetColorSettingIcon()[1].ToString());
|
||||
dataForm.AddField("birdB", BazookaManager.Instance.GetColorSettingIcon()[2].ToString());
|
||||
dataForm.AddField("overlayR", BazookaManager.Instance.GetColorSettingOverlay()[0].ToString());
|
||||
dataForm.AddField("overlayG", BazookaManager.Instance.GetColorSettingOverlay()[1].ToString());
|
||||
dataForm.AddField("overlayB", BazookaManager.Instance.GetColorSettingOverlay()[2].ToString());
|
||||
using UnityWebRequest request = UnityWebRequest.Post(SensitiveInfo.SERVER_DATABASE_PREFIX + "saveAccount.php", dataForm.GetWWWForm());
|
||||
request.SetRequestHeader("Requester", "BerryDashClient");
|
||||
request.SetRequestHeader("ClientVersion", Application.version);
|
||||
@@ -104,8 +106,8 @@ public class AccountLoggedIn : MonoBehaviour
|
||||
loggedInLoadButton.interactable = false;
|
||||
loggedInSaveButton.interactable = false;
|
||||
EncryptedWWWForm dataForm = new();
|
||||
dataForm.AddField("userName", PlayerPrefs.GetString("userName", ""));
|
||||
dataForm.AddField("gameSession", PlayerPrefs.GetString("gameSession", ""));
|
||||
dataForm.AddField("userName", BazookaManager.Instance.GetAccountName());
|
||||
dataForm.AddField("gameSession", BazookaManager.Instance.GetAccountSession());
|
||||
using UnityWebRequest request = UnityWebRequest.Post(SensitiveInfo.SERVER_DATABASE_PREFIX + "loadAccount.php", dataForm.GetWWWForm());
|
||||
request.SetRequestHeader("Requester", "BerryDashClient");
|
||||
request.SetRequestHeader("ClientVersion", Application.version);
|
||||
@@ -138,17 +140,25 @@ public class AccountLoggedIn : MonoBehaviour
|
||||
var split = response.Split(":");
|
||||
if (split[0] == "1")
|
||||
{
|
||||
PlayerPrefs.SetString("HighScoreV2", split[1]);
|
||||
PlayerPrefs.SetInt("icon", int.Parse(split[2]));
|
||||
PlayerPrefs.SetInt("overlay", int.Parse(split[3]));
|
||||
PlayerPrefs.SetString("TotalNormalBerries", split[4]);
|
||||
PlayerPrefs.SetString("TotalPoisonBerries", split[5]);
|
||||
PlayerPrefs.SetString("TotalSlowBerries", split[6]);
|
||||
PlayerPrefs.SetString("TotalUltraBerries", split[7]);
|
||||
PlayerPrefs.SetString("TotalSpeedyBerries", split[8]);
|
||||
PlayerPrefs.SetString("TotalAttempts", split[9]);
|
||||
PlayerPrefs.SetString("BirdColor", $"{split[10]};{split[11]};{split[12]}");
|
||||
PlayerPrefs.SetString("OverlayColor", $"{split[13]};{split[14]};{split[15]}");
|
||||
BazookaManager.Instance.SetGameStoreHighScore(BigInteger.Parse(split[1]));
|
||||
BazookaManager.Instance.SetBirdIcon(int.Parse(split[2]));
|
||||
BazookaManager.Instance.SetBirdOverlay(int.Parse(split[3]));
|
||||
BazookaManager.Instance.SetGameStoreTotalNormalBerries(BigInteger.Parse(split[4]));
|
||||
BazookaManager.Instance.SetGameStoreTotalPoisonBerries(BigInteger.Parse(split[5]));
|
||||
BazookaManager.Instance.SetGameStoreTotalSlowBerries(BigInteger.Parse(split[6]));
|
||||
BazookaManager.Instance.SetGameStoreTotalUltraBerries(BigInteger.Parse(split[7]));
|
||||
BazookaManager.Instance.SetGameStoreTotalSpeedyBerries(BigInteger.Parse(split[8]));
|
||||
BazookaManager.Instance.SetGameStoreTotalAttepts(BigInteger.Parse(split[9]));
|
||||
BazookaManager.Instance.SetColorSettingIcon(new JArray(
|
||||
int.Parse(split[10]),
|
||||
int.Parse(split[11]),
|
||||
int.Parse(split[12])
|
||||
));
|
||||
BazookaManager.Instance.SetColorSettingOverlay(new JArray(
|
||||
int.Parse(split[13]),
|
||||
int.Parse(split[14]),
|
||||
int.Parse(split[15])
|
||||
));
|
||||
AccountHandler.UpdateStatusText(loggedInText, "Loaded account data", Color.green);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -20,20 +20,20 @@ public class AccountLoggedOut : MonoBehaviour
|
||||
{
|
||||
if (clearValues)
|
||||
{
|
||||
PlayerPrefs.DeleteKey("gameSession");
|
||||
PlayerPrefs.DeleteKey("userName");
|
||||
PlayerPrefs.DeleteKey("userId");
|
||||
PlayerPrefs.SetString("HighScoreV2", "0");
|
||||
PlayerPrefs.SetInt("icon", 1);
|
||||
PlayerPrefs.SetInt("overlay", 0);
|
||||
PlayerPrefs.DeleteKey("TotalNormalBerries");
|
||||
PlayerPrefs.DeleteKey("TotalPoisonBerries");
|
||||
PlayerPrefs.DeleteKey("TotalSlowBerries");
|
||||
PlayerPrefs.DeleteKey("TotalUltraBerries");
|
||||
PlayerPrefs.DeleteKey("TotalSpeedyBerries");
|
||||
PlayerPrefs.DeleteKey("TotalAttempts");
|
||||
PlayerPrefs.DeleteKey("BirdColor");
|
||||
PlayerPrefs.DeleteKey("OverlayColor");
|
||||
BazookaManager.Instance.UnsetAccountSession();
|
||||
BazookaManager.Instance.UnsetAccountName();
|
||||
BazookaManager.Instance.UnsetAccountID();
|
||||
BazookaManager.Instance.UnsetGameStoreHighScore();
|
||||
BazookaManager.Instance.UnsetBirdIcon();
|
||||
BazookaManager.Instance.UnsetBirdOverlay();
|
||||
BazookaManager.Instance.UnsetGameStoreTotalNormalBerries();
|
||||
BazookaManager.Instance.UnsetGameStoreTotalPoisonBerries();
|
||||
BazookaManager.Instance.UnsetGameStoreTotalSlowBerries();
|
||||
BazookaManager.Instance.UnsetGameStoreTotalUltraBerries();
|
||||
BazookaManager.Instance.UnsetGameStoreTotalSpeedyBerries();
|
||||
BazookaManager.Instance.UnsetGameStoreTotalAttepts();
|
||||
BazookaManager.Instance.UnsetColorSettingIcon();
|
||||
BazookaManager.Instance.UnsetColorSettingOverlay();
|
||||
clearValues = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Numerics;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
@@ -27,10 +28,15 @@ public class AccountLogin : MonoBehaviour
|
||||
|
||||
async void SubmitLogin()
|
||||
{
|
||||
if (loginUsernameInput.text == string.Empty || loginPasswordInput.text == string.Empty)
|
||||
{
|
||||
AccountHandler.UpdateStatusText(loginPanelStatusText, "All input fields must be filled", Color.red);
|
||||
return;
|
||||
}
|
||||
EncryptedWWWForm dataForm = new();
|
||||
dataForm.AddField("username", loginUsernameInput.text);
|
||||
dataForm.AddField("password", loginPasswordInput.text);
|
||||
dataForm.AddField("currentHighScore", PlayerPrefs.GetString("HighScoreV2", "0"));
|
||||
dataForm.AddField("currentHighScore", BazookaManager.Instance.GetGameStoreHighScore().ToString());
|
||||
dataForm.AddField("loginType", "0");
|
||||
using UnityWebRequest request = UnityWebRequest.Post(SensitiveInfo.SERVER_DATABASE_PREFIX + "loginAccount.php", dataForm.GetWWWForm());
|
||||
request.SetRequestHeader("Requester", "BerryDashClient");
|
||||
@@ -63,39 +69,32 @@ public class AccountLogin : MonoBehaviour
|
||||
AccountHandler.UpdateStatusText(loginPanelStatusText, "Can't send requests on self-built instance", Color.red);
|
||||
return;
|
||||
}
|
||||
else if (response == "-1")
|
||||
{
|
||||
AccountHandler.UpdateStatusText(loginPanelStatusText, "Incorrect username or password", Color.red);
|
||||
}
|
||||
else if (response.Split(":")[0] == "1")
|
||||
{
|
||||
string[] array = response.Split(':');
|
||||
string session = array[1];
|
||||
string userName = array[2];
|
||||
int userId = int.Parse(array[3]);
|
||||
BigInteger highScore = BigInteger.Parse(array[4]);
|
||||
int iconId = int.Parse(array[5]);
|
||||
int overlayId = int.Parse(array[6]);
|
||||
PlayerPrefs.SetString("gameSession", session);
|
||||
PlayerPrefs.SetString("userName", userName);
|
||||
PlayerPrefs.SetInt("userId", userId);
|
||||
PlayerPrefs.SetString("HighScoreV2", highScore.ToString());
|
||||
PlayerPrefs.SetInt("icon", iconId);
|
||||
PlayerPrefs.SetInt("overlay", overlayId);
|
||||
PlayerPrefs.SetString("TotalNormalBerries", array[7]);
|
||||
PlayerPrefs.SetString("TotalPoisonBerries", array[8]);
|
||||
PlayerPrefs.SetString("TotalSlowBerries", array[9]);
|
||||
PlayerPrefs.SetString("TotalUltraBerries", array[10]);
|
||||
PlayerPrefs.SetString("TotalSpeedyBerries", array[11]);
|
||||
PlayerPrefs.SetString("TotalAttempts", array[12]);
|
||||
PlayerPrefs.SetString("BirdColor", $"{array[13]};{array[14]};{array[15]}");
|
||||
PlayerPrefs.SetString("OverlayColor", $"{array[16]};{array[17]};{array[18]}");
|
||||
AccountHandler.instance.SwitchPanel(0);
|
||||
AccountHandler.UpdateStatusText(loginPanelStatusText, "", Color.red);
|
||||
}
|
||||
else
|
||||
{
|
||||
AccountHandler.UpdateStatusText(loginPanelStatusText, "Unknown server response", Color.red);
|
||||
var jsonResponse = JObject.Parse(response);
|
||||
if ((bool)jsonResponse["success"])
|
||||
{
|
||||
BazookaManager.Instance.SetAccountSession((string)jsonResponse["data"]["session"]);
|
||||
BazookaManager.Instance.SetAccountName((string)jsonResponse["data"]["username"]);
|
||||
BazookaManager.Instance.SetAccountID(BigInteger.Parse((string)jsonResponse["data"]["userid"]));
|
||||
BazookaManager.Instance.SetGameStoreHighScore(BigInteger.Parse((string)jsonResponse["data"]["highscore"]));
|
||||
BazookaManager.Instance.SetBirdIcon((int)jsonResponse["data"]["icon"]);
|
||||
BazookaManager.Instance.SetBirdOverlay((int)jsonResponse["data"]["overlay"]);
|
||||
BazookaManager.Instance.SetGameStoreTotalNormalBerries(BigInteger.Parse((string)jsonResponse["data"]["totalNormalBerries"]));
|
||||
BazookaManager.Instance.SetGameStoreTotalPoisonBerries(BigInteger.Parse((string)jsonResponse["data"]["totalPoisonBerries"]));
|
||||
BazookaManager.Instance.SetGameStoreTotalSlowBerries(BigInteger.Parse((string)jsonResponse["data"]["totalSlowBerries"]));
|
||||
BazookaManager.Instance.SetGameStoreTotalUltraBerries(BigInteger.Parse((string)jsonResponse["data"]["totalUltraBerries"]));
|
||||
BazookaManager.Instance.SetGameStoreTotalSpeedyBerries(BigInteger.Parse((string)jsonResponse["data"]["totalSpeedyBerries"]));
|
||||
BazookaManager.Instance.SetGameStoreTotalAttepts(BigInteger.Parse((string)jsonResponse["data"]["totalAttempts"]));
|
||||
BazookaManager.Instance.SetColorSettingIcon(JArray.Parse(jsonResponse["data"]["birdColor"].ToString()));
|
||||
BazookaManager.Instance.SetColorSettingOverlay(JArray.Parse(jsonResponse["data"]["overlayColor"].ToString()));
|
||||
AccountHandler.instance.SwitchPanel(0);
|
||||
AccountHandler.UpdateStatusText(loginPanelStatusText, "", Color.red);
|
||||
}
|
||||
else
|
||||
{
|
||||
AccountHandler.UpdateStatusText(loginPanelStatusText, (string)jsonResponse["message"], Color.red);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Numerics;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
@@ -69,10 +70,10 @@ public class AccountRefreshLogin : MonoBehaviour
|
||||
string[] array = response.Split(':');
|
||||
string session = array[1];
|
||||
string userName = array[2];
|
||||
int userId = int.Parse(array[3]);
|
||||
PlayerPrefs.SetString("gameSession", session);
|
||||
PlayerPrefs.SetString("userName", userName);
|
||||
PlayerPrefs.SetInt("userId", userId);
|
||||
BigInteger userId = BigInteger.Parse(array[3]);
|
||||
BazookaManager.Instance.SetAccountSession(session);
|
||||
BazookaManager.Instance.SetAccountName(userName);
|
||||
BazookaManager.Instance.SetAccountID(userId);
|
||||
AccountHandler.instance.SwitchPanel(0);
|
||||
AccountHandler.UpdateStatusText(refreshLoginStatusText, "", Color.red);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
@@ -34,19 +33,25 @@ public class AccountRegister : MonoBehaviour
|
||||
|
||||
async void SubmitRegister()
|
||||
{
|
||||
if (!registerEmailInput.text.Trim().Equals(registerRetypeEmailInput.text.Trim(), StringComparison.OrdinalIgnoreCase))
|
||||
if (
|
||||
registerUsernameInput.text == string.Empty ||
|
||||
registerEmailInput.text == string.Empty ||
|
||||
registerRetypeEmailInput.text == string.Empty ||
|
||||
registerPasswordInput.text == string.Empty ||
|
||||
registerRetypePasswordInput.text == string.Empty
|
||||
)
|
||||
{
|
||||
AccountHandler.UpdateStatusText(registerPanelStatusText, "Email doesn't match", Color.red);
|
||||
AccountHandler.UpdateStatusText(registerPanelStatusText, "All input fields must be filled", Color.red);
|
||||
return;
|
||||
}
|
||||
if (!registerPasswordInput.text.Trim().Equals(registerRetypePasswordInput.text.Trim(), StringComparison.OrdinalIgnoreCase))
|
||||
if (registerEmailInput.text != registerRetypeEmailInput.text)
|
||||
{
|
||||
AccountHandler.UpdateStatusText(registerPanelStatusText, "Password doesn't match", Color.red);
|
||||
AccountHandler.UpdateStatusText(registerPanelStatusText, "Emails don't match", Color.red);
|
||||
return;
|
||||
}
|
||||
if (!Regex.IsMatch(registerUsernameInput.text, "^[a-zA-Z0-9]{3,16}$"))
|
||||
if (registerPasswordInput.text != registerRetypePasswordInput.text)
|
||||
{
|
||||
AccountHandler.UpdateStatusText(registerPanelStatusText, "Username must be 3-16 characters, letters and numbers only", Color.red);
|
||||
AccountHandler.UpdateStatusText(registerPanelStatusText, "Passwords don't match", Color.red);
|
||||
return;
|
||||
}
|
||||
EncryptedWWWForm dataForm = new();
|
||||
@@ -64,38 +69,37 @@ public class AccountRegister : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
string response = SensitiveInfo.Decrypt(request.downloadHandler.text, SensitiveInfo.SERVER_RECEIVE_TRANSFER_KEY);
|
||||
switch (response)
|
||||
if (response == "-999")
|
||||
{
|
||||
case "-999":
|
||||
AccountHandler.UpdateStatusText(registerPanelStatusText, "Server error while fetching data", Color.red);
|
||||
break;
|
||||
case "-998":
|
||||
AccountHandler.UpdateStatusText(registerPanelStatusText, "Client version too outdated to access servers", Color.red);
|
||||
break;
|
||||
case "-997":
|
||||
AccountHandler.UpdateStatusText(registerPanelStatusText, "Encryption/decryption issues", Color.red);
|
||||
break;
|
||||
case "-996":
|
||||
AccountHandler.UpdateStatusText(registerPanelStatusText, "Can't send requests on self-built instance", Color.red);
|
||||
break;
|
||||
case "1":
|
||||
AccountHandler.UpdateStatusText(registerPanelStatusText, "Server error while fetching data", Color.red);
|
||||
return;
|
||||
}
|
||||
else if (response == "-998")
|
||||
{
|
||||
AccountHandler.UpdateStatusText(registerPanelStatusText, "Client version too outdated to access servers", Color.red);
|
||||
return;
|
||||
}
|
||||
else if (response == "-997")
|
||||
{
|
||||
AccountHandler.UpdateStatusText(registerPanelStatusText, "Encryption/decryption issues", Color.red);
|
||||
return;
|
||||
}
|
||||
else if (response == "-996")
|
||||
{
|
||||
AccountHandler.UpdateStatusText(registerPanelStatusText, "Can't send requests on self-built instance", Color.red);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
var jsonResponse = JObject.Parse(response);
|
||||
if ((bool)jsonResponse["success"])
|
||||
{
|
||||
AccountHandler.instance.SwitchPanel(2);
|
||||
break;
|
||||
case "-1":
|
||||
AccountHandler.UpdateStatusText(registerPanelStatusText, "Username must be 3-16 characters, letters and numbers only", Color.red);
|
||||
break;
|
||||
case "-2":
|
||||
AccountHandler.UpdateStatusText(registerPanelStatusText, "Email not valid", Color.red);
|
||||
break;
|
||||
case "-3":
|
||||
AccountHandler.UpdateStatusText(registerPanelStatusText, "Password must have 8 characters, one number and one letter", Color.red);
|
||||
break;
|
||||
case "-4":
|
||||
AccountHandler.UpdateStatusText(registerPanelStatusText, "Username or email already exists", Color.red);
|
||||
break;
|
||||
default:
|
||||
AccountHandler.UpdateStatusText(registerPanelStatusText, "Unknown server response", Color.red);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
AccountHandler.UpdateStatusText(registerPanelStatusText, (string)jsonResponse["message"], Color.red);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user