Пример #1
0
 void Awake()
 {
     label = GetComponent <UILabel>();
     if (isBuildVersion)
     {
         label.text = DarkRef.GetBuildVersion(includeTag);
     }
 }
Пример #2
0
    private IEnumerator VersionCheckCoroutine()
    {
        multiplayerEnabled = true; //Set to false when version check is ready

        while (!multiplayerEnabled)
        {
            WWW verChk = new WWW("http://darkraze.byethost6.com/darkraze_files/versionChk.txt");

            yield return(verChk);

            bool unavailable = false;
            if (verChk.error != null)
            {
                mpErrorTooltip.text = "Version validation service is unavailable.";
                unavailable         = true;
            }
            else
            {
                if (DarkRef.RemoveSpaces(DarkRef.GetBuildVersion(true)) == DarkRef.RemoveSpaces(verChk.text))
                {
                    multiplayerEnabled = true;
                    yield break;
                }
                else
                {
                    Debug.LogWarning("Your version is not the latest! Multiplayer will be disabled");
                    mpErrorTooltip.text = "Your client version must be up-to-date to participate in multiplayer!";
                }
            }

            float waitTime = 0f;
            while (waitTime < 5.1f)
            {
                waitTime += Time.deltaTime;

                if (unavailable)
                {
                    mpErrorTooltip.text = "Version validation service is unavailable (retrying in: " + Mathf.Max(0f, 5.1f - waitTime).ToString("F0") + ").";
                }

                yield return(null);
            }
        }
    }