Maintaince screen added
This commit is contained in:
44
Assets/Game/Scripts/MaintainceChecker.cs
Normal file
44
Assets/Game/Scripts/MaintainceChecker.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class MaintainceChecker : MonoBehaviour
|
||||
{
|
||||
public static MaintainceChecker instance;
|
||||
public int checkInterval = 10;
|
||||
float t;
|
||||
void Start()
|
||||
{
|
||||
instance =this;
|
||||
CheckMaintainceStatus();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if(t < checkInterval){
|
||||
t+= Time.deltaTime;
|
||||
}else{
|
||||
t=0;
|
||||
|
||||
CheckMaintainceStatus();
|
||||
}
|
||||
}
|
||||
|
||||
public void CheckMaintainceStatus(){
|
||||
StartCoroutine(checkMaintaince());
|
||||
}
|
||||
|
||||
IEnumerator checkMaintaince(){
|
||||
WWW req = new WWW(DBmanager.phpRoot+"get_server_status.php");
|
||||
yield return req;
|
||||
|
||||
if(req.text != "200"){
|
||||
Debug.LogError("Servers are not ready. Gotta wait");
|
||||
LoadingScreen.instance.LoadLevel("Maintaince");
|
||||
}else{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user