Beispiel #1
0
    public static IEnumerator GetCDNWWW(string url, System.Action <WWW> retWWW, bool bAddStamp = true)
    {
        string firstUrl = url;

        if (bAddStamp)
        {
            firstUrl = AddTimestampToUrl(url);
        }
        WWW wwwOrg = new WWW(firstUrl);

        yield return(wwwOrg);

        if (string.IsNullOrEmpty(wwwOrg.error) || string.IsNullOrEmpty(PlatformHelper.GetCDNOrgUrl()) || string.IsNullOrEmpty(PlatformHelper.GetResDonwloadUrl()))
        {
            retWWW(wwwOrg);
            yield break;
        }
        string replaceUrl = url.Replace(PlatformHelper.GetCDNOrgUrl(), PlatformHelper.GetCDNReplaceUrl());
        WWW    wwwReplace = new WWW(replaceUrl);

        yield return(wwwReplace);

        if (string.IsNullOrEmpty(wwwReplace.error) || string.IsNullOrEmpty(PlatformHelper.GetCDNReplaceUrl2()))
        {
            retWWW(wwwReplace);
            yield break;
        }

        string replaceUrl2 = url.Replace(PlatformHelper.GetCDNOrgUrl(), PlatformHelper.GetCDNReplaceUrl2());
        WWW    wwwReplace2 = new WWW(replaceUrl2);

        yield return(wwwReplace2);

        retWWW(wwwReplace2);
    }