Esempio n. 1
0
    public async UniTask EndDialog()
    {//触发支付
        SetSelfPayState();
        Root2dSceneManager._instance.manorUnLockDialogComponent.FinishDialog();
        //Root2dSceneManager._instance.worldCameraComponent.PlayCameraToUnLockRegionOld();
        await UniTask.Delay(1000);

        //UIComponent.CreateUI(UIType.UIManor);
        UIComponent.RemoveUI(UIType.UICommonPopupTips);

        CSUnlockArea csUnlockArea = new CSUnlockArea()
        {
            AreaId = regionId,
            State  = AreaState.Conversation//上一阶段对话状态
        };

        ManorProtocalHelper.UnlockRegion(csUnlockArea, (regionUnLockDialogEndSucc) =>
        {
            StaticData.DebugGreen($"对话结束返回状态:{regionUnLockDialogEndSucc.State.ToString()}");
            //对话状态开始
            if (regionUnLockDialogEndSucc.State == AreaState.Pay)
            {
                BeginPayUI();
            }
        });
    }
Esempio n. 2
0
    private void ClickWorkShed()
    {
        CSUnlockArea csUnlockArea = new CSUnlockArea()
        {
            AreaId = regionId,
            State  = AreaState.WorkShed
        };

        ManorProtocalHelper.UnlockRegion(csUnlockArea, (regionUnLockDialogEndSucc) =>
        {
            //播放音效点击
            GameSoundPlayer.Instance.PlaySoundEffect(MusicHelper.SoundEffectAreaUnlockedSuccessfully);
            SetDataDotRegionUnLockSucc();
            ////工棚新手引导完成
            //if (StaticData.isOpenGuide && GuideCanvasComponent._instance != null && GuideCanvasComponent._instance.isCurrStepGuiding)
            //{
            //    GuideCanvasComponent._instance.SetLittleStepFinish();
            //}
            //展示动画,临时替代
            List <CSWareHouseStruct> awardIds = new List <CSWareHouseStruct>();
            for (int i = 0; i < regionUnLockDialogEndSucc.GoodsInfo.Count; i++)
            {
                var wareHouseStruct = StaticData.SCBuyGoodsStructToCSWareHouseStruct(regionUnLockDialogEndSucc.GoodsInfo[i]);
                awardIds.Add(wareHouseStruct);
            }
            var goReward = UIComponent.CreateUI(UIType.UIManorUnlockReward);
            goReward.GetComponent <UIManorUnlockRewardComponent>().SetRewards(this, awardIds, regionUnLockDialogEndSucc);
        });
    }
Esempio n. 3
0
 //解锁大区域
 public static void UnlockRegion(CSUnlockArea csUnlockArea, Action <SCUnlockArea> ResponseSCUnlockAreaCallBack)
 {
     if (StaticData.IsUsedLocalDataNotServer)
     {
         //测试
         SCUnlockArea scUnlockArea = new SCUnlockArea();
         ResponseSCUnlockAreaCallBack(scUnlockArea);
     }
     else
     {
         ProtocalManager.Instance().SendCSUnlockArea(csUnlockArea, ResponseSCUnlockAreaCallBack, (error) => { }, false);
     }
 }
Esempio n. 4
0
    public void BeginPay()
    {
        //道具判定
        var       dealClass = StaticData.configExcel.GetAreaUnlockByID(regionId).ConsumptionGood;
        bool      isEnough  = true;
        DealClass willCost  = null;

        for (int i = 0; i < dealClass.Count; i++)
        {
            willCost = dealClass[i];
            int currHaveCount = StaticData.GetWareHouseItem(willCost.IdGameItem).GoodNum;
            if (currHaveCount < willCost.Price)
            {
                isEnough = false;
                break;
            }
        }
        if (isEnough == false)
        {
            string CoinNameNotEnough = StaticData.configExcel.GetLocalizeByID(willCost.IdGameItem).SimplifiedChinese;
            string Tips = string.Format(StaticData.GetMultilingual(120068), CoinNameNotEnough);
            StaticData.OpenCommonTips(Tips, 120010, async() =>
            {
                UIComponent.RemoveUI(UIType.UIManorRegionPay);
                if (willCost.IdGameItem == 1000001)//表示钻石
                {
                    //跳转充值
                    await StaticData.OpenRechargeUI(1, BeginPayUI);
                }
                else if (willCost.IdGameItem == 1000002)//表示金币
                {
                    //跳转充值
                    await StaticData.OpenRechargeUI(0, BeginPayUI);
                }
                else
                {
                    //跳转商城
                    await StaticData.OpenShopUI(1, BeginPayUI);
                }
            });
            return;
        }
        CSUnlockArea csUnlockArea = new CSUnlockArea()
        {
            AreaId = regionId,
            State  = AreaState.Pay//上一阶段对话状态
        };

        ManorProtocalHelper.UnlockRegion(csUnlockArea, (regionUnLockPaySucc) =>
        {
            StaticData.DebugGreen($"对话结束返回状态:{regionUnLockPaySucc.State.ToString()}");
            //对话状态开始
            if (regionUnLockPaySucc.State == AreaState.RoadWork)
            {
                //关闭UI
                UIComponent.RemoveUI(UIType.UIManorRegionPay);
                //更新道具
                StaticData.UpdateWareHouseItem(willCost.IdGameItem, -willCost.Price);
                SetSelfRoadWorkState(regionUnLockPaySucc.RoadworkTime);
            }
        });
    }
Esempio n. 5
0
        public void SendCSUnlockArea(CSUnlockArea csunlockarea, Action <SCUnlockArea> ResponseSCUnlockAreaCallBack, Action <ErrorInfo> errorCallBack, bool isShowDefaultTip = true)
        {
            OpCodeType opCodeType = ListOPRelation.GetOpCodeTypeByRequest <CSUnlockArea> ();

            ProtoSendMethod.BusinessRequest <SCUnlockArea>(csunlockarea, opCodeType, ResponseSCUnlockAreaCallBack, errorCallBack, isShowDefaultTip);
        }