Example #1
0
    /// <summary>
    /// Adds the update.
    /// </summary>
    /// <param name="method">Method.</param>
    public void AddUpdate(CustomerAction method)
    {
        if (method == null)
        {
            return;
        }
        int i = updateFunctions.IndexOf(method);

        if (i == -1)
        {
            updateFunctions.Add(method);
        }
        else
        {
            GlobalLog.LogWarning("AddUpdate has exist" + method.ToString());
        }
    }
Example #2
0
    /// <summary>
    /// Update this instance.
    ///
    /// </summary>
    public virtual void Update()
    {
        //create new www.
        if (currentDownloadTask == null)
        {
            if (tasks.Count > 0)
            {
                CreateWWW();
            }
        }
        else
        {
            //chech if done or not.
            if (currentDownloadTask.WWWTask.IsDone)
            {
                currentDownloadTask.WWWing = false;
                if (currentDownloadTask.WWWTask.ErrorMsg != null)
                {
                    GlobalLog.LogWarning(currentDownloadTask.Name + " load failed, " + currentDownloadTask.WWWTask.ErrorMsg);
                }
                else
                {
                    if (!currentDownloadTask.OnlyDownload)
                    {
                        AdddLoadingBuffer(currentDownloadTask);
                    }
                }
                currentDownloadTask = null;
            }
        }

        //check loaded or not.
        for (indexFor = 0, maxFor = assetBundleLoadingBuffer.Count; indexFor < maxFor; indexFor++)
        {
            if (assetBundleLoadingBuffer[indexFor] == null)
            {
                continue;
            }
            if (assetBundleLoadingBuffer[indexFor].RequestTask.Request.isDone)
            {
                NotifyWhenLoaded(assetBundleLoadingBuffer[indexFor]);
                assetBundleLoadingBuffer[indexFor] = null;
            }
        }
    }