public void StartDownloadPackageById(int acId, bool isUsing4G)
    {
        this.mDownloadingAcId = acId;
        this.mUsing4GDownload = isUsing4G;
        this.SendUpdateAwardReq(this.mDownloadingAcId);
        GengXinYouLi gengXinYouLi = DataReader <GengXinYouLi> .Get(this.mDownloadingAcId);

        this.mDownloadingPackId = gengXinYouLi.FinishPar;
        DownloaderManager.Instance.DowanloadUpdatePackage(this.mDownloadingPackId, 0, new Action <float, float, string>(this.UpdatePackageProgress), new Action <bool>(this.DownloadPackageFinish), true, true);
    }
Beispiel #2
0
    private void OnClickButton(string type, UpdateGiftItem item)
    {
        if (item == null)
        {
            return;
        }
        if (type == "ClickButton")
        {
            if (item.Status == UpdateAcInfo.AcStep.STEP.Ready && OperateActivityManager.Instance.DownloadPackID > 0)
            {
                UIManagerControl.Instance.ShowToastText(GameDataUtils.GetChineseContent(513151, false));
                return;
            }
            switch (item.Status)
            {
            case UpdateAcInfo.AcStep.STEP.Ready:
                if (item.Data.FinishPar - 1 > OperateActivityManager.Instance.CurrentVersion)
                {
                    UIManagerControl.Instance.ShowToastText(GameDataUtils.GetChineseContent(513153, false));
                }
                else if (!OperateActivityManager.Instance.IsWifi)
                {
                    UIManagerControl.Instance.OpenUI("DialogBoxUI", UINodesManager.T3RootOfSpecial, false, UIType.NonPush);
                    DialogBoxUIViewModel.Instance.ShowAsOKCancel(GameDataUtils.GetChineseContent(621264, false), string.Format(GameDataUtils.GetChineseContent(513148, false), item.Pack.SizeMbit), null, delegate
                    {
                        OperateActivityManager.Instance.StartDownloadPackageById(item.Data.Id, true);
                        item.Status = UpdateAcInfo.AcStep.STEP.Start;
                    }, GameDataUtils.GetChineseContent(500012, false), GameDataUtils.GetChineseContent(500011, false), "button_orange_1", "button_yellow_1", UINodesManager.T4RootOfSpecial, true, true);
                }
                else
                {
                    OperateActivityManager.Instance.StartDownloadPackageById(item.Data.Id, false);
                    item.Status = UpdateAcInfo.AcStep.STEP.Start;
                }
                break;

            case UpdateAcInfo.AcStep.STEP.Finish:
                this.mLastReward = item.Data;
                OperateActivityManager.Instance.SendGetUpdateAwardReq(item.Data.Id);
                break;
            }
        }
        else if (type == "ClickReward")
        {
            this.mLastReward = item.Data;
            this.RewardPreView(true);
        }
    }
    private void CheckIsWifi()
    {
        if (!UIManagerControl.Instance.IsOpen("TownUI") && !this.mIsForecUpdate)
        {
            if (this.mDownloadingAcId > 0)
            {
                Downloader.Instance.OnPauseClick();
                this.mDownloadingAcId = -1;
                Debug.Log("===[暂停下载]===");
            }
        }
        else if (!this.IsWifi && this.mDownloadingAcId > 0 && !this.mUsing4GDownload)
        {
            Downloader.Instance.OnPauseClick();
            this.mDownloadingAcId = -1;
            Debug.Log("===[暂停下载]===");
        }
        else if (!this.mIsForecUpdate && this.IsWifi && this.mDownloadingAcId == -1)
        {
            using (List <UpdateAcInfo> .Enumerator enumerator = this.mLocalUpdateGiftInfos.GetEnumerator())
            {
                UpdateAcInfo info;
                while (enumerator.MoveNext())
                {
                    info = enumerator.get_Current();
                    if (info.status == UpdateAcInfo.AcStep.STEP.Ready)
                    {
                        GengXinYouLi gengXinYouLi = DataReader <GengXinYouLi> .Get(info.acId);

                        if (gengXinYouLi != null && gengXinYouLi.FinishPar > this.mDownloadVersion)
                        {
                            this.StartDownloadPackageById(info.acId, false);
                            UpdateAcInfo updateAcInfo = this.mLocalUpdateGiftInfos.Find((UpdateAcInfo e) => e.acId == info.acId);
                            if (updateAcInfo != null)
                            {
                                updateAcInfo.status = UpdateAcInfo.AcStep.STEP.Start;
                            }
                            Debug.Log("===[开始下载]===");
                            return;
                        }
                    }
                }
            }
            this.RemoveCheckIsWifi();
        }
    }
    public void UpdateItem(GengXinYouLi data)
    {
        if (!this.m_bInited)
        {
            base.AwakeBase(BindingContext.BindingContextMode.MonoBinding, false);
        }
        this.Data = data;
        if (this.Data == null || this.Data.ItemId.get_Count() != this.Data.ItemNum.get_Count())
        {
            Debug.Log("<color=red>Error:</color>[有礼更新]GengXinYouLi配置数据异常");
            return;
        }
        this.mLastPack = DataReader <ResourceSplit> .Get(this.Data.FinishPar - 1);

        if (this.mLastPack == null)
        {
            Debug.Log("<color=red>Error:</color>[有礼更新]ResourceSplit配置数据异常");
            return;
        }
        this.Pack = DataReader <ResourceSplit> .Get(this.Data.FinishPar);

        if (this.Pack == null)
        {
            Debug.Log("<color=red>Error:</color>[有礼更新]ResourceSplit配置数据异常");
            return;
        }
        UIHelper.GetText(base.get_transform(), "txTitle").set_text(string.Format(GameDataUtils.GetChineseContent(513143, false), OperateActivityManager.Instance.SwitchChineseNumber(this.mLastPack.ID)));
        UIHelper.GetText(base.get_transform(), "txMaxLv").set_text(string.Format(GameDataUtils.GetChineseContent(513144, false), this.mLastPack.LvLimit));
        using (List <UpdateAcInfo> .Enumerator enumerator = OperateActivityManager.Instance.LocalUpdateGiftInfos.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                UpdateAcInfo current = enumerator.get_Current();
                if (current.acId == this.Data.Id)
                {
                    this.IsOnlyLocalDownload = (current.status != UpdateAcInfo.AcStep.STEP.Ready && this.Data.FinishPar > OperateActivityManager.Instance.CurrentVersion);
                    break;
                }
            }
        }
        this.Status = UpdateAcInfo.AcStep.STEP.Ready;
        this.Size   = this.Pack.SizeMbit;
    }