Exemplo n.º 1
0
 private void _UpdateFinished()
 {
     m_updateCount = 0;
     m_currIndex   = 0;
     m_CoroutineJobQueue.StopJobCoroutine();
     m_CoroutineJobQueue.ClearAllJobs();
     m_delegate = null;
     SetState(State.Idle);
 }
Exemplo n.º 2
0
    private IEnumerator _DoCheckUpdate(IUpdateSysDelegate del, IUpdateFilter filter, MonoBehaviour mono, UpdateContext updateContext)
    {
        SetState(State.CheckUpgrade);

        //set context

        m_context.BaseVersion    = updateContext.BaseVersion;
        m_context.ResVersion     = updateContext.ResVersion;
        m_context.PackageVersion = updateContext.PackageVersion;

        m_context.BasePlatform = updateContext.BasePlatform;
        m_context.Platform     = updateContext.Platform;


        Debug.LogError(" App.version:" + m_context.BaseVersion + " Res.Version:" + m_context.ResVersion + "  pack.Version:" + m_context.PackageVersion + " baseplatform:" + m_context.BasePlatform + " platform:" + m_context.Platform);
        //do check
        //bool checkFinish = false;

        UpdateChecker checker = new UpdateChecker(m_context, filter);

        checker.StartCheck((result) =>
        {
            SetState(State.Idle);

            //checkFinish = true;

            if (!result.Success)
            {
                //notify error
                if (del != null)
                {
                    del.OnCheckUpdateError(result.ErrorCode);
                }
            }
            else
            {
                if (del != null)
                {
                    del.OnCheckUpdateSuccess(result);
                }
            }
        }, mono);

        //while (!checkFinish)
        //{

        //}
        yield return(null);
    }
Exemplo n.º 3
0
    public void StartResourceUpdate(UpdateCheckResult result, IUpdateSysDelegate del)
    {
        if (m_state == State.Upgrading)
        {
            Debug.LogError("already in upgrading state");
            return;
        }

        if (!result.NeedUpdate)
        {
            Debug.LogError("donot need update");
            return;
        }

        var list = result.ResInfoList;

        if (list == null || list.Count == 0)
        {
            Debug.LogError("empty res list");
            return;
        }

        m_delegate = del;
        _StartUpdate();

        for (int i = 0; i < list.Count; i++)
        {
            var info = list[i];

            IUpdateExecutor executor = GetUpdateExecutor(info.type);
            if (executor != null)
            {
                //JobQueueCoroutine需要重构下更易用
                UpdateResourceParam param = new UpdateResourceParam();
                param.executor = executor;
                param.info     = info;
                param.context  = m_context;

                m_updateCount++;
                m_CoroutineJobQueue.PushJob(_UpdateResCoroutine, param);
            }
            else
            {
                Debug.LogError("UpdateExecutor not registered for type:" + info.type);
            }
        }

        m_CoroutineJobQueue.StartJobCoroutine();
    }
Exemplo n.º 4
0
    public void CheckUpdate(IUpdateSysDelegate del, IUpdateFilter filter, MonoBehaviour mono, UpdateContext updateContext)
    {
        if (m_state != State.Idle)
        {
            return;
        }

        if (mono != null)
        {
            if (m_checkUpdateCor != null)
            {
                mono.StopCoroutine(m_checkUpdateCor);
            }

            m_checkUpdateCor = mono.StartCoroutine(_DoCheckUpdate(del, filter, mono, updateContext));
        }
    }