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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Security;
|
||||
using System.Numerics;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -65,11 +63,412 @@ public class BazookaManager : MonoBehaviour
|
||||
|
||||
public void Save()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
return;
|
||||
#else
|
||||
string path = Path.Join(Application.persistentDataPath, "BazookaManager.dat");
|
||||
var encoded = SensitiveInfo.EncryptRaw(saveFile.ToString(Newtonsoft.Json.Formatting.None), SensitiveInfo.BAZOOKA_MANAGER_KEY);
|
||||
var encoded = SensitiveInfo.EncryptRaw(saveFile.ToString(Formatting.None), SensitiveInfo.BAZOOKA_MANAGER_KEY);
|
||||
if (encoded == null) return;
|
||||
using var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None);
|
||||
fileStream.Write(encoded, 0, encoded.Length);
|
||||
fileStream.Flush(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
//Bird stuff
|
||||
|
||||
public void SetBirdIcon(int value)
|
||||
{
|
||||
if (saveFile["bird"] == null) saveFile["bird"] = new JObject();
|
||||
saveFile["bird"]["icon"] = value;
|
||||
}
|
||||
|
||||
public void UnsetBirdIcon()
|
||||
{
|
||||
if (saveFile["bird"] == null) return;
|
||||
if (saveFile["bird"]["icon"] == null) return;
|
||||
(saveFile["bird"] as JObject)?.Remove("icon");
|
||||
}
|
||||
|
||||
public int GetBirdIcon()
|
||||
{
|
||||
if (saveFile["bird"] == null) return 1;
|
||||
if (saveFile["bird"]["icon"] == null) return 1;
|
||||
return int.Parse(saveFile["bird"]["icon"].ToString());
|
||||
}
|
||||
|
||||
public void SetBirdOverlay(int value)
|
||||
{
|
||||
if (saveFile["bird"] == null) saveFile["bird"] = new JObject();
|
||||
saveFile["bird"]["overlay"] = value;
|
||||
}
|
||||
|
||||
|
||||
public void UnsetBirdOverlay()
|
||||
{
|
||||
if (saveFile["bird"] == null) return;
|
||||
if (saveFile["bird"]["overlay"] == null) return;
|
||||
(saveFile["bird"] as JObject)?.Remove("overlay");
|
||||
}
|
||||
public int GetBirdOverlay()
|
||||
{
|
||||
if (saveFile["bird"] == null) return 0;
|
||||
if (saveFile["bird"]["overlay"] == null) return 0;
|
||||
return int.Parse(saveFile["bird"]["overlay"].ToString());
|
||||
}
|
||||
|
||||
public void SetBirdPastOverlay(int value)
|
||||
{
|
||||
if (saveFile["bird"] == null) saveFile["bird"] = new JObject();
|
||||
saveFile["bird"]["pastOverlay"] = value;
|
||||
}
|
||||
|
||||
public void UnsetBirdPastOverlay()
|
||||
{
|
||||
if (saveFile["bird"] == null) return;
|
||||
if (saveFile["bird"]["pastOverlay"] == null) return;
|
||||
(saveFile["bird"] as JObject)?.Remove("pastOverlay");
|
||||
}
|
||||
|
||||
public int GetBirdPastOverlay()
|
||||
{
|
||||
if (saveFile["bird"] == null) return 0;
|
||||
if (saveFile["bird"]["pastOverlay"] == null) return 0;
|
||||
return int.Parse(saveFile["bird"]["pastOverlay"].ToString());
|
||||
}
|
||||
|
||||
//Settings stuff
|
||||
|
||||
public void SetSettingFullScreen(bool value)
|
||||
{
|
||||
if (saveFile["settings"] == null) saveFile["settings"] = new JObject();
|
||||
saveFile["settings"]["fullScreen"] = value;
|
||||
}
|
||||
|
||||
public bool? GetSettingFullScreen()
|
||||
{
|
||||
if (saveFile["settings"] == null) return null;
|
||||
if (saveFile["settings"]["fullScreen"] == null) return null;
|
||||
return bool.Parse(saveFile["settings"]["fullScreen"].ToString());
|
||||
}
|
||||
|
||||
public void SetSettingShowFPS(bool value)
|
||||
{
|
||||
if (saveFile["settings"] == null) saveFile["settings"] = new JObject();
|
||||
saveFile["settings"]["showFps"] = value;
|
||||
}
|
||||
|
||||
public bool GetSettingShowFPS()
|
||||
{
|
||||
if (saveFile["settings"] == null) return false;
|
||||
if (saveFile["settings"]["showFps"] == null) return false;
|
||||
return bool.Parse(saveFile["settings"]["showFps"].ToString());
|
||||
}
|
||||
|
||||
public void SetSettingVsync(bool value)
|
||||
{
|
||||
if (saveFile["settings"] == null) saveFile["settings"] = new JObject();
|
||||
saveFile["settings"]["vsync"] = value;
|
||||
}
|
||||
|
||||
public bool? GetSettingVsync()
|
||||
{
|
||||
if (saveFile["settings"] == null) return null;
|
||||
if (saveFile["settings"]["vsync"] == null) return null;
|
||||
return bool.Parse(saveFile["settings"]["vsync"].ToString());
|
||||
}
|
||||
|
||||
public void SetSettingHideSocials(bool value)
|
||||
{
|
||||
if (saveFile["settings"] == null) saveFile["settings"] = new JObject();
|
||||
saveFile["settings"]["hideSocials"] = value;
|
||||
}
|
||||
|
||||
public bool? GetSettingHideSocials()
|
||||
{
|
||||
if (saveFile["settings"] == null) return null;
|
||||
if (saveFile["settings"]["hideSocials"] == null) return null;
|
||||
return bool.Parse(saveFile["settings"]["hideSocials"].ToString());
|
||||
}
|
||||
|
||||
public void SetSettingMusicVolume(float value)
|
||||
{
|
||||
if (saveFile["settings"] == null) saveFile["settings"] = new JObject();
|
||||
saveFile["settings"]["musicVolume"] = value;
|
||||
}
|
||||
|
||||
public float GetSettingMusicVolume()
|
||||
{
|
||||
if (saveFile["settings"] == null) return 1f;
|
||||
if (saveFile["settings"]["musicVolume"] == null) return 1f;
|
||||
return float.Parse(saveFile["settings"]["musicVolume"].ToString());
|
||||
}
|
||||
|
||||
public void SetSettingSFXVolume(float value)
|
||||
{
|
||||
if (saveFile["settings"] == null) saveFile["settings"] = new JObject();
|
||||
saveFile["settings"]["sfxVolume"] = value;
|
||||
}
|
||||
|
||||
public float GetSettingSFXVolume()
|
||||
{
|
||||
if (saveFile["settings"] == null) return 1f;
|
||||
if (saveFile["settings"]["sfxVolume"] == null) return 1f;
|
||||
return float.Parse(saveFile["settings"]["sfxVolume"].ToString());
|
||||
}
|
||||
|
||||
public void SetColorSettingBackground(JArray value)
|
||||
{
|
||||
if (saveFile["settings"] == null) saveFile["settings"] = new JObject();
|
||||
if (saveFile["settings"]["colors"] == null) saveFile["settings"]["colors"] = new JObject();
|
||||
saveFile["settings"]["colors"]["background"] = value;
|
||||
}
|
||||
|
||||
public JArray GetColorSettingBackground()
|
||||
{
|
||||
if (saveFile["settings"] == null) return new JArray(58, 58, 58);
|
||||
if (saveFile["settings"]["colors"] == null) return new JArray(58, 58, 58);
|
||||
if (saveFile["settings"]["colors"]["background"] == null) return new JArray(58, 58, 58);
|
||||
return JArray.Parse(saveFile["settings"]["colors"]["background"].ToString());
|
||||
}
|
||||
|
||||
public void SetColorSettingIcon(JArray value)
|
||||
{
|
||||
if (saveFile["settings"] == null) saveFile["settings"] = new JObject();
|
||||
if (saveFile["settings"]["colors"] == null) saveFile["settings"]["colors"] = new JObject();
|
||||
saveFile["settings"]["colors"]["icon"] = value;
|
||||
}
|
||||
|
||||
public JArray GetColorSettingIcon()
|
||||
{
|
||||
if (saveFile["settings"] == null) return new JArray(255, 255, 255);
|
||||
if (saveFile["settings"]["colors"] == null) return new JArray(255, 255, 255);
|
||||
if (saveFile["settings"]["colors"]["icon"] == null) return new JArray(255, 255, 255);
|
||||
return JArray.Parse(saveFile["settings"]["colors"]["icon"].ToString());
|
||||
}
|
||||
|
||||
public void UnsetColorSettingIcon()
|
||||
{
|
||||
if (saveFile["settings"] == null) return;
|
||||
if (saveFile["settings"]["colors"] == null) return;
|
||||
if (saveFile["settings"]["colors"]["icon"] == null) return;
|
||||
(saveFile["settings"]["colors"] as JObject)?.Remove("icon");
|
||||
}
|
||||
|
||||
public void SetColorSettingOverlay(JArray value)
|
||||
{
|
||||
if (saveFile["settings"] == null) saveFile["settings"] = new JObject();
|
||||
if (saveFile["settings"]["colors"] == null) saveFile["settings"]["colors"] = new JObject();
|
||||
saveFile["settings"]["colors"]["overlay"] = value;
|
||||
}
|
||||
|
||||
public JArray GetColorSettingOverlay()
|
||||
{
|
||||
if (saveFile["settings"] == null) return new JArray(255, 255, 255);
|
||||
if (saveFile["settings"]["colors"] == null) return new JArray(255, 255, 255);
|
||||
if (saveFile["settings"]["colors"]["overlay"] == null) return new JArray(255, 255, 255);
|
||||
return JArray.Parse(saveFile["settings"]["colors"]["overlay"].ToString());
|
||||
}
|
||||
|
||||
public void UnsetColorSettingOverlay()
|
||||
{
|
||||
if (saveFile["settings"] == null) return;
|
||||
if (saveFile["settings"]["colors"] == null) return;
|
||||
if (saveFile["settings"]["colors"]["overlay"] == null) return;
|
||||
(saveFile["settings"]["colors"] as JObject)?.Remove("overlay");
|
||||
}
|
||||
|
||||
//Account stuff
|
||||
|
||||
public void SetAccountSession(string value)
|
||||
{
|
||||
if (saveFile["account"] == null) saveFile["account"] = new JObject();
|
||||
saveFile["account"]["session"] = value;
|
||||
}
|
||||
|
||||
public string GetAccountSession()
|
||||
{
|
||||
if (saveFile["account"] == null) return null;
|
||||
if (saveFile["account"]["session"] == null) return null;
|
||||
return saveFile["account"]["session"].ToString();
|
||||
}
|
||||
|
||||
public void UnsetAccountSession()
|
||||
{
|
||||
if (saveFile["account"] == null) return;
|
||||
(saveFile["account"] as JObject)?.Remove("session");
|
||||
}
|
||||
|
||||
public void SetAccountName(string value)
|
||||
{
|
||||
if (saveFile["account"] == null) saveFile["account"] = new JObject();
|
||||
saveFile["account"]["name"] = value;
|
||||
}
|
||||
|
||||
public string GetAccountName()
|
||||
{
|
||||
if (saveFile["account"] == null) return null;
|
||||
if (saveFile["account"]["name"] == null) return null;
|
||||
return saveFile["account"]["name"].ToString();
|
||||
}
|
||||
|
||||
public void UnsetAccountName()
|
||||
{
|
||||
if (saveFile["account"] == null) return;
|
||||
(saveFile["account"] as JObject)?.Remove("name");
|
||||
}
|
||||
|
||||
public void SetAccountID(BigInteger value)
|
||||
{
|
||||
if (saveFile["account"] == null) saveFile["account"] = new JObject();
|
||||
saveFile["account"]["id"] = value.ToString();
|
||||
}
|
||||
|
||||
public BigInteger? GetAccountID()
|
||||
{
|
||||
if (saveFile["account"] == null) return null;
|
||||
if (saveFile["account"]["id"] == null) return null;
|
||||
return BigInteger.Parse(saveFile["account"]["id"].ToString());
|
||||
}
|
||||
|
||||
public void UnsetAccountID()
|
||||
{
|
||||
if (saveFile["account"] == null) return;
|
||||
(saveFile["account"] as JObject)?.Remove("id");
|
||||
}
|
||||
|
||||
//Game store stuff
|
||||
|
||||
public void SetGameStoreHighScore(BigInteger value)
|
||||
{
|
||||
if (saveFile["gameStore"] == null) saveFile["gameStore"] = new JObject();
|
||||
saveFile["gameStore"]["highScore"] = value.ToString();
|
||||
}
|
||||
|
||||
public BigInteger GetGameStoreHighScore()
|
||||
{
|
||||
if (saveFile["gameStore"] == null) return 0;
|
||||
if (saveFile["gameStore"]["highScore"] == null) return 0;
|
||||
return BigInteger.Parse(saveFile["gameStore"]["highScore"].ToString());
|
||||
}
|
||||
|
||||
public void UnsetGameStoreHighScore()
|
||||
{
|
||||
if (saveFile["gameStore"] == null) return;
|
||||
(saveFile["gameStore"] as JObject)?.Remove("highScore");
|
||||
}
|
||||
|
||||
public void SetGameStoreTotalAttepts(BigInteger value)
|
||||
{
|
||||
if (saveFile["gameStore"] == null) saveFile["gameStore"] = new JObject();
|
||||
saveFile["gameStore"]["totalAttempts"] = value.ToString();
|
||||
}
|
||||
|
||||
public BigInteger GetGameStoreTotalAttepts()
|
||||
{
|
||||
if (saveFile["gameStore"] == null) return 0;
|
||||
if (saveFile["gameStore"]["totalAttempts"] == null) return 0;
|
||||
return BigInteger.Parse(saveFile["gameStore"]["totalAttempts"].ToString());
|
||||
}
|
||||
|
||||
public void UnsetGameStoreTotalAttepts()
|
||||
{
|
||||
if (saveFile["gameStore"] == null) return;
|
||||
(saveFile["gameStore"] as JObject)?.Remove("totalAttempts");
|
||||
}
|
||||
|
||||
public void SetGameStoreTotalNormalBerries(BigInteger value)
|
||||
{
|
||||
if (saveFile["gameStore"] == null) saveFile["gameStore"] = new JObject();
|
||||
saveFile["gameStore"]["totalNormalBerries"] = value.ToString();
|
||||
}
|
||||
|
||||
public BigInteger GetGameStoreTotalNormalBerries()
|
||||
{
|
||||
if (saveFile["gameStore"] == null) return 0;
|
||||
if (saveFile["gameStore"]["totalNormalBerries"] == null) return 0;
|
||||
return BigInteger.Parse(saveFile["gameStore"]["totalNormalBerries"].ToString());
|
||||
}
|
||||
|
||||
public void UnsetGameStoreTotalNormalBerries()
|
||||
{
|
||||
if (saveFile["gameStore"] == null) return;
|
||||
(saveFile["gameStore"] as JObject)?.Remove("totalNormalBerries");
|
||||
}
|
||||
|
||||
public void SetGameStoreTotalPoisonBerries(BigInteger value)
|
||||
{
|
||||
if (saveFile["gameStore"] == null) saveFile["gameStore"] = new JObject();
|
||||
saveFile["gameStore"]["totalPoisonBerries"] = value.ToString();
|
||||
}
|
||||
|
||||
public BigInteger GetGameStoreTotalPoisonBerries()
|
||||
{
|
||||
if (saveFile["gameStore"] == null) return 0;
|
||||
if (saveFile["gameStore"]["totalPoisonBerries"] == null) return 0;
|
||||
return BigInteger.Parse(saveFile["gameStore"]["totalPoisonBerries"].ToString());
|
||||
}
|
||||
|
||||
public void UnsetGameStoreTotalPoisonBerries()
|
||||
{
|
||||
if (saveFile["gameStore"] == null) return;
|
||||
(saveFile["gameStore"] as JObject)?.Remove("totalPoisonBerries");
|
||||
}
|
||||
|
||||
public void SetGameStoreTotalSlowBerries(BigInteger value)
|
||||
{
|
||||
if (saveFile["gameStore"] == null) saveFile["gameStore"] = new JObject();
|
||||
saveFile["gameStore"]["totalSlowBerries"] = value.ToString();
|
||||
}
|
||||
|
||||
public BigInteger GetGameStoreTotalSlowBerries()
|
||||
{
|
||||
if (saveFile["gameStore"] == null) return 0;
|
||||
if (saveFile["gameStore"]["totalSlowBerries"] == null) return 0;
|
||||
return BigInteger.Parse(saveFile["gameStore"]["totalSlowBerries"].ToString());
|
||||
}
|
||||
|
||||
public void UnsetGameStoreTotalSlowBerries()
|
||||
{
|
||||
if (saveFile["gameStore"] == null) return;
|
||||
(saveFile["gameStore"] as JObject)?.Remove("totalSlowBerries");
|
||||
}
|
||||
|
||||
public void SetGameStoreTotalUltraBerries(BigInteger value)
|
||||
{
|
||||
if (saveFile["gameStore"] == null) saveFile["gameStore"] = new JObject();
|
||||
saveFile["gameStore"]["totalUltraBerries"] = value.ToString();
|
||||
}
|
||||
|
||||
public BigInteger GetGameStoreTotalUltraBerries()
|
||||
{
|
||||
if (saveFile["gameStore"] == null) return 0;
|
||||
if (saveFile["gameStore"]["totalUltraBerries"] == null) return 0;
|
||||
return BigInteger.Parse(saveFile["gameStore"]["totalUltraBerries"].ToString());
|
||||
}
|
||||
|
||||
public void UnsetGameStoreTotalUltraBerries()
|
||||
{
|
||||
if (saveFile["gameStore"] == null) return;
|
||||
(saveFile["gameStore"] as JObject)?.Remove("totalUltraBerries");
|
||||
}
|
||||
|
||||
public void SetGameStoreTotalSpeedyBerries(BigInteger value)
|
||||
{
|
||||
if (saveFile["gameStore"] == null) saveFile["gameStore"] = new JObject();
|
||||
saveFile["gameStore"]["totalSpeedyBerries"] = value.ToString();
|
||||
}
|
||||
|
||||
public BigInteger GetGameStoreTotalSpeedyBerries()
|
||||
{
|
||||
if (saveFile["gameStore"] == null) return 0;
|
||||
if (saveFile["gameStore"]["totalSpeedyBerries"] == null) return 0;
|
||||
return BigInteger.Parse(saveFile["gameStore"]["totalSpeedyBerries"].ToString());
|
||||
}
|
||||
|
||||
public void UnsetGameStoreTotalSpeedyBerries()
|
||||
{
|
||||
if (saveFile["gameStore"] == null) return;
|
||||
(saveFile["gameStore"] as JObject)?.Remove("totalSpeedyBerries");
|
||||
}
|
||||
}
|
||||
|
||||
7
Assets/Scripts/BazookaSetting.cs
Normal file
7
Assets/Scripts/BazookaSetting.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
public enum BazookaSetting
|
||||
{
|
||||
FullScreen,
|
||||
ShowFPS,
|
||||
Vsync,
|
||||
HideSocials
|
||||
}
|
||||
2
Assets/Scripts/BazookaSetting.cs.meta
Normal file
2
Assets/Scripts/BazookaSetting.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee4201969db9e67d3b251fdcec5bfbd2
|
||||
@@ -22,7 +22,7 @@ public class ChatroomMenu : 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)
|
||||
{
|
||||
sendButton.interactable = false;
|
||||
messageInputField.interactable = false;
|
||||
@@ -56,7 +56,7 @@ public class ChatroomMenu : MonoBehaviour
|
||||
|
||||
EncryptedWWWForm dataForm = new();
|
||||
dataForm.AddField("content", text);
|
||||
dataForm.AddField("gameSession", PlayerPrefs.GetString("gameSession", ""));
|
||||
dataForm.AddField("gameSession", BazookaManager.Instance.GetAccountSession());
|
||||
using UnityWebRequest request = UnityWebRequest.Post(SensitiveInfo.SERVER_DATABASE_PREFIX + "sendChatroomMessage.php", dataForm.GetWWWForm());
|
||||
request.SetRequestHeader("Requester", "BerryDashClient");
|
||||
request.SetRequestHeader("ClientVersion", Application.version);
|
||||
@@ -179,7 +179,7 @@ public class ChatroomMenu : MonoBehaviour
|
||||
var overlayG = rowSplit[10];
|
||||
var overlayB = rowSplit[11];
|
||||
|
||||
if (content.transform.Find("ChatroomRow_" + id) != null)
|
||||
if (content.transform.Find("ChatroomRow_" + id + "_" + uid) != null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -229,7 +229,7 @@ public class ChatroomMenu : MonoBehaviour
|
||||
playerIcon.color = Color.white;
|
||||
playerOverlayIcon.color = Color.white;
|
||||
}
|
||||
rowInfo.name = "ChatroomRow_" + id;
|
||||
rowInfo.name = "ChatroomRow_" + id + "_" + uid;
|
||||
rowInfo.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,27 +40,27 @@ public class GamePlayer : MonoBehaviour
|
||||
public GameObject backButton;
|
||||
public float lastMoveTime;
|
||||
|
||||
void Awake()
|
||||
void Start()
|
||||
{
|
||||
var backgroundColor = PlayerPrefs.GetString("BackgroundColor", "58;58;58").Split(";");
|
||||
var birdColor = PlayerPrefs.GetString("BirdColor", "255;255;255").Split(";");
|
||||
var overlayColor = PlayerPrefs.GetString("OverlayColor", "255;255;255").Split(";");
|
||||
var backgroundColor = BazookaManager.Instance.GetColorSettingBackground();
|
||||
var birdColor = BazookaManager.Instance.GetColorSettingIcon();
|
||||
var overlayColor = BazookaManager.Instance.GetColorSettingOverlay();
|
||||
try
|
||||
{
|
||||
Camera.main.backgroundColor = new Color(
|
||||
int.Parse(backgroundColor[0]) / 255f,
|
||||
int.Parse(backgroundColor[1]) / 255f,
|
||||
int.Parse(backgroundColor[2]) / 255f
|
||||
int.Parse(backgroundColor[0].ToString()) / 255f,
|
||||
int.Parse(backgroundColor[1].ToString()) / 255f,
|
||||
int.Parse(backgroundColor[2].ToString()) / 255f
|
||||
);
|
||||
bird.GetComponent<SpriteRenderer>().color = new Color(
|
||||
int.Parse(birdColor[0]) / 255f,
|
||||
int.Parse(birdColor[1]) / 255f,
|
||||
int.Parse(birdColor[2]) / 255f
|
||||
int.Parse(birdColor[0].ToString()) / 255f,
|
||||
int.Parse(birdColor[1].ToString()) / 255f,
|
||||
int.Parse(birdColor[2].ToString()) / 255f
|
||||
);
|
||||
bird.transform.GetChild(0).GetComponent<SpriteRenderer>().color = new Color(
|
||||
int.Parse(overlayColor[0]) / 255f,
|
||||
int.Parse(overlayColor[1]) / 255f,
|
||||
int.Parse(overlayColor[2]) / 255f
|
||||
int.Parse(overlayColor[0].ToString()) / 255f,
|
||||
int.Parse(overlayColor[1].ToString()) / 255f,
|
||||
int.Parse(overlayColor[2].ToString()) / 255f
|
||||
);
|
||||
}
|
||||
catch
|
||||
@@ -71,25 +71,22 @@ public class GamePlayer : MonoBehaviour
|
||||
lastMoveTime = Time.time;
|
||||
UnityEngine.InputSystem.EnhancedTouch.EnhancedTouchSupport.Enable();
|
||||
instance = this;
|
||||
highscore = BigInteger.Parse(PlayerPrefs.GetString("HighScoreV2", "0"));
|
||||
totalNormalBerries = BigInteger.Parse(PlayerPrefs.GetString("TotalNormalBerries", "0"));
|
||||
totalPoisonBerries = BigInteger.Parse(PlayerPrefs.GetString("TotalPoisonBerries", "0"));
|
||||
totalSlowBerries = BigInteger.Parse(PlayerPrefs.GetString("TotalSlowBerries", "0"));
|
||||
totalUltraBerries = BigInteger.Parse(PlayerPrefs.GetString("TotalUltraBerries", "0"));
|
||||
totalSpeedyBerries = BigInteger.Parse(PlayerPrefs.GetString("TotalSpeedyBerries", "0"));
|
||||
totalAttempts = BigInteger.Parse(PlayerPrefs.GetString("TotalAttempts", "0"));
|
||||
}
|
||||
highscore = BazookaManager.Instance.GetGameStoreHighScore();
|
||||
totalNormalBerries = BazookaManager.Instance.GetGameStoreTotalNormalBerries();
|
||||
totalPoisonBerries = BazookaManager.Instance.GetGameStoreTotalPoisonBerries();
|
||||
totalSlowBerries = BazookaManager.Instance.GetGameStoreTotalSlowBerries();
|
||||
totalUltraBerries = BazookaManager.Instance.GetGameStoreTotalUltraBerries();
|
||||
totalSpeedyBerries = BazookaManager.Instance.GetGameStoreTotalSpeedyBerries();
|
||||
totalAttempts = BazookaManager.Instance.GetGameStoreTotalAttepts();
|
||||
|
||||
void Start()
|
||||
{
|
||||
Cursor.visible = false;
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
SpriteRenderer component = bird.GetComponent<SpriteRenderer>();
|
||||
int num = PlayerPrefs.GetInt("icon", 1);
|
||||
int num2 = PlayerPrefs.GetInt("overlay", 0);
|
||||
int num = BazookaManager.Instance.GetBirdIcon();
|
||||
int num2 = BazookaManager.Instance.GetBirdOverlay();
|
||||
if (num == 1)
|
||||
{
|
||||
component.sprite = Tools.GetIconForUser(PlayerPrefs.GetInt("userId", 0));
|
||||
component.sprite = Tools.GetIconForUser(BazookaManager.Instance.GetAccountID() ?? 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -118,15 +115,14 @@ public class GamePlayer : MonoBehaviour
|
||||
if (component.sprite == null)
|
||||
{
|
||||
component.sprite = Resources.Load<Sprite>("Icons/Icons/bird_1");
|
||||
PlayerPrefs.SetInt("icon", 1);
|
||||
BazookaManager.Instance.SetBirdIcon(1);
|
||||
}
|
||||
if (overlayRender.sprite == null && num2 != 0)
|
||||
{
|
||||
overlayRender.sprite = Resources.Load<Sprite>("Icons/Overlays/overlay_1");
|
||||
PlayerPrefs.SetInt("overlay", 1);
|
||||
BazookaManager.Instance.SetBirdOverlay(1);
|
||||
}
|
||||
PlayerPrefs.Save();
|
||||
backgroundMusic.volume = PlayerPrefs.GetFloat("musicVolume", 1f);
|
||||
backgroundMusic.volume = BazookaManager.Instance.GetSettingMusicVolume();
|
||||
screenWidth = Camera.main.orthographicSize * 2f * Camera.main.aspect;
|
||||
if (Application.isMobilePlatform)
|
||||
{
|
||||
@@ -264,7 +260,7 @@ public class GamePlayer : MonoBehaviour
|
||||
if (doJump && isGrounded)
|
||||
{
|
||||
lastMoveTime = Time.time;
|
||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Jump"), Camera.main.transform.position, 0.75f * PlayerPrefs.GetFloat("sfxVolume", 1f));
|
||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Jump"), Camera.main.transform.position, 0.75f * BazookaManager.Instance.GetSettingSFXVolume());
|
||||
if (boostLeft > 0f || speedyLeft > 0f)
|
||||
{
|
||||
rb.linearVelocity = UnityEngine.Vector2.up * 12f;
|
||||
@@ -401,7 +397,7 @@ public class GamePlayer : MonoBehaviour
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (PlayerPrefs.GetInt("Setting2", 0) == 1 && Time.time > nextUpdate)
|
||||
if (BazookaManager.Instance.GetSettingShowFPS() && Time.time > nextUpdate)
|
||||
{
|
||||
fps = 1f / Time.deltaTime;
|
||||
fpsCounter.text = "FPS: " + Mathf.Round(fps);
|
||||
@@ -448,7 +444,7 @@ public class GamePlayer : MonoBehaviour
|
||||
}
|
||||
else if (UnityEngine.Vector3.Distance(bird.transform.position, berry.transform.position) < 1.5f)
|
||||
{
|
||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Eat"), Camera.main.transform.position, 1.2f * PlayerPrefs.GetFloat("sfxVolume", 1f));
|
||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Eat"), Camera.main.transform.position, 1.2f * BazookaManager.Instance.GetSettingSFXVolume());
|
||||
Destroy(berry);
|
||||
totalNormalBerries++;
|
||||
UpdateStats(1, 0);
|
||||
@@ -471,7 +467,7 @@ public class GamePlayer : MonoBehaviour
|
||||
}
|
||||
else if (UnityEngine.Vector3.Distance(bird.transform.position, gameObject7.transform.position) < 1.5f)
|
||||
{
|
||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Death"), Camera.main.transform.position, 1.2f * PlayerPrefs.GetFloat("sfxVolume", 1f));
|
||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Death"), Camera.main.transform.position, 1.2f * BazookaManager.Instance.GetSettingSFXVolume());
|
||||
Respawn();
|
||||
totalPoisonBerries++;
|
||||
UpdateStats(0, 0);
|
||||
@@ -494,7 +490,7 @@ public class GamePlayer : MonoBehaviour
|
||||
}
|
||||
else if (UnityEngine.Vector3.Distance(bird.transform.position, gameObject8.transform.position) < 1.5f)
|
||||
{
|
||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Powerup"), Camera.main.transform.position, 0.35f * PlayerPrefs.GetFloat("sfxVolume", 1f));
|
||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Powerup"), Camera.main.transform.position, 0.35f * BazookaManager.Instance.GetSettingSFXVolume());
|
||||
Destroy(gameObject8);
|
||||
totalUltraBerries++;
|
||||
speedyLeft = 0f;
|
||||
@@ -527,7 +523,7 @@ public class GamePlayer : MonoBehaviour
|
||||
}
|
||||
else if (UnityEngine.Vector3.Distance(bird.transform.position, gameObject9.transform.position) < 1.5f)
|
||||
{
|
||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Downgrade"), Camera.main.transform.position, 0.35f * PlayerPrefs.GetFloat("sfxVolume", 1f));
|
||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Downgrade"), Camera.main.transform.position, 0.35f * BazookaManager.Instance.GetSettingSFXVolume());
|
||||
Destroy(gameObject9);
|
||||
boostLeft = 0f;
|
||||
slownessLeft = 10f;
|
||||
@@ -556,7 +552,7 @@ public class GamePlayer : MonoBehaviour
|
||||
}
|
||||
else if (UnityEngine.Vector3.Distance(bird.transform.position, gameObject10.transform.position) < 1.5f)
|
||||
{
|
||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/SpeedyPowerup"), Camera.main.transform.position, 0.35f * PlayerPrefs.GetFloat("sfxVolume", 1f));
|
||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/SpeedyPowerup"), Camera.main.transform.position, 0.35f * BazookaManager.Instance.GetSettingSFXVolume());
|
||||
Destroy(gameObject10);
|
||||
boostLeft = 0f;
|
||||
slownessLeft = 0f;
|
||||
@@ -658,14 +654,13 @@ public class GamePlayer : MonoBehaviour
|
||||
{
|
||||
highscore = score;
|
||||
}
|
||||
PlayerPrefs.SetString("HighScoreV2", highscore.ToString());
|
||||
PlayerPrefs.SetString("TotalNormalBerries", totalNormalBerries.ToString());
|
||||
PlayerPrefs.SetString("TotalPoisonBerries", totalPoisonBerries.ToString());
|
||||
PlayerPrefs.SetString("TotalSlowBerries", totalSlowBerries.ToString());
|
||||
PlayerPrefs.SetString("TotalUltraBerries", totalUltraBerries.ToString());
|
||||
PlayerPrefs.SetString("TotalSpeedyBerries", totalSpeedyBerries.ToString());
|
||||
PlayerPrefs.SetString("TotalAttempts", totalAttempts.ToString());
|
||||
PlayerPrefs.Save();
|
||||
BazookaManager.Instance.SetGameStoreHighScore(highscore);
|
||||
BazookaManager.Instance.SetGameStoreTotalNormalBerries(totalNormalBerries);
|
||||
BazookaManager.Instance.SetGameStoreTotalPoisonBerries(totalPoisonBerries);
|
||||
BazookaManager.Instance.SetGameStoreTotalSlowBerries(totalSlowBerries);
|
||||
BazookaManager.Instance.SetGameStoreTotalUltraBerries(totalUltraBerries);
|
||||
BazookaManager.Instance.SetGameStoreTotalSpeedyBerries(totalSpeedyBerries);
|
||||
BazookaManager.Instance.SetGameStoreTotalAttepts(totalAttempts);
|
||||
scoreText.text = $"Score: {Tools.FormatWithCommas(score)} \\u2022 Attempts: {Tools.FormatWithCommas(attempts)}";
|
||||
highScoreText.text = $"High Score: {Tools.FormatWithCommas(highscore)} \\u2022 Total Attempts: {Tools.FormatWithCommas(totalAttempts)}";
|
||||
if (restartButton != null) restartButton.GetComponent<Renderer>().material.color = score == 0 ? Color.gray : Color.white;
|
||||
|
||||
@@ -21,8 +21,8 @@ public class GamePlayerPauseMenu : MonoBehaviour
|
||||
void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
musicSlider.value = PlayerPrefs.GetFloat("musicVolume", 1f);
|
||||
sfxSlider.value = PlayerPrefs.GetFloat("sfxVolume", 1f);
|
||||
musicSlider.value = BazookaManager.Instance.GetSettingMusicVolume();
|
||||
sfxSlider.value = BazookaManager.Instance.GetSettingSFXVolume();
|
||||
backButton.onClick.AddListener(async () =>
|
||||
{
|
||||
await UnityEngine.SceneManagement.SceneManager.LoadSceneAsync("MainMenu");
|
||||
@@ -30,14 +30,12 @@ public class GamePlayerPauseMenu : MonoBehaviour
|
||||
continueButton.onClick.AddListener(GamePlayer.instance.DisablePause);
|
||||
musicSlider.onValueChanged.AddListener(value =>
|
||||
{
|
||||
PlayerPrefs.SetFloat("musicVolume", value);
|
||||
PlayerPrefs.Save();
|
||||
BazookaManager.Instance.SetSettingMusicVolume(value);
|
||||
songLoop.volume = value;
|
||||
});
|
||||
sfxSlider.onValueChanged.AddListener(value =>
|
||||
{
|
||||
PlayerPrefs.SetFloat("sfxVolume", value);
|
||||
PlayerPrefs.Save();
|
||||
BazookaManager.Instance.SetSettingSFXVolume(value);
|
||||
});
|
||||
editUiButton.onClick.AddListener(() =>
|
||||
{
|
||||
|
||||
@@ -1,12 +1,22 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class HideIfSettingFalse : MonoBehaviour
|
||||
{
|
||||
public string setting;
|
||||
public class HideIfSettingFalse : MonoBehaviour {
|
||||
public BazookaSetting setting;
|
||||
public bool reverse;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
gameObject.SetActive(PlayerPrefs.GetInt(setting, 0) == (reverse ? 0 : 1));
|
||||
void Start() {
|
||||
bool value = GetSettingValue(setting);
|
||||
gameObject.SetActive(value == !reverse);
|
||||
}
|
||||
|
||||
bool GetSettingValue(BazookaSetting s) {
|
||||
var b = BazookaManager.Instance;
|
||||
return s switch {
|
||||
BazookaSetting.FullScreen => b.GetSettingFullScreen() ?? false,
|
||||
BazookaSetting.ShowFPS => b.GetSettingShowFPS(),
|
||||
BazookaSetting.Vsync => b.GetSettingVsync() ?? false,
|
||||
BazookaSetting.HideSocials => b.GetSettingHideSocials() ?? false,
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -40,12 +40,12 @@ public class Iconsmenu : MonoBehaviour
|
||||
|
||||
private void Start()
|
||||
{
|
||||
defaultIcon = Tools.GetIconForUser(PlayerPrefs.GetInt("userId", 0));
|
||||
defaultIcon = Tools.GetIconForUser(BazookaManager.Instance.GetAccountID() ?? 0);
|
||||
icon1.transform.GetChild(0).GetComponent<Image>().sprite = defaultIcon;
|
||||
SwitchToIcon();
|
||||
SelectOverlay(PlayerPrefs.GetInt("overlay", Mathf.Clamp(PlayerPrefs.GetInt("overlay", 0), 0, 14)));
|
||||
SelectIcon(PlayerPrefs.GetInt("icon", Mathf.Clamp(PlayerPrefs.GetInt("icon", 0), 1, 8)));
|
||||
if (PlayerPrefs.GetInt("icon", 0) == 7)
|
||||
SelectOverlay(BazookaManager.Instance.GetBirdOverlay());
|
||||
SelectIcon(BazookaManager.Instance.GetBirdIcon());
|
||||
if (BazookaManager.Instance.GetBirdIcon() == 7)
|
||||
{
|
||||
SelectOverlay(0);
|
||||
placeholderButton.interactable = false;
|
||||
@@ -53,9 +53,6 @@ public class Iconsmenu : MonoBehaviour
|
||||
placeholderButton.onClick.AddListener(ToggleKit);
|
||||
backButton.onClick.AddListener(async () =>
|
||||
{
|
||||
PlayerPrefs.SetInt("icon", Mathf.Clamp(PlayerPrefs.GetInt("icon", 0), 1, 8));
|
||||
PlayerPrefs.SetInt("overlay", Mathf.Clamp(PlayerPrefs.GetInt("overlay", 0), 0, 14));
|
||||
PlayerPrefs.Save();
|
||||
await SceneManager.LoadSceneAsync("MainMenu");
|
||||
});
|
||||
previewBird.GetComponentInParent<Button>().onClick.AddListener(() =>
|
||||
@@ -139,8 +136,7 @@ public class Iconsmenu : MonoBehaviour
|
||||
|
||||
private void SelectIcon(int iconID)
|
||||
{
|
||||
PlayerPrefs.SetInt("icon", iconID);
|
||||
PlayerPrefs.Save();
|
||||
BazookaManager.Instance.SetBirdIcon(iconID);
|
||||
icon1.interactable = iconID != 1;
|
||||
icon2.interactable = iconID != 2;
|
||||
icon3.interactable = iconID != 3;
|
||||
@@ -161,7 +157,7 @@ public class Iconsmenu : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectOverlay(PlayerPrefs.GetInt("pastOverlay", 0), false);
|
||||
SelectOverlay(BazookaManager.Instance.GetBirdPastOverlay(), false);
|
||||
placeholderButton.interactable = true;
|
||||
}
|
||||
}
|
||||
@@ -170,10 +166,9 @@ public class Iconsmenu : MonoBehaviour
|
||||
{
|
||||
if (savePast)
|
||||
{
|
||||
PlayerPrefs.SetInt("pastOverlay", PlayerPrefs.GetInt("overlay", 0));
|
||||
BazookaManager.Instance.SetBirdPastOverlay(BazookaManager.Instance.GetBirdOverlay());
|
||||
}
|
||||
PlayerPrefs.SetInt("overlay", overlayID);
|
||||
PlayerPrefs.Save();
|
||||
BazookaManager.Instance.SetBirdOverlay(overlayID);
|
||||
overlay0.interactable = overlayID != 0;
|
||||
overlay1.interactable = overlayID != 1;
|
||||
overlay2.interactable = overlayID != 2;
|
||||
@@ -182,7 +177,7 @@ public class Iconsmenu : MonoBehaviour
|
||||
overlay5.interactable = overlayID != 5;
|
||||
overlay6.interactable = overlayID != 6;
|
||||
overlay7.interactable = overlayID != 7;
|
||||
overlay8.interactable = !(PlayerPrefs.GetInt("userId", 0) == 1 && PlayerPrefs.GetInt("icon", 0) == 1) && overlayID != 8;
|
||||
overlay8.interactable = !(BazookaManager.Instance.GetAccountID() == 1 && BazookaManager.Instance.GetBirdIcon() == 1) && overlayID != 8;
|
||||
overlay9.interactable = overlayID != 9;
|
||||
overlay10.interactable = overlayID != 10;
|
||||
overlay11.interactable = overlayID != 11;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@@ -7,56 +8,71 @@ public class IconsMenuBirdColorPanel : MonoBehaviour
|
||||
public Slider rSlider;
|
||||
public Slider gSlider;
|
||||
public Slider bSlider;
|
||||
public ColorPickerUI colorPickerUI;
|
||||
public GameObject manualModeUI;
|
||||
public TMP_InputField hexValue;
|
||||
public Image previewImage;
|
||||
public Button resetButton;
|
||||
public Button switchModeButton;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
var birdColor = PlayerPrefs.GetString("BirdColor", "255;255;255").Split(";");
|
||||
try
|
||||
{
|
||||
rSlider.value = int.Parse(birdColor[0]);
|
||||
gSlider.value = int.Parse(birdColor[1]);
|
||||
bSlider.value = int.Parse(birdColor[2]);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.LogError("Invalid BirdColor format");
|
||||
rSlider.value = 255; gSlider.value = 255; bSlider.value = 255;
|
||||
}
|
||||
SlidersChanged();
|
||||
var birdColor = BazookaManager.Instance.GetColorSettingIcon();
|
||||
rSlider.value = (int)birdColor[0];
|
||||
gSlider.value = (int)birdColor[1];
|
||||
bSlider.value = (int)birdColor[2];
|
||||
|
||||
rSlider.onValueChanged.AddListener(_ => SlidersChanged());
|
||||
gSlider.onValueChanged.AddListener(_ => SlidersChanged());
|
||||
bSlider.onValueChanged.AddListener(_ => SlidersChanged());
|
||||
SyncAll();
|
||||
|
||||
rSlider.onValueChanged.AddListener(_ => SyncAll());
|
||||
gSlider.onValueChanged.AddListener(_ => SyncAll());
|
||||
bSlider.onValueChanged.AddListener(_ => SyncAll());
|
||||
|
||||
hexValue.onValueChanged.AddListener(value =>
|
||||
{
|
||||
var v = value.StartsWith("#") ? value[1..] : value;
|
||||
if (v.Length == 6 && ColorUtility.TryParseHtmlString("#" + v, out var col))
|
||||
var hex = value.StartsWith("#") ? value : "#" + value;
|
||||
if (hex.Length == 7 && ColorUtility.TryParseHtmlString(hex, out var col))
|
||||
{
|
||||
rSlider.SetValueWithoutNotify(col.r * 255f);
|
||||
gSlider.SetValueWithoutNotify(col.g * 255f);
|
||||
bSlider.SetValueWithoutNotify(col.b * 255f);
|
||||
previewImage.color = col;
|
||||
PlayerPrefs.SetString("BirdColor", $"{(int)(col.r * 255)};{(int)(col.g * 255)};{(int)(col.b * 255)}");
|
||||
PlayerPrefs.Save();
|
||||
SyncAll();
|
||||
}
|
||||
});
|
||||
|
||||
resetButton.onClick.AddListener(() =>
|
||||
{
|
||||
hexValue.text = "#FFFFFF";
|
||||
rSlider.value = gSlider.value = bSlider.value = 255;
|
||||
});
|
||||
|
||||
switchModeButton.onClick.AddListener(() =>
|
||||
{
|
||||
bool enableManual = !manualModeUI.activeSelf;
|
||||
manualModeUI.SetActive(enableManual);
|
||||
colorPickerUI.gameObject.SetActive(!enableManual);
|
||||
});
|
||||
|
||||
colorPickerUI.OnColorChanged += color =>
|
||||
{
|
||||
rSlider.SetValueWithoutNotify(color.r * 255);
|
||||
gSlider.SetValueWithoutNotify(color.g * 255);
|
||||
bSlider.SetValueWithoutNotify(color.b * 255);
|
||||
SyncAll(fromPicker: true);
|
||||
};
|
||||
}
|
||||
|
||||
void SlidersChanged()
|
||||
void SyncAll(bool fromPicker = false)
|
||||
{
|
||||
var col = new Color(rSlider.value / 255f, gSlider.value / 255f, bSlider.value / 255f);
|
||||
|
||||
if (!fromPicker) colorPickerUI.SetSelectedColor(rSlider.value, gSlider.value, bSlider.value);
|
||||
|
||||
previewImage.color = col;
|
||||
hexValue.SetTextWithoutNotify($"#{ColorUtility.ToHtmlStringRGB(col)}");
|
||||
PlayerPrefs.SetString("BirdColor", $"{(int)rSlider.value};{(int)gSlider.value};{(int)bSlider.value}");
|
||||
PlayerPrefs.Save();
|
||||
hexValue.SetTextWithoutNotify("#" + ColorUtility.ToHtmlStringRGB(col));
|
||||
BazookaManager.Instance.SetColorSettingIcon(new JArray(
|
||||
(int)rSlider.value,
|
||||
(int)gSlider.value,
|
||||
(int)bSlider.value
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@@ -7,56 +8,71 @@ public class IconsMenuOverlayColorPanel : MonoBehaviour
|
||||
public Slider rSlider;
|
||||
public Slider gSlider;
|
||||
public Slider bSlider;
|
||||
public ColorPickerUI colorPickerUI;
|
||||
public GameObject manualModeUI;
|
||||
public TMP_InputField hexValue;
|
||||
public Image previewImage;
|
||||
public Button resetButton;
|
||||
public Button switchModeButton;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
var overlayColor = PlayerPrefs.GetString("OverlayColor", "255;255;255").Split(";");
|
||||
try
|
||||
{
|
||||
rSlider.value = int.Parse(overlayColor[0]);
|
||||
gSlider.value = int.Parse(overlayColor[1]);
|
||||
bSlider.value = int.Parse(overlayColor[2]);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.LogError("Invalid OverlayColor format");
|
||||
rSlider.value = 255; gSlider.value = 255; bSlider.value = 255;
|
||||
}
|
||||
SlidersChanged();
|
||||
var overlayColor = BazookaManager.Instance.GetColorSettingOverlay();
|
||||
rSlider.value = (int)overlayColor[0];
|
||||
gSlider.value = (int)overlayColor[1];
|
||||
bSlider.value = (int)overlayColor[2];
|
||||
|
||||
rSlider.onValueChanged.AddListener(_ => SlidersChanged());
|
||||
gSlider.onValueChanged.AddListener(_ => SlidersChanged());
|
||||
bSlider.onValueChanged.AddListener(_ => SlidersChanged());
|
||||
SyncAll();
|
||||
|
||||
rSlider.onValueChanged.AddListener(_ => SyncAll());
|
||||
gSlider.onValueChanged.AddListener(_ => SyncAll());
|
||||
bSlider.onValueChanged.AddListener(_ => SyncAll());
|
||||
|
||||
hexValue.onValueChanged.AddListener(value =>
|
||||
{
|
||||
var v = value.StartsWith("#") ? value[1..] : value;
|
||||
if (v.Length == 6 && ColorUtility.TryParseHtmlString("#" + v, out var col))
|
||||
var hex = value.StartsWith("#") ? value : "#" + value;
|
||||
if (hex.Length == 7 && ColorUtility.TryParseHtmlString(hex, out var col))
|
||||
{
|
||||
rSlider.SetValueWithoutNotify(col.r * 255f);
|
||||
gSlider.SetValueWithoutNotify(col.g * 255f);
|
||||
bSlider.SetValueWithoutNotify(col.b * 255f);
|
||||
previewImage.color = col;
|
||||
PlayerPrefs.SetString("OverlayColor", $"{(int)(col.r * 255)};{(int)(col.g * 255)};{(int)(col.b * 255)}");
|
||||
PlayerPrefs.Save();
|
||||
SyncAll();
|
||||
}
|
||||
});
|
||||
|
||||
resetButton.onClick.AddListener(() =>
|
||||
{
|
||||
hexValue.text = "#FFFFFF";
|
||||
rSlider.value = gSlider.value = bSlider.value = 255;
|
||||
});
|
||||
|
||||
switchModeButton.onClick.AddListener(() =>
|
||||
{
|
||||
bool enableManual = !manualModeUI.activeSelf;
|
||||
manualModeUI.SetActive(enableManual);
|
||||
colorPickerUI.gameObject.SetActive(!enableManual);
|
||||
});
|
||||
|
||||
colorPickerUI.OnColorChanged += color =>
|
||||
{
|
||||
rSlider.SetValueWithoutNotify(color.r * 255);
|
||||
gSlider.SetValueWithoutNotify(color.g * 255);
|
||||
bSlider.SetValueWithoutNotify(color.b * 255);
|
||||
SyncAll(fromPicker: true);
|
||||
};
|
||||
}
|
||||
|
||||
void SlidersChanged()
|
||||
void SyncAll(bool fromPicker = false)
|
||||
{
|
||||
var col = new Color(rSlider.value / 255f, gSlider.value / 255f, bSlider.value / 255f);
|
||||
|
||||
if (!fromPicker) colorPickerUI.SetSelectedColor(rSlider.value, gSlider.value, bSlider.value);
|
||||
|
||||
previewImage.color = col;
|
||||
hexValue.SetTextWithoutNotify($"#{ColorUtility.ToHtmlStringRGB(col)}");
|
||||
PlayerPrefs.SetString("OverlayColor", $"{(int)rSlider.value};{(int)gSlider.value};{(int)bSlider.value}");
|
||||
PlayerPrefs.Save();
|
||||
hexValue.SetTextWithoutNotify("#" + ColorUtility.ToHtmlStringRGB(col));
|
||||
BazookaManager.Instance.SetColorSettingOverlay(new JArray(
|
||||
(int)rSlider.value,
|
||||
(int)gSlider.value,
|
||||
(int)bSlider.value
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
@@ -78,7 +79,7 @@ public class LeaderboardsMenu : MonoBehaviour
|
||||
berryPanel.SetActive(false);
|
||||
break;
|
||||
case 1:
|
||||
refreshButton.transform.localPosition = new Vector2(-402.5f, -282.33f);
|
||||
refreshButton.transform.localPosition = new UnityEngine.Vector2(-402.5f, -282.33f);
|
||||
refreshButton.gameObject.SetActive(true);
|
||||
GetTopPlayersScore();
|
||||
selectionPanel.SetActive(false);
|
||||
@@ -86,7 +87,7 @@ public class LeaderboardsMenu : MonoBehaviour
|
||||
berryPanel.SetActive(false);
|
||||
break;
|
||||
case 2:
|
||||
refreshButton.transform.localPosition = new Vector2(402.5f, 282.33f);
|
||||
refreshButton.transform.localPosition = new UnityEngine.Vector2(402.5f, 282.33f);
|
||||
refreshButton.gameObject.SetActive(true);
|
||||
berryShowTypeDropdown.value = 0;
|
||||
GetTopPlayersBerry(0);
|
||||
@@ -165,6 +166,12 @@ public class LeaderboardsMenu : MonoBehaviour
|
||||
var playerOverlayIcon = playerIcon.transform.GetChild(0).GetComponent<Image>();
|
||||
var highScoreText = entryInfo.transform.GetChild(1).GetComponent<TMP_Text>();
|
||||
|
||||
if (BazookaManager.Instance.GetAccountID() == BigInteger.Parse(uid))
|
||||
{
|
||||
usernameText.color = Color.aquamarine;
|
||||
highScoreText.color = Color.aquamarine;
|
||||
}
|
||||
|
||||
usernameText.text = $"{username} (#{i + 1})";
|
||||
highScoreText.text += Tools.FormatWithCommas(highScore);
|
||||
playerIcon.sprite = Resources.Load<Sprite>("Icons/Icons/bird_" + icon);
|
||||
@@ -179,15 +186,15 @@ public class LeaderboardsMenu : MonoBehaviour
|
||||
}
|
||||
else if (overlay == "8")
|
||||
{
|
||||
playerOverlayIcon.transform.localPosition = new Vector2(-16.56f, 14.81f);
|
||||
playerOverlayIcon.transform.localPosition = new UnityEngine.Vector2(-16.56f, 14.81f);
|
||||
}
|
||||
else if (overlay == "11")
|
||||
{
|
||||
playerOverlayIcon.transform.localPosition = new Vector2(-14.74451f, 20.39122f);
|
||||
playerOverlayIcon.transform.localPosition = new UnityEngine.Vector2(-14.74451f, 20.39122f);
|
||||
}
|
||||
else if (overlay == "13")
|
||||
{
|
||||
playerOverlayIcon.transform.localPosition = new Vector2(-16.54019f, 14.70365f);
|
||||
playerOverlayIcon.transform.localPosition = new UnityEngine.Vector2(-16.54019f, 14.70365f);
|
||||
}
|
||||
try
|
||||
{
|
||||
@@ -281,6 +288,12 @@ public class LeaderboardsMenu : MonoBehaviour
|
||||
var playerOverlayIcon = playerIcon.transform.GetChild(0).GetComponent<Image>();
|
||||
var highScoreText = entryInfo.transform.GetChild(1).GetComponent<TMP_Text>();
|
||||
|
||||
if (BazookaManager.Instance.GetAccountID() == BigInteger.Parse(uid))
|
||||
{
|
||||
usernameText.color = Color.aquamarine;
|
||||
highScoreText.color = Color.aquamarine;
|
||||
}
|
||||
|
||||
usernameText.text = $"{username} (#{i + 1})";
|
||||
highScoreText.text += Tools.FormatWithCommas(highScore);
|
||||
playerIcon.sprite = Resources.Load<Sprite>("Icons/Icons/bird_" + icon);
|
||||
@@ -295,15 +308,15 @@ public class LeaderboardsMenu : MonoBehaviour
|
||||
}
|
||||
else if (overlay == "8")
|
||||
{
|
||||
playerOverlayIcon.transform.localPosition = new Vector2(-16.56f, 14.81f);
|
||||
playerOverlayIcon.transform.localPosition = new UnityEngine.Vector2(-16.56f, 14.81f);
|
||||
}
|
||||
else if (overlay == "11")
|
||||
{
|
||||
playerOverlayIcon.transform.localPosition = new Vector2(-14.74451f, 20.39122f);
|
||||
playerOverlayIcon.transform.localPosition = new UnityEngine.Vector2(-14.74451f, 20.39122f);
|
||||
}
|
||||
else if (overlay == "13")
|
||||
{
|
||||
playerOverlayIcon.transform.localPosition = new Vector2(-16.54019f, 14.70365f);
|
||||
playerOverlayIcon.transform.localPosition = new UnityEngine.Vector2(-16.54019f, 14.70365f);
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
@@ -13,41 +12,6 @@ public class LoadingMenu : MonoBehaviour
|
||||
|
||||
void Awake()
|
||||
{
|
||||
if (PlayerPrefs.GetString("latestVersion", Application.version) == "1.4.0-beta1")
|
||||
{
|
||||
PlayerPrefs.DeleteKey("Setting2");
|
||||
PlayerPrefs.DeleteKey("Setting3");
|
||||
PlayerPrefs.SetInt("Setting2", PlayerPrefs.GetInt("Setting4", 0));
|
||||
PlayerPrefs.SetInt("Setting3", PlayerPrefs.GetInt("Setting5", 0));
|
||||
PlayerPrefs.SetString("latestVersion", "1.4.0");
|
||||
}
|
||||
if (PlayerPrefs.HasKey("HighScore"))
|
||||
{
|
||||
PlayerPrefs.SetString("HighScoreV2", Math.Max(PlayerPrefs.GetInt("HighScore"), 0).ToString());
|
||||
PlayerPrefs.DeleteKey("HighScore");
|
||||
}
|
||||
QualitySettings.vSyncCount = PlayerPrefs.GetInt("Setting3", 1) == 1 ? 1 : -1;
|
||||
if (!Application.isMobilePlatform && Application.platform != RuntimePlatform.WebGLPlayer)
|
||||
{
|
||||
SetIfNone("Setting1", 1);
|
||||
SetIfNone("Setting2", 0);
|
||||
SetIfNone("Setting3", 1);
|
||||
SetIfNone("Setting4", 0);
|
||||
Screen.fullScreen = PlayerPrefs.GetInt("Setting1", 1) == 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetIfNone("Setting1", 1, true);
|
||||
SetIfNone("Setting2", 0);
|
||||
SetIfNone("Setting3", 1, true);
|
||||
SetIfNone("Setting4", 0);
|
||||
Application.targetFrameRate = 360;
|
||||
QualitySettings.vSyncCount = 0;
|
||||
if (Application.platform == RuntimePlatform.WebGLPlayer)
|
||||
{
|
||||
Screen.fullScreen = false;
|
||||
}
|
||||
}
|
||||
PlayerPrefs.SetString("latestVersion", Application.version);
|
||||
updateButton.onClick.AddListener(() =>
|
||||
{
|
||||
@@ -67,24 +31,17 @@ public class LoadingMenu : MonoBehaviour
|
||||
async void CheckUpdate()
|
||||
{
|
||||
string response;
|
||||
if (Application.platform != RuntimePlatform.WebGLPlayer)
|
||||
using UnityWebRequest request = UnityWebRequest.Get(SensitiveInfo.SERVER_DATABASE_PREFIX + "canLoadClient.php");
|
||||
request.SetRequestHeader("Requester", "BerryDashClient");
|
||||
request.SetRequestHeader("ClientVersion", Application.version);
|
||||
request.SetRequestHeader("ClientPlatform", Application.platform.ToString());
|
||||
await request.SendWebRequest();
|
||||
if (request.result != UnityWebRequest.Result.Success)
|
||||
{
|
||||
using UnityWebRequest request = UnityWebRequest.Get(SensitiveInfo.SERVER_DATABASE_PREFIX + "canLoadClient.php");
|
||||
request.SetRequestHeader("Requester", "BerryDashClient");
|
||||
request.SetRequestHeader("ClientVersion", Application.version);
|
||||
request.SetRequestHeader("ClientPlatform", Application.platform.ToString());
|
||||
await request.SendWebRequest();
|
||||
if (request.result != UnityWebRequest.Result.Success)
|
||||
{
|
||||
text.text = "Failed to check version";
|
||||
return;
|
||||
}
|
||||
response = request.downloadHandler.text;
|
||||
}
|
||||
else
|
||||
{
|
||||
response = "1";
|
||||
text.text = "Failed to check version";
|
||||
return;
|
||||
}
|
||||
response = request.downloadHandler.text;
|
||||
if (response == "1")
|
||||
{
|
||||
await SceneManager.LoadSceneAsync("MainMenu");
|
||||
@@ -117,12 +74,4 @@ public class LoadingMenu : MonoBehaviour
|
||||
updateButton.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
void SetIfNone(string key, int value, bool overrideValue = false)
|
||||
{
|
||||
if (!PlayerPrefs.HasKey(key) || overrideValue)
|
||||
{
|
||||
PlayerPrefs.SetInt(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ public class MenuMusic : MonoBehaviour
|
||||
Instance = this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||
GetComponent<AudioSource>().volume = PlayerPrefs.GetFloat("musicVolume", 1f);
|
||||
GetComponent<AudioSource>().volume = BazookaManager.Instance.GetSettingMusicVolume();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -12,50 +12,38 @@ public class SettingsMenu : MonoBehaviour
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
musicSlider.value = PlayerPrefs.GetFloat("musicVolume", 1f);
|
||||
sfxSlider.value = PlayerPrefs.GetFloat("sfxVolume", 1f);
|
||||
musicSlider.value = BazookaManager.Instance.GetSettingMusicVolume();
|
||||
sfxSlider.value = BazookaManager.Instance.GetSettingSFXVolume();
|
||||
if (!Application.isMobilePlatform)
|
||||
{
|
||||
setting1toggle.isOn = PlayerPrefs.GetInt("Setting1", 1) == 1;
|
||||
setting2toggle.isOn = PlayerPrefs.GetInt("Setting2", 0) == 1;
|
||||
setting3toggle.isOn = PlayerPrefs.GetInt("Setting3", 1) == 1;
|
||||
setting4toggle.isOn = PlayerPrefs.GetInt("Setting4", 0) == 1;
|
||||
setting1toggle.isOn = BazookaManager.Instance.GetSettingFullScreen() ?? true == true;
|
||||
setting2toggle.isOn = BazookaManager.Instance.GetSettingShowFPS() == true;
|
||||
setting3toggle.isOn = BazookaManager.Instance.GetSettingVsync() ?? true == true;
|
||||
setting4toggle.isOn = BazookaManager.Instance.GetSettingHideSocials() == true;
|
||||
}
|
||||
else
|
||||
{
|
||||
setting1toggle.interactable = false;
|
||||
setting2toggle.isOn = PlayerPrefs.GetInt("Setting2", 0) == 1;
|
||||
setting2toggle.isOn = BazookaManager.Instance.GetSettingShowFPS() == true;
|
||||
setting3toggle.interactable = false;
|
||||
setting4toggle.isOn = PlayerPrefs.GetInt("Setting4", 0) == 1;
|
||||
setting4toggle.isOn = BazookaManager.Instance.GetSettingHideSocials() == true;
|
||||
}
|
||||
setting1toggle.onValueChanged.AddListener(value =>
|
||||
{
|
||||
BazookaManager.Instance.SetSettingFullScreen(value);
|
||||
Screen.fullScreen = value;
|
||||
PlayerPrefs.SetInt("Setting1", value ? 1 : 0);
|
||||
});
|
||||
setting2toggle.onValueChanged.AddListener(value =>
|
||||
{
|
||||
PlayerPrefs.SetInt("Setting2", value ? 1 : 0);
|
||||
BazookaManager.Instance.SetSettingShowFPS(value);
|
||||
});
|
||||
setting3toggle.onValueChanged.AddListener(value =>
|
||||
{
|
||||
PlayerPrefs.SetInt("Setting3", value ? 1 : 0);
|
||||
BazookaManager.Instance.SetSettingVsync(value);
|
||||
QualitySettings.vSyncCount = value ? 1 : -1;
|
||||
});
|
||||
setting4toggle.onValueChanged.AddListener(value =>
|
||||
{
|
||||
PlayerPrefs.SetInt("Setting4", value ? 1 : 0);
|
||||
});
|
||||
musicSlider.onValueChanged.AddListener(value =>
|
||||
{
|
||||
PlayerPrefs.SetFloat("musicVolume", value);
|
||||
PlayerPrefs.Save();
|
||||
MenuMusic.Instance.GetComponent<AudioSource>().volume = value;
|
||||
});
|
||||
sfxSlider.onValueChanged.AddListener(value =>
|
||||
{
|
||||
PlayerPrefs.SetFloat("sfxVolume", value);
|
||||
PlayerPrefs.Save();
|
||||
});
|
||||
setting4toggle.onValueChanged.AddListener(value => BazookaManager.Instance.SetSettingHideSocials(value));
|
||||
musicSlider.onValueChanged.AddListener(value => BazookaManager.Instance.SetSettingMusicVolume(value));
|
||||
sfxSlider.onValueChanged.AddListener(value => BazookaManager.Instance.SetSettingSFXVolume(value));
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@@ -7,56 +8,79 @@ public class SettingsMenuBgColorPanel : MonoBehaviour
|
||||
public Slider rSlider;
|
||||
public Slider gSlider;
|
||||
public Slider bSlider;
|
||||
public ColorPickerUI colorPickerUI;
|
||||
public GameObject manualModeUI;
|
||||
public GameObject settingsUI;
|
||||
public TMP_InputField hexValue;
|
||||
public Image previewImage;
|
||||
public Button resetButton;
|
||||
public Button switchModeButton;
|
||||
public Button previewButton;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
var backgroundColor = PlayerPrefs.GetString("BackgroundColor", "58;58;58").Split(";");
|
||||
try
|
||||
{
|
||||
rSlider.value = int.Parse(backgroundColor[0]);
|
||||
gSlider.value = int.Parse(backgroundColor[1]);
|
||||
bSlider.value = int.Parse(backgroundColor[2]);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.LogError("Invalid BackgroundColor format");
|
||||
rSlider.value = 58; gSlider.value = 58; bSlider.value = 58;
|
||||
}
|
||||
SlidersChanged();
|
||||
var backgroundColor = BazookaManager.Instance.GetColorSettingBackground();
|
||||
rSlider.value = (int)backgroundColor[0];
|
||||
gSlider.value = (int)backgroundColor[1];
|
||||
bSlider.value = (int)backgroundColor[2];
|
||||
|
||||
rSlider.onValueChanged.AddListener(_ => SlidersChanged());
|
||||
gSlider.onValueChanged.AddListener(_ => SlidersChanged());
|
||||
bSlider.onValueChanged.AddListener(_ => SlidersChanged());
|
||||
SyncAll();
|
||||
|
||||
rSlider.onValueChanged.AddListener(_ => SyncAll());
|
||||
gSlider.onValueChanged.AddListener(_ => SyncAll());
|
||||
bSlider.onValueChanged.AddListener(_ => SyncAll());
|
||||
|
||||
hexValue.onValueChanged.AddListener(value =>
|
||||
{
|
||||
var v = value.StartsWith("#") ? value[1..] : value;
|
||||
if (v.Length == 6 && ColorUtility.TryParseHtmlString("#" + v, out var col))
|
||||
var hex = value.StartsWith("#") ? value : "#" + value;
|
||||
if (hex.Length == 7 && ColorUtility.TryParseHtmlString(hex, out var col))
|
||||
{
|
||||
rSlider.SetValueWithoutNotify(col.r * 255f);
|
||||
gSlider.SetValueWithoutNotify(col.g * 255f);
|
||||
bSlider.SetValueWithoutNotify(col.b * 255f);
|
||||
previewImage.color = col;
|
||||
PlayerPrefs.SetString("BackgroundColor", $"{(int)(col.r * 255)};{(int)(col.g * 255)};{(int)(col.b * 255)}");
|
||||
PlayerPrefs.Save();
|
||||
SyncAll();
|
||||
}
|
||||
});
|
||||
|
||||
resetButton.onClick.AddListener(() =>
|
||||
{
|
||||
hexValue.text = "#3A3A3A";
|
||||
rSlider.value = gSlider.value = bSlider.value = 58;
|
||||
});
|
||||
|
||||
switchModeButton.onClick.AddListener(() =>
|
||||
{
|
||||
bool enableManual = !manualModeUI.activeSelf;
|
||||
manualModeUI.SetActive(enableManual);
|
||||
colorPickerUI.gameObject.SetActive(!enableManual);
|
||||
});
|
||||
|
||||
previewButton.onClick.AddListener(() =>
|
||||
{
|
||||
settingsUI.SetActive(!settingsUI.activeSelf);
|
||||
Camera.main.backgroundColor = !settingsUI.activeSelf ? new Color(rSlider.value / 255f, gSlider.value / 255f, bSlider.value / 255f) : new Color(24 / 255f, 24 / 255f, 24 / 255f);
|
||||
previewButton.transform.GetChild(0).GetComponent<TMP_Text>().text = settingsUI.activeSelf ? "Preview On" : "Preview Off";
|
||||
});
|
||||
|
||||
colorPickerUI.OnColorChanged += color =>
|
||||
{
|
||||
rSlider.SetValueWithoutNotify(color.r * 255);
|
||||
gSlider.SetValueWithoutNotify(color.g * 255);
|
||||
bSlider.SetValueWithoutNotify(color.b * 255);
|
||||
SyncAll(fromPicker: true);
|
||||
};
|
||||
}
|
||||
|
||||
void SlidersChanged()
|
||||
void SyncAll(bool fromPicker = false)
|
||||
{
|
||||
var col = new Color(rSlider.value / 255f, gSlider.value / 255f, bSlider.value / 255f);
|
||||
previewImage.color = col;
|
||||
hexValue.SetTextWithoutNotify($"#{ColorUtility.ToHtmlStringRGB(col)}");
|
||||
PlayerPrefs.SetString("BackgroundColor", $"{(int)rSlider.value};{(int)gSlider.value};{(int)bSlider.value}");
|
||||
PlayerPrefs.Save();
|
||||
|
||||
if (!fromPicker) colorPickerUI.SetSelectedColor(rSlider.value, gSlider.value, bSlider.value);
|
||||
if (!settingsUI.activeSelf) Camera.main.backgroundColor = col;
|
||||
|
||||
hexValue.SetTextWithoutNotify("#" + ColorUtility.ToHtmlStringRGB(col));
|
||||
BazookaManager.Instance.SetColorSettingBackground(new JArray(
|
||||
(int)rSlider.value,
|
||||
(int)gSlider.value,
|
||||
(int)bSlider.value
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using UnityEngine;
|
||||
|
||||
public static class Tools
|
||||
{
|
||||
public static Sprite GetIconForUser(int user)
|
||||
public static Sprite GetIconForUser(BigInteger user)
|
||||
{
|
||||
if (user == 1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user