45 lines
983 B
C#
45 lines
983 B
C#
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{
|
|
|
|
}
|
|
}
|
|
}
|