Fix loading menu
This commit is contained in:
2 files changed
+5
-58
No files matched your search
@@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System.Threading.Tasks;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Networking;
|
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
@@ -11,7 +10,7 @@ public class LoadingMenu : MonoBehaviour
|
|||||||
public Button updateButton;
|
public Button updateButton;
|
||||||
public Button continueButton;
|
public Button continueButton;
|
||||||
|
|
||||||
void Start()
|
async void Start()
|
||||||
{
|
{
|
||||||
if (!Application.isMobilePlatform)
|
if (!Application.isMobilePlatform)
|
||||||
{
|
{
|
||||||
@@ -28,60 +27,8 @@ public class LoadingMenu : MonoBehaviour
|
|||||||
PlayerPrefs.SetString("latestVersion", Application.version);
|
PlayerPrefs.SetString("latestVersion", Application.version);
|
||||||
updateButton.onClick.AddListener(() =>
|
updateButton.onClick.AddListener(() =>
|
||||||
{
|
{
|
||||||
Application.OpenURL("https://berrydashwithguns.lncvrt.xyz/download");
|
Application.OpenURL("https://games.lncvrt.xyz/download");
|
||||||
});
|
});
|
||||||
CheckUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
async void CheckUpdate()
|
|
||||||
{
|
|
||||||
using UnityWebRequest request = UnityWebRequest.Get("https://berrydashwithguns.lncvrt.xyz/database/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;
|
|
||||||
}
|
|
||||||
string response = request.downloadHandler.text;
|
|
||||||
if (response == "1")
|
|
||||||
{
|
|
||||||
await SceneManager.LoadSceneAsync("GamePlayer");
|
await SceneManager.LoadSceneAsync("GamePlayer");
|
||||||
}
|
}
|
||||||
else if (response == "2")
|
|
||||||
{
|
|
||||||
text.text = "Outdated client! You can still play the game and access the servers, but it isn't recommended.";
|
|
||||||
|
|
||||||
var updateButtonPos = updateButton.transform.localPosition;
|
|
||||||
updateButtonPos.x = -135;
|
|
||||||
updateButton.transform.localPosition = updateButtonPos;
|
|
||||||
|
|
||||||
updateButton.gameObject.SetActive(true);
|
|
||||||
continueButton.gameObject.SetActive(true);
|
|
||||||
}
|
|
||||||
else if (response == "3")
|
|
||||||
{
|
|
||||||
text.text = "Outdated client! You can still load into the game, but online features may not be available.";
|
|
||||||
|
|
||||||
var updateButtonPos = updateButton.transform.localPosition;
|
|
||||||
updateButtonPos.x = -135;
|
|
||||||
updateButton.transform.localPosition = updateButtonPos;
|
|
||||||
|
|
||||||
updateButton.gameObject.SetActive(true);
|
|
||||||
continueButton.gameObject.SetActive(true);
|
|
||||||
}
|
|
||||||
else if (response == "4")
|
|
||||||
{
|
|
||||||
text.text = "You are on a beta version of the game. You can still play the game and access the servers, but it is recommended to use the latest stable version.";
|
|
||||||
continueButton.transform.position = updateButton.transform.position;
|
|
||||||
continueButton.gameObject.SetActive(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
text.text = "Outdated client! Please update your client to play";
|
|
||||||
updateButton.gameObject.SetActive(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
m_EditorVersion: 6000.2.9f1
|
m_EditorVersion: 6000.2.10f1
|
||||||
m_EditorVersionWithRevision: 6000.2.9f1 (e0c4e791ab71)
|
m_EditorVersionWithRevision: 6000.2.10f1 (d3d30d158480)
|
||||||
Reference in new issue
Block a user