private bool MissionPercentProcess()
        {
            if (dataManager.missionPercent >= 1)
            {
                int expIncrease  = GetMissionCompleteExp();
                int coinIncrease = GetMissionCompleteCoin();
                this.FundDataManager.AddCoin(this.FundDataManager.GetCoinId(), coinIncrease);
                uiState.PushNewState(UIStateEnum.eRolePlayAction, "level_end");
                FlurryUtil.LogEvent("Mission_Finish_Petani_View");

                uiState.PushNewState(UIStateEnum.eMissionComplete, dataManager.missionId, expIncrease, true, coinIncrease);

                dataManager.exp += expIncrease;
                uiState.PushNewState(UIStateEnum.eExpIncrease, GetExpPercent());

                RefreshLevelAfterExpChange();

                missionDataManager.AddMissionState(dataManager.missionId, MissionState.eComplete);
                if (dataManager.IsMissionLimit())
                {
                    uiState.PushNewState(UIStateEnum.eMissionUpperLimitNotify);
                }
                else
                {
                    bool missionRetry = false;
                    dataManager.missionPercent = 0;
                    int sceneIndex    = missionConfig.GetSceneIndexByMissionID(dataManager.missionId);
                    int nextMissionId = missionConfig.GetNextMissionId(dataManager.missionId, true);
                    if (nextMissionId == -1)
                    {//如果已经到达此星球的最后一个关卡,则检查此星球是否为副本星球
                        WorldInfo worldInfo = this.missionConfig.GetWorldByStarID(this.dataManager.StarID);
                        if (worldInfo != null && worldInfo.Type == WorldInfo.WorldTypes.Duplicate)
                        {//副本星球的关卡是可以循环玩的,所以到达最后一个关卡后,再返回第一个关卡
                            missionRetry  = true;
                            nextMissionId = this.missionConfig.GetFirstMissionOfScene(this.dataManager.StarID, sceneIndex);
                            if (nextMissionId != -1)
                            {
                                this.missionDataManager.ClearAllMissionOfScene(this.dataManager.StarID, sceneIndex);//清除此星球当前地图的所有关卡记录
                            }
                        }
                    }

                    if (nextMissionId != -1)
                    {
                        FlurryUtil.LogEventWithParam("Mission_Finish_Event", "MissionID", dataManager.missionId.ToString());
                        missionDataManager.AddMissionState(nextMissionId, MissionState.eUnderway);
                        dataManager.missionId = nextMissionId;//这里要先把nextMissionId的eUnderWay状态记录下来,再改变dataManager的missionId,否则(eLock状态)写不进去
                        uiState.PushNewState(UIStateEnum.eNewMissionSwitch, dataManager.missionId);
                        uiState.PushNewState(UIStateEnum.eRolePlayAction, "level_start", 0, false);
                        if (missionRetry)
                        {
                            uiState.PushNewState(UIStateEnum.eMissionRetry, nextMissionId);
                        }
                    }
                }
                dataManager.TrySendPlayerData2Server();
                return(true);
            }
            return(false);
        }
        //轮询所有已购买的配饰
        private void GetPaidItems()
        {
            if (this.qrCodeView.IsOpen)
            {
                return;
            }
#if !UNITY_EDITOR && UNITY_ANDROID
            this.PetAccessoryUtils.GetPaidItems((getPaidItemsResponse) =>
            {
                if (getPaidItemsResponse != null)
                {
                    this.accessories.SetPaid(getPaidItemsResponse.acc_list.ToList(), (accessory) =>
                    {
                        if (accessory != null)
                        {
                            Debug.LogFormat("<><PetDressView.GetPaidItems>Got a new accessory: {0}_{1}", accessory.ID, accessory.Name);
                            this.PlayerDataManager.exp += accessory.Exp;
                            this.UIState.PushNewState(UIStateEnum.eExpIncrease, this.PlayerDataManager.GetExpPercent());
                            this.UpdateExpAndCoinSignal.Dispatch();
                            FlurryUtil.LogEventWithParam("mall_scene_purchase_rmb", "accessory_name", accessory.Name);
                        }
                    });
                }
            },
                                                (errorText) =>
            {
                Debug.LogErrorFormat("<><PetDressView.GetPaidItems>Error: {0}", errorText);
            });
#endif
        }
 //当二维码页面关闭时
 private void OnQRCodeiewClosed(ViewResult viewResult)
 {
     if (viewResult == ViewResult.OK)
     {
         this.accessories.CurrentButton.Paid = true;
         this.AccessoryDataManager.AddItem(this.accessories.CurrentButton.Accessory.ID);//配饰添加到包裹
         SoundPlayer.GetInstance().StopAllSoundExceptMusic();
         SoundPlayer.GetInstance().PlaySoundInChannal("mall_purchase_qr_complete", this.audioPlayer, 0.2f);
         this.PutOn(this.accessories.CurrentButton.Accessory);
         ExpUI.Instance.Show(this.accessories.CurrentButton.Accessory.Exp, 0, -25, 25, GameObject.FindGameObjectWithTag("ExpUILayer").transform);
         this.PlayerDataManager.exp += this.accessories.CurrentButton.Accessory.Exp;
         this.UIState.PushNewState(UIStateEnum.eExpIncrease, this.PlayerDataManager.GetExpPercent());
         this.UpdateExpAndCoinSignal.Dispatch();
         FlurryUtil.LogEventWithParam("mall_scene_purchase_rmb", "accessory_name", this.accessories.CurrentButton.Accessory.Name);
     }
 }
        //点击确认
        public void Confirm()
        {
            if (this.accessoryTypes.BackButtonSelected)
            {//退出换装页
                this.CloseViewSignal.Dispatch(true);
            }
            else if (!this.accessories.HasItems)
            {//如果当前商店中无配饰
                return;
            }
            else if (!this.accessories.CurrentButton.Accessory.Suitable(this.PlayerDataManager.CurrentPet) && !this.suitLockView.IsOpen)
            {//显示配饰不适用提示页面
                this.audioPlayer.Stop();
                this.suitLockView.Open(this.accessories.CurrentButton.Accessory);
                FlurryUtil.LogEventWithParam("mall_scene_lock_suitable", "accessory_name", this.accessories.CurrentButton.Accessory.Name);
            }
            else if (this.suitLockView.IsOpen)
            {//关闭配饰不适用提示页面
                this.suitLockView.Close();
            }
            else if (this.accessories.CurrentButton.Paid && !this.accessories.CurrentButton.Worn)
            {//已拥有:穿上当前配饰
                this.PutOn(this.accessories.CurrentButton.Accessory);
                this.PlaySound("mall_put_on_accessory");
                FlurryUtil.LogEventWithParam("mall_scene_change", "accessory_name", this.accessories.CurrentButton.Accessory.Name);
            }
            else if (this.accessories.CurrentButton.Paid && this.accessories.CurrentButton.Worn)
            {//已拥有:脱掉当前配饰
                this.TakeOff(this.accessories.CurrentButton.Accessory);
                this.PlaySound(this.accessories.CurrentButton.Accessory.CanWear ? "mall_take_off_accessory" : "mall_spirit_out");
            }
            else if (this.accessories.CurrentButton.Accessory.Level > this.PlayerDataManager.playerLevel && !this.levelLockView.IsOpen)
            {//显示等级不够提示页面
                this.audioPlayer.Stop();
                this.levelLockView.Open(this.accessories.CurrentButton.Accessory);
                FlurryUtil.LogEventWithParam("mall_scene_lock_level", "accessory_name", this.accessories.CurrentButton.Accessory.Name);
            }
            else if (this.levelLockView.IsOpen)
            {//关闭等级不够提示页面
                this.levelLockView.Close();
            }
            else if (!this.accessories.CurrentButton.Accessory.Opened && !this.openLockView.IsOpen)
            {//显示未开放提示页面
                this.audioPlayer.Stop();
                this.openLockView.Open(this.accessories.CurrentButton.Accessory);
            }
            else if (this.openLockView.IsOpen)
            {//关闭未开放提示页面
                this.openLockView.Close();
            }
            else if (this.goalLockView.IsOpen)
            {//关闭饮水目标未达标提示页面
                this.goalLockView.Close();
            }
            else if (this.coinLockView.IsOpen)
            {//关闭金币不足提示页面
                this.coinLockView.Close();
            }
            else if (this.wifiLockView.IsOpen)
            {//关闭无网络连接提示页面
                this.wifiLockView.Close();
            }
            else if (this.qrCodeView.IsOpen)
            {//关闭二维码页面
                this.qrCodeView.Close();
            }
            else if (!this.accessories.CurrentButton.Paid && this.accessories.CurrentButton.Accessory.Coin)
            {//金币购买的配饰:钱够→扣钱→配饰进包裹→记录穿戴数据→配饰图标状态更新
                if (this.FundDataManager.GetItemCount(this.FundDataManager.GetCoinId()) >= this.accessories.CurrentButton.Accessory.Price)
                {
                    this.accessories.CurrentButton.Paid = true;
                    this.AccessoryDataManager.AddItem(this.accessories.CurrentButton.Accessory.ID);                                         //配饰添加到包裹
                    this.FundDataManager.ExpendCoin(this.FundDataManager.GetCoinId(), (int)this.accessories.CurrentButton.Accessory.Price); //扣钱
                    SoundPlayer.GetInstance().StopAllSoundExceptMusic();
                    SoundPlayer.GetInstance().PlaySoundInChannal("mall_purchase_qr_complete", this.audioPlayer, 0.2f);
                    this.PutOn(this.accessories.CurrentButton.Accessory);
                    ExpUI.Instance.Show(this.accessories.CurrentButton.Accessory.Exp, 0, -25, 25, GameObject.FindGameObjectWithTag("ExpUILayer").transform);
                    this.PlayerDataManager.exp += this.accessories.CurrentButton.Accessory.Exp;
                    this.UIState.PushNewState(UIStateEnum.eExpIncrease, this.PlayerDataManager.GetExpPercent());
                    this.UpdateExpAndCoinSignal.Dispatch();
                    FlurryUtil.LogEventWithParam("mall_scene_purchase", "accessory_name", this.accessories.CurrentButton.Accessory.Name);
                }
                else if (!this.coinLockView.IsOpen)
                {//显示金币不足提示页面
                    this.audioPlayer.Stop();
                    this.coinLockView.Open();
                }
            }
            else if (!this.accessories.CurrentButton.Paid && this.accessories.CurrentButton.Accessory.Cash && !this.qrCodeView.IsOpen)
            {     //货币购买的配饰:向服务器发送请求,获取二维码并打开页面显示
                if (this.PlayerDataManager.currIntake < this.PlayerDataManager.GetDailyGoal() && !this.goalLockView.IsOpen)
                { //显示饮水目标未达标提示页面
                    this.audioPlayer.Stop();
                    this.goalLockView.Open(this.accessories.CurrentButton.Accessory);
                    FlurryUtil.LogEventWithParam("mall_scene_lock_goal", "accessory_name", this.accessories.CurrentButton.Accessory.Name);
                }
#if !UNITY_EDITOR && UNITY_ANDROID
                else if (!NativeWifiManager.Instance.IsConnected() && !this.wifiLockView.IsOpen)
                {//显示无网络连接提示页面
                    this.audioPlayer.Stop();
                    this.wifiLockView.Open();
                }
#else
                else if (!this.wifiLockView.IsOpen)
                {//显示无网络连接提示页面
                    this.audioPlayer.Stop();
                    this.wifiLockView.Open();
                }
#endif
                else
                {
#if !UNITY_EDITOR && UNITY_ANDROID
                    this.IsBuying = true;
                    PetAccessoryOrder order = new PetAccessoryOrder()
                    {
                        items = new List <PetAccessory>()
                        {
                            new PetAccessory()
                            {
                                sn = this.accessories.CurrentButton.Accessory.ID.ToString(), count = 1
                            }
                        },
                        remark = string.Format("CupSn:{0}, ChildSn:{1}", CupBuild.getCupSn(), this.LocalChildInfoAgent.getChildSN())
                    };

                    this.PetAccessoryUtils.BuyPetAccessories(order, (result) =>
                    {
                        this.IsBuying             = false;
                        OrderReceipt orderReceipt = this.JsonUtils.String2Json <OrderReceipt>(result.info);
                        if (orderReceipt != null && !string.IsNullOrEmpty(orderReceipt.status) && orderReceipt.status.ToUpper() == "OK")
                        {
                            this.audioPlayer.Stop();
                            this.qrCodeView.Open(orderReceipt);
                            FlurryUtil.LogEventWithParam("mall_scene_qr", "accessory_name", this.accessories.CurrentButton.Accessory.Name);
                        }
                        else
                        {
                            Debug.LogError("<><PetPageView.Confirm>orderReceipt is null");
                        }
                    },
                                                             (error) =>
                    {
                        this.IsBuying = false;
                        Debug.LogErrorFormat("<><PetPageView.Confirm>BuyPetAccessories, error: {0}", error.info);
                    });
#else
                    this.audioPlayer.Stop();
                    this.qrCodeView.Open(null);
#endif
                }
            }
        }