void DownLoadCheckFileFail(DownLoader dloader, CheckComplete onComplete, bool useCache, bool needRetry)
        {
            isChecking = false;
            string tfilePath  = GameCore.CombinePath(GameCore.PersistentResDataPath, GetCheckFileName());
            bool   isfileExit = File.Exists(tfilePath);

            if (dloader.IsCompleteDownLoad && isfileExit)
            {
                DownLoadCheckFileFinished(onComplete);
            }
            else
            {
                if (ReTryCheckCount >= ReTryMaxCount)
                {
                    needRetry = false;
                }

                if (needRetry)
                {
                    ReTryCheckCount++;
                    if (autoUseCacheCheck && isfileExit)
                    {
                        StartCoroutine(WaitRetryCheck(0.1f, onComplete, true, needRetry));
                    }
                    else
                    {
                        StartCoroutine(WaitRetryCheck(3, onComplete, useCache, needRetry));
                    }
                }
                else
                {
                    CallCheckOnComplete(onComplete, null);
                }
            }
        }
        void DownLoadCheckFileFinished(CheckComplete onComplete)
        {
            isChecking = false;
            ByteFileInfoList ret = GetNeedDownloadFiles(GetUpdateList());

            CallCheckOnComplete(onComplete, ret);
        }
 static public void CheckUpdate(CheckComplete onComplete, bool useCache, bool needRetry)
 {
     if (isChecking || isUpdateing)
     {
         Debug.LogError("Checking or Updateing.");
         return;
     }
     isChecking = true;
     Instance.StartCoroutine(sInstance.WaitStartCheck(0.1f, onComplete, useCache, needRetry));
 }
Exemple #4
0
        /// <summary>
        /// Click's the Fulfill Request then OK button, checks for 'Scroll Quest' completion.
        /// </summary>
        private void FulfillRequest()
        {
            UpdateScreen();

            if (_reset) //If Scroll Quest Reset preference is check and the pixel is detected, reset the quest.
            {
                if (CheckComplete.IsPresent(Screen, 2))
                {
                    log.Info(BotName + " Scroll Quest has '0' remaining for the day.");

                    Thread.Sleep(TimeSpan.FromSeconds(1));

                    ResetScrollQuest();
                }
            }

            UpdateScreen();

            if (!_reset)//If Scroll Quest Reset preference is NOT check and the pixel is detected, close the window
            {
                if (CheckComplete.IsPresent(Screen, 2))
                {
                    Click(Nav.MapClose);

                    log.Info(BotName + " Scroll Quest has 0 remaining for the day, closing item menu and ending Scroll Quest.");

                    MainWindow.main.UpdateLog = BotName + " has completed 'Scroll Quest'";

                    Complete = true;

                    return;
                }
            }

            UpdateScreen();

            if (_fulfill[0].IsPresent(Screen, 2) && _fulfill[1].IsPresent(Screen, 2))
            {
                log.Info(BotName + " Clicking Fulfill Quest ");

                Click(_fulfill[0].Point);
            }

            Thread.Sleep(1000);

            UpdateScreen();

            if (_fulfillOk[0].IsPresent(Screen, 2) && _fulfillOk[1].IsPresent(Screen, 2))
            {
                log.Info(BotName + " Clicking Fulfill Quest> Ok ");

                Click(_fulfillOk[0].Point);
            }
        }
 void DownLoadCheckFileEnd(DownLoader dloader, CheckComplete onComplete, bool useCache, bool needRetry)
 {
     if (dloader.IsCompleteDownLoad)
     {
         DownLoadCheckFileFinished(onComplete);
     }
     else
     {
         Debug.Log(dloader.Error);
         DownLoadCheckFileFail(dloader, onComplete, useCache, needRetry);
     }
 }
        void CallCheckOnComplete(CheckComplete onComplete, ByteFileInfoList pObj)
        {
            try
            {
                string error = checkLoader != null ? checkLoader.Error : null;

                ReleaseCheckLoader();
                ReTryCheckCount = 0;

                onComplete?.Invoke(pObj, error);
            }
            catch (System.Exception erro)
            {
                Debug.LogError("CheckUpdate->" + erro.ToString());
            }
        }
        IEnumerator CheckingUpdate(CheckComplete onComplete, bool useCache, bool needRetry)
        {
            ReleaseCheckLoader();

            string tuf        = GetServerUrl(LoaderManager.byteFileInfoFileName + BaseBundle.sSuffixName);
            string tcheckfile = GetCheckFileName();
            string tfilePath  = GameCore.CombinePath(GameCore.PersistentResDataPath, tcheckfile);

            if (!useCache || !File.Exists(tfilePath))
            {
                checkLoader = DownLoadManager.DownLoadFileAsync(tuf, GameCore.PersistentResDataPath, tcheckfile, null, 0, null);
                while (!checkLoader.IsDone)
                {
                    yield return(null);
                }
                DownLoadCheckFileEnd(checkLoader, onComplete, useCache, needRetry);
            }
            else
            {
                DownLoadCheckFileFinished(onComplete);
            }
        }
        IEnumerator CheckingUpdate(CheckComplete onComplete, bool useCache, bool needRetry)
        {
            ReleaseCheckLoader();

            string tdicpath   = string.Format("{0}/{1}/", updateData.server, updateData.version);
            string tuf        = GetServerUrl(LoadManager.byteFileInfoFileName + LoadManager.sSuffixName);
            string tcheckfile = GetCheckFileName();
            string tfilePath  = CombinePath(LoadManager.sidePath, tcheckfile);

            if (!useCache || !File.Exists(tfilePath))
            {
                checkLoader = DownLoadManager.DownLoadFileAsync(tuf, LoadManager.sidePath, tcheckfile, null, 0, null);
                while (!checkLoader.IsDone)
                {
                    yield return(null);
                }
                DownLoadCheckFileEnd(checkLoader, onComplete, useCache, needRetry);
            }
            else
            {
                DownLoadCheckFileFinished(onComplete);
            }
        }
Exemple #9
0
 private static void OnCheckComplete()
 {
     CheckComplete?.Invoke(null, EventArgs.Empty);
 }
        IEnumerator WaitRetryCheck(float dt, CheckComplete onComplete, bool useCache, bool needRetry)
        {
            yield return(new WaitForSeconds(dt));

            CheckUpdate(onComplete, useCache, needRetry);
        }
        IEnumerator WaitStartCheck(float delayTime, CheckComplete onComplete, bool useCache, bool needRetry)
        {
            yield return(new WaitForSeconds(delayTime));

            Instance.StartCoroutine(sInstance.CheckingUpdate(onComplete, useCache, needRetry));
        }