Send bird color to servers and load it on leaderboards
This commit is contained in:
@@ -49,6 +49,9 @@ public class AccountLoggedIn : MonoBehaviour
|
||||
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]);
|
||||
using UnityWebRequest request = UnityWebRequest.Post(SensitiveInfo.SERVER_DATABASE_PREFIX + "saveAccount.php", dataForm.GetWWWForm());
|
||||
request.SetRequestHeader("Requester", "BerryDashClient");
|
||||
request.SetRequestHeader("ClientVersion", Application.version);
|
||||
@@ -130,6 +133,7 @@ public class AccountLoggedIn : MonoBehaviour
|
||||
PlayerPrefs.SetString("TotalUltraBerries", split[7]);
|
||||
PlayerPrefs.SetString("TotalSpeedyBerries", split[8]);
|
||||
PlayerPrefs.SetString("TotalAttempts", split[9]);
|
||||
PlayerPrefs.SetString("BirdColor", $"{split[10]};{split[11]};{split[12]}");
|
||||
AccountHandler.UpdateStatusText(loggedInText, "Loaded account data", Color.green);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -83,6 +83,7 @@ public class AccountLogin : MonoBehaviour
|
||||
PlayerPrefs.SetString("TotalUltraBerries", array[10]);
|
||||
PlayerPrefs.SetString("TotalSpeedyBerries", array[11]);
|
||||
PlayerPrefs.SetString("TotalAttempts", array[12]);
|
||||
PlayerPrefs.SetString("BirdColor", $"{array[13]};{array[14]};{array[15]}");
|
||||
AccountHandler.instance.SwitchPanel(0);
|
||||
AccountHandler.UpdateStatusText(loginPanelStatusText, "", Color.red);
|
||||
}
|
||||
|
||||
@@ -141,6 +141,9 @@ public class LeaderboardsMenu : MonoBehaviour
|
||||
var icon = split[2];
|
||||
var overlay = split[3];
|
||||
var uid = split[4];
|
||||
var birdR = split[5];
|
||||
var birdG = split[6];
|
||||
var birdB = split[7];
|
||||
|
||||
var entryInfo = Instantiate(scoreSampleObject, scoreContent.transform);
|
||||
var usernameText = entryInfo.transform.GetChild(0).GetComponent<TMP_Text>();
|
||||
@@ -172,6 +175,13 @@ public class LeaderboardsMenu : MonoBehaviour
|
||||
{
|
||||
playerOverlayIcon.transform.localPosition = new Vector2(-16.54019f, 14.70365f);
|
||||
}
|
||||
try
|
||||
{
|
||||
playerIcon.color = new Color32(byte.Parse(birdR), byte.Parse(birdG), byte.Parse(birdB), 255);
|
||||
} catch (Exception)
|
||||
{
|
||||
playerIcon.color = Color.white;
|
||||
}
|
||||
entryInfo.SetActive(true);
|
||||
}
|
||||
}
|
||||
@@ -237,6 +247,9 @@ public class LeaderboardsMenu : MonoBehaviour
|
||||
var icon = split[2];
|
||||
var overlay = split[3];
|
||||
var uid = split[4];
|
||||
var birdR = split[5];
|
||||
var birdG = split[6];
|
||||
var birdB = split[7];
|
||||
|
||||
var entryInfo = Instantiate(berrySampleObject, berryContent.transform);
|
||||
var usernameText = entryInfo.transform.GetChild(0).GetComponent<TMP_Text>();
|
||||
@@ -268,6 +281,13 @@ public class LeaderboardsMenu : MonoBehaviour
|
||||
{
|
||||
playerOverlayIcon.transform.localPosition = new Vector2(-16.54019f, 14.70365f);
|
||||
}
|
||||
try
|
||||
{
|
||||
playerIcon.color = new Color32(byte.Parse(birdR), byte.Parse(birdG), byte.Parse(birdB), 255);
|
||||
} catch (Exception)
|
||||
{
|
||||
playerIcon.color = Color.white;
|
||||
}
|
||||
entryInfo.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user