示例#1
0
    public static YHGotRewardView CreateGotRewardView()
    {
        Object obj = Resources.Load("pbYHGotRewardView");

        GameObject go = Instantiate(obj) as GameObject;

        YHGotRewardView drv = go.GetComponent <YHGotRewardView>();

        return(drv);
    }
示例#2
0
    void OnBtnRelease()
    {
        if (mSkillNum > 0)
        {
            if (_dataPlayer.defenseTime > 0 && mSkillID == WGDefine.SK_FangYu4)
            {
                return;
            }
            if (bCanRelease)
            {
                beginTime   = Time.realtimeSinceStartup;
                bCanRelease = false;
                spIconEffect.ESetActive(true);
                spIconEffect.fillAmount = 1;

                if (myReleaseSkill != null)
                {
#if Umeng
                    Umeng.GA.Use(mSkillID.ToString(), 1, 10);
#endif
                                        #if TalkingData
                    MDSkill sk = WGDataController.Instance.getSkill(mSkillID);
                    TDGAItem.OnUse(sk.name, 1);
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("name", sk.name);
                    TalkingDataGA.OnEvent("使用道具", dic);
                                        #endif
                    myReleaseSkill(mSkillID);
                }
                mSkillNum--;
                labNum.text = mSkillNum.ToString();
                if (mSkillNum > 0)
                {
                    labNum.color = Color.white;
                }
                else
                {
                    labNum.color = Color.red;
                }

                DataPlayerController.getInstance().setSkillNum(mSkillID, mSkillNum);
            }
        }
        else
        {
            if (!WGAlertManager.Self.bBuySKill)
            {
                WGAlertManager.Self.bBuySKill = true;
                WGAlertManager.Self.AddAction(() => {
                    YHMDPayData payData = WGDataController.Instance.getYHMDPay(YHPayType.ITEM);
                    float costMenoy     = payData.payCost;
                    string payKey       = payData.payKey.ToString();
//					float costMenoy = 30;
//					string payKey = "106";
//					if(YeHuoSDK.bUsePayCode2)
//					{
//						costMenoy = 20;
//						payKey = "206";
//					}
                    YHGotRewardView rdview = YHGotRewardView.CreateGotRewardView();
                    rdview.mRType          = YHRewardType.Item;
                    SDK.AddChild(rdview.gameObject, WGRootManager.Self.goRootTopUI);
                    rdview.FreshRewardCell(_dataCtrl.mAllReward.item);
                                        #if YES_OK
                    string content = WGStrings.getFormateInt(1081, 1002, 1088, costMenoy.ToString());
                                        #elif YES_BUY
                    string content = WGStrings.getFormateInt(1081, 1094, 1088, costMenoy.ToString());
#elif YES_GET
                    string content = WGStrings.getFormateInt(1081, 1077, 1088, 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(WGStrings.getText(1088), content, true);
                    rdview.alertViewBehavriour = (ab, view) => {
                        switch (ab)
                        {
                        case MDAlertBehaviour.CLICK_OK:
                            YeHuoSDK.YHPay(payKey, costMenoy, 0, (succecc) => {
                                view.hiddenView();
                                if (succecc)
                                {
                                    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.bBuySKill = false;
                            WGAlertManager.Self.RemoveHead();
                            WGAlertManager.Self.ShowNext();
                            Time.timeScale = 1;

                            break;
                        }
                    };
                    Time.timeScale = 0;
                    rdview.showView();
                    BCSoundPlayer.Play(MusicEnum.showReward, 1f);
                });

                WGAlertManager.Self.ShowNext();
            }
        }
    }
示例#3
0
    void showReward(MDTiger tiger)
    {
        YHMDPayData payData   = WGDataController.Instance.getYHMDPay(YHPayType.DOUBLE_reward);
        float       costMenoy = payData.payCost;
        string      payKey    = payData.payKey.ToString();
//		float costMenoy = 30f;
//		string payKey = "114";
//		if(YeHuoSDK.bUsePayCode2)
//		{
//			costMenoy = 20f;
//			payKey = "214";
//		}
        YHGotRewardView rdview = YHGotRewardView.CreateGotRewardView();

        rdview.mRType        = YHRewardType.SuperTiger;
        rdview.bDoubleReward = true;

        SDK.AddChild(rdview.gameObject, WGRootManager.Self.goRootTopUI);

        rdview.FreshRewardCell(tiger.reward);
                #if YES_OK
        string content = WGStrings.getFormateInt(1081, 1104, "", costMenoy.ToString());
                #elif YES_BUY
        string content = WGStrings.getFormateInt(1081, 1104, "", costMenoy.ToString());
#elif YES_GET
        string content = WGStrings.getFormateInt(1081, 1101, "", costMenoy.ToString());
#elif YES_QueRen
        string content = WGStrings.getFormateInt(1081, 1104, "", costMenoy.ToString());
                #else
        string content = WGStrings.getFormateInt(1081, 1101, "", costMenoy.ToString());
                #endif
        rdview.FreshWithMsg(WGStrings.getText(1100), content, false, false);
        rdview.alertViewBehavriour = (ab, view) => {
            switch (ab)
            {
            case MDAlertBehaviour.CLICK_OK:
                if (view.clickIndex == MDBaseAlertView.CLICK_OK1)
                {
                    view.hiddenView();
                    rdview.GetAllReward(false);
                    WGGameUIView.Instance.freshSkillNum();
                    WGGameUIView.Instance.freshPlayerUI(UI_FRESH.BCOIN | UI_FRESH.COIN);
                }
                else if (view.clickIndex == MDBaseAlertView.CLICK_OK2)
                {
                    YeHuoSDK.YHPay(payKey, costMenoy, 0, (success) => {
                        view.hiddenView();
                        if (success)
                        {
                            rdview.GetAllReward(true);
                            WGGameUIView.Instance.freshSkillNum();
                            WGGameUIView.Instance.freshPlayerUI(UI_FRESH.BCOIN | UI_FRESH.COIN);
                        }
                    });
                }
                break;

            case MDAlertBehaviour.DID_HIDDEN:
                mTiger.ESetActive(true);
                Destroy(view.gameObject);

                break;
            }
        };

        rdview.showView();
        BCSoundPlayer.Play(MusicEnum.showReward, 1f);
    }
示例#4
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();
        }
    }