示例#1
0
    public string GetBundleUrl(string fileName)
    {
        string szUrl = "";

#if UNITY_EDITOR
        szUrl = Application.dataPath + "/../AssetBundles/" + SysUtil.GetPlatformName() + "/" + fileName;
        //szUrl = m_szAssetUrl + "/AssetBundles/" + SysUtil.GetPlatformName() + "/" + fileName;
        //return Application.streamingAssetsPath + "/AssetBundles/" + SysUtil.GetPlatformName() + "/" + fileName;
#elif UNITY_WEBGL
        string szPrefix = "";
        if (m_szAssetUrl.Length != 0)
        {
            szPrefix = m_szAssetUrl;
        }
        else
        {
            szPrefix = Application.streamingAssetsPath;
        }
        szUrl = szPrefix + "/AssetBundles/" + SysUtil.GetPlatformName() + "/" + fileName + "?" + VersionManager.Instance().GetVersionUrl();
#else
        szUrl = Application.streamingAssetsPath + "/AssetBundles/" + SysUtil.GetPlatformName() + "/" + fileName;
        string szUpdatePath = Application.persistentDataPath + "/AssetBundles/" + SysUtil.GetPlatformName() + "/" + fileName;
        if (File.Exists(szUpdatePath))
        {
            szUrl = szUpdatePath;
        }
#endif
        SampleDebuger.LogGreen("bundle url : " + szUrl);
        return(szUrl);
    }
示例#2
0
    public void StartDownload()
    {
        m_bDownloading = true;
        string szVersion = GameInstance.Instance().proServerUrl
                           + string.Format(GameInstance.Instance().proServerPlatformContentPath,
                                           VersionManager.Instance().GetVersionUrl(), SysUtil.GetPlatformName())
                           + "?" + Time.realtimeSinceStartup.ToString();

        AssetDownloader.Instance().AddURL(szVersion);
        string szVersionContent = GameInstance.Instance().proServerUrl
                                  + string.Format(GameInstance.Instance().proServerVersionContent, VersionManager.Instance().GetVersionUrl())
                                  + "?" + Time.realtimeSinceStartup.ToString();

        AssetDownloader.Instance().AddURL(szVersionContent);
        //AssetDownloader.Intance().AddURL(getCommonURL());
        //AssetDownloader.Intance().AddURL(getCustomURL());
        AssetDownloader.Instance().Start();
    }