Exemplo n.º 1
0
    void showBuyPowerView()
    {
        WGDataController _dataCtrl = WGDataController.Instance;
        YHMDPayData      payData   = _dataCtrl.getYHMDPay(YHPayType.POWER);
        float            costMenoy = payData.payCost;
        string           payKey    = payData.payKey.ToString();
//		string paykey = "112";
//		float costMenoy = 30f;
//		if(YeHuoSDK.bUsePayCode2)
//		{
//			paykey = "212";
//			costMenoy = 20f;
//		}

        string okString = "ok";

                #if YES_OK
        string content = WGStrings.getFormateInt(1081, 1002, 8209, costMenoy.ToString());
        okString = WGStrings.getText(1002);
                #elif YES_BUY
        string content = WGStrings.getFormateInt(1081, 1094, 8209, costMenoy.ToString());
        okString = WGStrings.getText(1094);
#elif YES_GET
        string content = WGStrings.getFormateInt(1081, 1077, 8209, costMenoy.ToString());
        okString = WGStrings.getText(1077);
                #elif YES_QueRen
        string content = WGStrings.getFormateInt(1081, 1106, payData.showText, costMenoy.ToString());
        okString = WGStrings.getText(1106);
                #else
        string content = WGStrings.getFormateInt(1081, 1077, payData.showText, costMenoy.ToString());
        okString = WGStrings.getText(1077);
                #endif

        D04PowerBuyView bv = D04PowerBuyView.CreatePowerBuyView();
        bv.FreshUI(content, okString);
        bv.alertViewBehavriour = (ab, view) => {
            switch (ab)
            {
            case MDAlertBehaviour.CLICK_OK:
                YeHuoSDK.YHPay(payKey, costMenoy, 0, (success) => {
                    view.hiddenView();
                    if (success)
                    {
                        _dataPlayer.a1 = 1;
                        _bShowPowerTip = false;
                    }
                });
                break;

            case MDAlertBehaviour.CLICK_CANCEL:
                _dataPlayer.mEnergy -= _EnergyFull;
                view.hiddenView();
                break;

            case MDAlertBehaviour.DID_HIDDEN:
                Destroy(view.gameObject);
                _bShowPowerTip = false;
                Time.timeScale = 1;
                break;
            }
        };
        bv.showView();
    }
Exemplo n.º 2
0
    void OnBtnChaoZhi()
    {
        if (!_DataPlayer.szBigReward.Contains(4))
        {
            WGAlertManager.Self.AddAction(() => {
                WGDataController _dataCtrl = WGDataController.Instance;
                YHMDPayData payData        = _dataCtrl.getYHMDPay(YHPayType.CHEAP);
                float costMenoy            = payData.payCost;
                string payKey = payData.payKey.ToString();
//#if Unicom
//				float costMenoy = 1f;
//#else
//				float costMenoy = 0.1f;
//#endif

//				string payKey = "104";
//				if(YeHuoSDK.bUsePayCode2)
//				{
//					payKey = "204";
//				}

                YHGotRewardView rdview = YHGotRewardView.CreateGotRewardView();
                rdview.mRType          = YHRewardType.Cheap;
                SDK.AddChild(rdview.gameObject, WGRootManager.Self.goRootTopUI);

                rdview.FreshRewardCell(_dataCtrl.mAllReward.cheap);
#if YES_OK
                string content = WGStrings.getFormateInt(1081, 1002, 1086, costMenoy.ToString());
#elif YES_BUY
                string content = WGStrings.getFormateInt(1081, 1094, 1086, costMenoy.ToString());
#elif YES_GET
                string content = WGStrings.getFormateInt(1081, 1077, 1086, costMenoy.ToString());
#elif YES_QueRen
                string content = WGStrings.getFormateInt(1081, 1106, payData.showText, costMenoy.ToString());
#else
                string content = WGStrings.getFormateInt(1081, 1077, payData.showText, costMenoy.ToString());
#endif
                rdview.FreshWithMsg(payData.showText, content, true, true);
                rdview.alertViewBehavriour = (ab, view) => {
                    switch (ab)
                    {
                    case MDAlertBehaviour.CLICK_OK:
                        {
                            YeHuoSDK.YHPay(payKey, costMenoy, 0, (success) => {
                                view.hiddenView();
                                if (success)
                                {
                                    btnChaoZhi.ESetActive(false);

                                    _DataPlayer.szBigReward.Add(4);

                                    rdview.GetAllReward();
                                    WGGameUIView.Instance.freshSkillNum();
                                    WGGameUIView.Instance.freshPlayerUI(UI_FRESH.BCOIN | UI_FRESH.COIN);
                                }
                            });
                        }
                        break;

                    case MDAlertBehaviour.CLICK_CANCEL:
                        view.hiddenView();
                        break;

                    case MDAlertBehaviour.DID_HIDDEN:

                        Destroy(view.gameObject);
                        WGAlertManager.Self.RemoveHead();
                        WGAlertManager.Self.ShowNext();
                        break;
                    }
                };
                rdview.showView();
                BCSoundPlayer.Play(MusicEnum.showReward, 1f);
            });

            WGAlertManager.Self.ShowNext();
        }
    }