Exemple #1
0
 /// <summary>
 /// 用于游戏内虚拟道具的购买
 /// </summary>
 /// <param name="itemName">道具ID或者名称</param>
 /// <param name="itemNumber">数量</param>
 /// <param name="priceInVirtualCurrency">道具的价格</param>
 public void OnPurchase(string itemName, int itemNumber, int priceInVirtualCurrency)
 {
     if (!isRuntime)
     {
         return;
     }
     TDGAItem.OnPurchase(itemName, itemNumber, priceInVirtualCurrency);
 }
Exemple #2
0
 /// <summary>
 /// 游戏内使用道具
 /// </summary>
 /// <param name="itemName"></param>
 /// <param name="itemNumber"></param>
 public void OnUse(string itemName, int itemNumber)
 {
     if (!isRuntime)
     {
         return;
     }
     TDGAItem.OnUse(itemName, itemNumber);
 }
 public static void OnUse(string item, int itemNumber)
 {
     if (Application.platform != RuntimePlatform.OSXEditor && Application.platform != RuntimePlatform.WindowsEditor)
     {
         TDGAItem.GetAgent().CallStatic("onUse", new object[]
         {
             item,
             itemNumber
         });
     }
 }
 public static void OnPurchase(string item, int itemNumber, double priceInVirtualCurrency)
 {
     if (Application.platform != RuntimePlatform.OSXEditor && Application.platform != RuntimePlatform.WindowsEditor)
     {
         TDGAItem.GetAgent().CallStatic("onPurchase", new object[]
         {
             item,
             itemNumber,
             priceInVirtualCurrency
         });
     }
 }
Exemple #5
0
 /// <summary>
 /// 增加游戏中货币,豆子
 /// </summary>
 /// <param name="num"></param>
 public void AddRoomCard(int num)
 {
     if (num > 0) //增加房卡
     {
         GA.Buy(GlobalData.mHostFkId, num, 1);
     }
     else if (num < 0)                          //消耗房卡
     {
         GA.Use(GlobalData.mHostFkId, -num, 1); // 友盟
         TDGAItem.OnPurchase(GlobalData.mHostFkId, -num, 1);
     }
     mPlayerData.roomCardNum += num;
     RefreshPlayerInfoData();
 }
Exemple #6
0
    void OnGUI()
    {
        int i = 0;

        GUI.Box(new Rect(10, 10, Screen.width - 20, Screen.height - 20), "Demo Menu");

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Create User"))
        {
            account = TDGAAccount.SetAccount("User" + index);
            index++;
        }

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Account Level +1"))
        {
            if (account != null)
            {
                account.SetLevel(level++);
            }
        }

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Chagen Game Server + 'a'"))
        {
            if (account != null)
            {
                gameserver += "a";
                account.SetGameServer(gameserver);
            }
        }

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Charge Request 10"))
        {
            TDGAVirtualCurrency.OnChargeRequest("order01", "iap", 10, "CH", 10, "PT");
        }

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Charge Success 10"))
        {
            TDGAVirtualCurrency.OnChargeSuccess("order01");
        }

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Reward 100"))
        {
            TDGAVirtualCurrency.OnReward(100, "reason");
        }

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Mission Begin"))
        {
            TDGAMission.OnBegin("miss001");
        }

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Mission Completed"))
        {
            TDGAMission.OnCompleted("miss001");
        }

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Item Purchase 10"))
        {
            TDGAItem.OnPurchase("itemid001", 10, 10);
        }

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Item Use 1"))
        {
            TDGAItem.OnUse("itemid001", 1);
        }

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Custome Event"))
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();
            dic.Add("StartApp" + "StartAppTime", "startAppMac" + "#" + "02/01/2013 09:52:24");
            dic.Add("IntValue", 1);
            TalkingDataGA.OnEvent("action_id", dic);
        }
    }
Exemple #7
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();
            }
        }
    }
Exemple #8
0
 public void TDGAItemOnUse(int itemId, int itemNumber, BaseResType baseResType)
 {
     TDGAItem.OnUse(GenerateItemId(itemId, baseResType), itemNumber);
 }
Exemple #9
0
 public void TDGAItemOnPurchaseByCount(string functionName, int count, double priceInVirtualCurrency)
 {
     TDGAItem.OnPurchase(functionName, count, priceInVirtualCurrency);
 }
Exemple #10
0
 public void TDGAItemOnPurchase(string functionName, BaseResType baseResType, int itemId, int itemNumber, double priceInVirtualCurrency)
 {
     TDGAItem.OnPurchase(functionName + ":" + GenerateItemId(itemId, baseResType), itemNumber, priceInVirtualCurrency);
 }
    private void OnGUI()
    {
        int num = 0;

        GUI.Box(new Rect(10f, 10f, (float)(Screen.width - 20), (float)(Screen.height - 20)), "Demo Menu");
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Create User"))
        {
            this.account = TDGAAccount.SetAccount("User" + this.index);
            this.index++;
        }
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Account Level +1") && this.account != null)
        {
            this.account.SetLevel(this.level++);
        }
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Chagen Game Server + 'a'") && this.account != null)
        {
            this.gameserver += "a";
            this.account.SetGameServer(this.gameserver);
        }
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Charge Request 10"))
        {
            TDGAVirtualCurrency.OnChargeRequest("order01", "iap", 10.0, "CH", 10.0, "PT");
        }
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Charge Success 10"))
        {
            TDGAVirtualCurrency.OnChargeSuccess("order01");
        }
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Reward 100"))
        {
            TDGAVirtualCurrency.OnReward(100.0, "reason");
        }
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Mission Begin"))
        {
            TDGAMission.OnBegin("miss001");
        }
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Mission Completed"))
        {
            TDGAMission.OnCompleted("miss001");
        }
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Item Purchase 10"))
        {
            TDGAItem.OnPurchase("itemid001", 10, 10.0);
        }
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Item Use 1"))
        {
            TDGAItem.OnUse("itemid001", 1);
        }
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Custome Event"))
        {
            TalkingDataGA.OnEvent("action_id", new Dictionary <string, object>
            {
                {
                    "StartAppStartAppTime",
                    "startAppMac#02/01/2013 09:52:24"
                },
                {
                    "IntValue",
                    1
                }
            });
        }
    }
Exemple #12
0
 /// <summary>
 /// 物品使用
 /// </summary>
 /// <param name="item"></param>
 /// <param name="itemNumber"></param>
 public void OnUse(string item, int itemNumber)
 {
     TDGAItem.OnUse(item, itemNumber);
 }
Exemple #13
0
 /// <summary>
 /// 虚拟币消费
 /// </summary>
 /// <param name="item">购买物品</param>
 /// <param name="itemAmount">数量</param>
 /// <param name="virtualCurrency">消费虚拟币</param>
 public void OnPurchase(string item, int itemAmount, double virtualCurrency)
 {
     TDGAItem.OnPurchase(item, itemAmount, virtualCurrency);
 }
Exemple #14
0
    void OnBtnBuy()
    {
        char [] spliter = { ',', '.', ',', '。' };
        BCSoundPlayer.Play(MusicEnum.button);
        DataPlayerController dpc = DataPlayerController.getInstance();
        DataPlayer           _dp = dpc.data;

        if (mData.type == MDShopData.JEWEL)
        {
#if Umeng
            var dict = new Dictionary <string, string>();
            dict["costNum"] = mData.cost_num.ToString();
            dict["getNum"]  = mData.get_num.ToString();
            Umeng.GA.Event(UmengKey.ClickPay, dict);
#endif

//			#if TalkingData
//			//TDGAItem.OnPurchase("钻石"+mData.get_num.ToString(),1,mData.cost_num);
//			Dictionary<string, object> dic = new Dictionary<string, object>();
//			dic.Add("JewelNum",mData.get_num.ToString());
//			TalkingDataGA.OnEvent("购买钻石",dic);
//			#endif

            WGProductController.instance.OnBuyWithMDShopData(mData);
        }
        else if (mData.type == MDShopData.COIN)
        {
            if (_dp.Jewel >= mData.cost_num)
            {
#if Umeng
                var dict = new Dictionary <string, string>();
                dict["coin"] = mData.sid.ToString();
                Umeng.GA.Event(UmengKey.ClickBuy, dict);
#endif
                string title = WGStrings.getFormate(1030, mData.get_num.ToString(), mData.cost_num.ToString());
                WGAlertViewController.Self.showAlertView(title, 1002, 1007).alertViewBehavriour = (ab, view) => {
                    switch (ab)
                    {
                    case MDAlertBehaviour.CLICK_OK:
                    {
#if Umeng
                        Umeng.GA.Buy(mData.id.ToString(), mData.get_num, mData.cost_num * 1.0f / mData.get_num);
                        Umeng.GA.Event(UmengKey.BuySuccess, dict);
#endif
#if TalkingData
                        TDGAItem.OnPurchase("金币_" + mData.get_num.ToString(), 1, mData.cost_num);
                        Dictionary <string, object> dic = new Dictionary <string, object>();
                        dic.Add("CoinNum", mData.get_num.ToString());
                        TalkingDataGA.OnEvent("购买金币", dic);
#endif
                        _dp.Coin  += mData.get_num;
                        _dp.Jewel -= mData.cost_num;
                        DataPlayerController.getInstance().saveDataPlayer();
                        WGGameUIView.Instance.freshPlayerUI(UI_FRESH.COIN | UI_FRESH.BCOIN);

                        view.hiddenView();

                        WGAlertViewController.Self.showTipView(1001);

//							WGAlertViewController.Self.showAlertView(1001).alertViewBehavriour =(ab1,view1) => {
//								switch(ab1)
//								{
//								case MDAlertBehaviour.CLICK_OK:
//									view.hiddenView();
//									break;
//								case MDAlertBehaviour.DID_HIDDEN:
//									WGAlertViewController.Self.hiddeAlertView(view1.gameObject);
//									break;
//								}
//							};
                        break;
                    }

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

                    case MDAlertBehaviour.DID_HIDDEN:
                        WGAlertViewController.Self.hiddeAlertView(view.gameObject);
                        break;
                    }
                };
            }
            else
            {
                WGAlertViewController.Self.showAlertView(1003, 1002, 1007).alertViewBehavriour = (ab, view) => {
                    switch (ab)
                    {
                    case MDAlertBehaviour.CLICK_OK:
                        view.hiddenView();
                        WGShopView.curShopView.InitWillShowWithTabView(SHOP_TAB_VIEW.JEWEL_SHOP);
                        break;

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

                    case MDAlertBehaviour.DID_HIDDEN:
                        WGAlertViewController.Self.hiddeAlertView(view.gameObject);
                        break;
                    }
                };
            }
        }
        else if (mData.type == MDShopData.ITEM)
        {
            if ((mData.cost_type == 1 && _dp.Jewel >= mData.cost_num) || (mData.cost_type == 0 && _dp.Coin >= mData.cost_num))
            {
                var dict = new Dictionary <string, string>();
                dict["item"] = mData.sid.ToString();
#if Umeng
                Umeng.GA.Event(UmengKey.ClickBuy, dict);
#endif
                if (mData.id == WGDefine.SK_Defense10M || mData.id == WGDefine.SK_Defense30M)
                {
                    if (_dp.defenseTime > 0)
                    {
                        return;
                    }

                    MDSkill sk      = WGDataController.Instance.getSkill(mData.id);
                    int     titleID = mData.cost_type == 0?7006:1006;
                    string  title   = WGStrings.getFormate(titleID, sk.time.ToString(), mData.cost_num.ToString());
                    WGAlertViewController.Self.showAlertView(title, 1002, 1007).alertViewBehavriour = (ab, view) => {
                        switch (ab)
                        {
                        case MDAlertBehaviour.CLICK_OK:
                        {
                            string msg = "";
                            if (_dp.defenseTime > 0)
                            {
                                msg = WGStrings.getFormate(1008, _dp.defenseTime);
                            }
                            else
                            {
                                msg = WGStrings.getText(1001);
                                if (mData.cost_type == 1)
                                {
                                    _dp.Jewel -= mData.cost_num;
#if TalkingData
                                    string name = "道具_" + mData.pdes.Split(spliter)[0] + mData.des;
                                    TDGAItem.OnPurchase(name, 1, mData.cost_num);

                                    TDGAItem.OnUse(name, 1);
                                    Dictionary <string, object> dic = new Dictionary <string, object>();
                                    dic.Add("item", name);
                                    TalkingDataGA.OnEvent("购买道具", dic);
#endif
#if Umeng
                                    Umeng.GA.Buy(mData.id.ToString(), mData.get_num, mData.cost_num * 1.0f / mData.get_num);
#endif
                                }
                                else if (mData.cost_type == 0)
                                {
                                                                                #if TalkingData
                                    string name = "道具_" + mData.pdes.Split(spliter)[0] + mData.des;
                                    Dictionary <string, object> dic1 = new Dictionary <string, object>();
                                    dic1.Add("item", name);
                                    TalkingDataGA.OnEvent("金币购买道具", dic1);
                                                                                #endif
                                    _dp.Coin -= mData.cost_num;
                                }
#if Umeng
                                Umeng.GA.Event(UmengKey.BuySuccess, dict);
#endif
                                WGGameUIView.Instance.freshPlayerUI(UI_FRESH.COIN | UI_FRESH.BCOIN);
                                WGGameUIView.Instance.freshSkillNum();

                                _dp.defenseTime = _dp.defenseTime + (int)sk.time;
                                WGSkillController.Instance.ReleaseSkillWithID(mData.id);
                                GetTimeCount(mData);
                                showTimeCount();

                                WGShopView.curShopView.mTableView.UpdataCells();
//									node.refresh();
                            }
                            view.hiddenView();
                            WGAlertViewController.Self.showTipView(msg);
//								WGAlertViewController.Self.showAlertView(msg).alertViewBehavriour =(ab1,view1) => {
//									switch(ab1)
//									{
//									case MDAlertBehaviour.CLICK_OK:
//										view1.hiddenView();
//										break;
//									case MDAlertBehaviour.DID_HIDDEN:
//										WGAlertViewController.Self.hiddeAlertView(view1.gameObject);
//										break;
//									}
//								};
                            break;
                        }

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

                        case MDAlertBehaviour.DID_HIDDEN:
                            WGAlertViewController.Self.hiddeAlertView(view.gameObject);
                            break;
                        }
                    };
                }
                else if (mData.id == WGDefine.SK_777Up1 || mData.id == WGDefine.SK_777Up2)
                {
                    if (_dp.up777Time > 0)
                    {
                        return;
                    }
                    MDSkill sk      = WGDataController.Instance.getSkill(mData.id);
                    int     titleID = mData.cost_type == 0?7009:1009;
                    string  title   = WGStrings.getFormate(titleID, sk.time.ToString(), mData.cost_num.ToString());

                    WGAlertViewController.Self.showAlertView(title, 1002, 1007).alertViewBehavriour = (ab, view) => {
                        switch (ab)
                        {
                        case MDAlertBehaviour.CLICK_OK:
                        {
                            string msg = "";
                            if (_dp.up777Time > 0)
                            {
                                msg = WGStrings.getFormate(1010, _dp.defenseTime);
                            }
                            else
                            {
                                msg = WGStrings.getText(1001);

                                if (mData.cost_type == 1)
                                {
                                    _dp.Jewel -= mData.cost_num;

#if TalkingData
                                    TDGAItem.OnPurchase("道具_" + mData.pdes.Split(spliter)[0] + mData.des, 1, mData.cost_num);

                                    TDGAItem.OnUse("道具_" + mData.pdes.Split(spliter)[0] + mData.des, 1);

                                    Dictionary <string, object> dic = new Dictionary <string, object>();
                                    dic.Add("item", name);
                                    TalkingDataGA.OnEvent("购买道具", dic);
#endif
#if Umeng
                                    Umeng.GA.Buy(mData.id.ToString(), mData.get_num, mData.cost_num * 1.0f / mData.get_num);
#endif
                                }
                                else if (mData.cost_type == 0)
                                {
                                                                                #if TalkingData
                                    string name = "道具_" + mData.pdes.Split(spliter)[0] + mData.des;
                                    Dictionary <string, object> dic1 = new Dictionary <string, object>();
                                    dic1.Add("item", name);
                                    TalkingDataGA.OnEvent("金币购买道具", dic1);
                                                                                #endif
                                    _dp.Coin -= mData.cost_num;
                                }
#if Umeng
                                Umeng.GA.Event(UmengKey.BuySuccess, dict);
#endif
                                WGGameUIView.Instance.freshPlayerUI(UI_FRESH.COIN | UI_FRESH.BCOIN);
                                WGGameUIView.Instance.freshSkillNum();

                                _dp.up777Time = _dp.up777Time + (int)sk.time;
                                WGSkillController.Instance.ReleaseSkillWithID(mData.id);

                                GetTimeCount(mData);
                                showTimeCount();
//									WGGameUIView.Instance.mShopView.mTableView.UpdataCells();
                                WGShopView.curShopView.mTableView.UpdataCells();
//									node.refresh();
                            }
                            view.hiddenView();
                            WGAlertViewController.Self.showTipView(msg);
//								WGAlertViewController.Self.showAlertView(msg).alertViewBehavriour =(ab1,view1) => {
//									switch(ab1)
//									{
//									case MDAlertBehaviour.CLICK_OK:
//										view1.hiddenView();
//										break;
//									case MDAlertBehaviour.DID_HIDDEN:
//										WGAlertViewController.Self.hiddeAlertView(view1.gameObject);
//										break;
//									}
//								};
                            break;
                        }

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

                        case MDAlertBehaviour.DID_HIDDEN:
                            WGAlertViewController.Self.hiddeAlertView(view.gameObject);
                            break;
                        }
                    };
                }
                else if (mData.id == WGDefine.SK_GuDing30)
                {
                    if (_dp.guDingTime > 0)
                    {
                        return;
                    }
                    if (_dp.guDingForever > 0)
                    {
                        WGAlertViewController.Self.showAlertView(1033).alertViewBehavriour = (ab, view) => {
                            switch (ab)
                            {
                            case MDAlertBehaviour.CLICK_OK:
                                view.hiddenView();
                                break;

                            case MDAlertBehaviour.DID_HIDDEN:
                                WGAlertViewController.Self.hiddeAlertView(view.gameObject);
                                break;
                            }
                        };
                        return;
                    }
                    MDSkill sk    = WGDataController.Instance.getSkill(mData.id);
                    string  title = WGStrings.getFormate(1019, sk.time.ToString(), mData.cost_num.ToString());
                    WGAlertViewController.Self.showAlertView(title, 1002, 1007).alertViewBehavriour = (ab, view) => {
                        switch (ab)
                        {
                        case MDAlertBehaviour.CLICK_OK:
                        {
                            string msg = "";

                            msg = WGStrings.getText(1001);

                            if (mData.cost_type == 1)
                            {
                                _dp.Jewel -= mData.cost_num;
#if TalkingData
                                string name = "道具_" + mData.pdes.Split(spliter)[0] + mData.des;
                                TDGAItem.OnPurchase(name, 1, mData.cost_num);

                                TDGAItem.OnUse(name, 1);
                                Dictionary <string, object> dic = new Dictionary <string, object>();
                                dic.Add("item", name);
                                TalkingDataGA.OnEvent("购买道具", dic);
#endif
#if Umeng
                                Umeng.GA.Buy(mData.id.ToString(), mData.get_num, mData.cost_num * 1.0f / mData.get_num);
#endif
                            }
                            else if (mData.cost_type == 0)
                            {
                                                                        #if TalkingData
                                string name = "道具_" + mData.pdes.Split(spliter)[0] + mData.des;
                                Dictionary <string, object> dic1 = new Dictionary <string, object>();
                                dic1.Add("item", name);
                                TalkingDataGA.OnEvent("金币购买道具", dic1);
                                                                        #endif
                                _dp.Coin -= mData.cost_num;
                            }
#if Umeng
                            Umeng.GA.Event(UmengKey.BuySuccess, dict);
#endif
                            _dp.guDingTime = (int)sk.time;

                            WGGameUIView.Instance.freshPlayerUI(UI_FRESH.BCOIN);
                            WGGameUIView.Instance.freshSkillNum();
                            GetTimeCount(mData);
                            showTimeCount();

                            _dp.releaseGuding = 1;
                            WGSkillController.Instance.ReleaseSkillWithID(WGDefine.SK_GuDing30);
                            view.hiddenView();
                            WGAlertViewController.Self.showTipView(1001);

                            break;
                        }

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

                        case MDAlertBehaviour.DID_HIDDEN:
                            WGAlertViewController.Self.hiddeAlertView(view.gameObject);
                            break;
                        }
                    };
                }
                else if (mData.id == WGDefine.SK_GuDing)
                {
                    if (_dp.guDingForever > 0)
                    {
//						WGSkillController.Instance.ReleaseSkillWithID(mData.id);
//						GetTimeCount(mData);
                    }
                    else
                    {
                        MDSkill sk    = WGDataController.Instance.getSkill(mData.id);
                        string  title = WGStrings.getFormate(1020, mData.cost_num.ToString());
                        WGAlertViewController.Self.showAlertView(title, 1002, 1007).alertViewBehavriour = (ab, view) => {
                            switch (ab)
                            {
                            case MDAlertBehaviour.CLICK_OK:
                            {
                                string msg = "";
                                if (_dp.guDingForever > 0)
                                {
                                    msg = WGStrings.getText(1022);
                                }
                                else
                                {
                                    msg = WGStrings.getText(1001);

                                    if (mData.cost_type == 1)
                                    {
                                        _dp.Jewel -= mData.cost_num;

#if TalkingData
                                        string name = "道具_" + mData.pdes.Split(spliter)[0] + mData.des;
                                        TDGAItem.OnPurchase(name, 1, mData.cost_num);
                                        TDGAItem.OnUse(name, 1);
                                        Dictionary <string, object> dic = new Dictionary <string, object>();
                                        dic.Add("item", name);
                                        TalkingDataGA.OnEvent("购买道具", dic);
#endif

#if Umeng
                                        Umeng.GA.Buy(mData.id.ToString(), mData.get_num, mData.cost_num * 1.0f / mData.get_num);
#endif
                                    }
                                    else if (mData.cost_type == 0)
                                    {
                                                                                        #if TalkingData
                                        string name = "道具_" + mData.pdes.Split(spliter)[0] + mData.des;
                                        Dictionary <string, object> dic1 = new Dictionary <string, object>();
                                        dic1.Add("item", name);
                                        TalkingDataGA.OnEvent("金币购买道具", dic1);
                                                                                        #endif
                                        _dp.Coin -= mData.cost_num;
                                    }
#if Umeng
                                    Umeng.GA.Event(UmengKey.BuySuccess, dict);
#endif
                                    _dp.guDingForever = 1;

                                    WGGameUIView.Instance.freshPlayerUI(UI_FRESH.BCOIN);
                                    WGGameUIView.Instance.freshSkillNum();

                                    WGSkillController.Instance.ReleaseSkillWithID(mData.id);

                                    GetTimeCount(mData);
                                    showTimeCount();
                                }
                                view.hiddenView();
                                WGAlertViewController.Self.showTipView(msg);

//									WGAlertViewController.Self.showAlertView(msg).alertViewBehavriour =(ab1,view1) => {
//										switch(ab1)
//										{
//										case MDAlertBehaviour.CLICK_OK:
//											view1.hiddenView();
//											break;
//										case MDAlertBehaviour.DID_HIDDEN:
//											WGAlertViewController.Self.hiddeAlertView(view1.gameObject);
//											break;
//										}
//									};
                                break;
                            }

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

                            case MDAlertBehaviour.DID_HIDDEN:
                                WGAlertViewController.Self.hiddeAlertView(view.gameObject);
                                break;
                            }
                        };
                    }
                }
                else
                {
                    MDSkill sk      = WGDataController.Instance.getSkill(mData.id);
                    int     titleID = mData.cost_type == 0?7029:1029;
                    string  title   = WGStrings.getFormate(titleID, mData.get_num.ToString(), sk.name, mData.cost_num.ToString());
                    WGAlertViewController.Self.showAlertView(title, 1002, 1007).alertViewBehavriour = (ab, view) => {
                        switch (ab)
                        {
                        case MDAlertBehaviour.CLICK_OK:
                        {
                            dpc.AddSkillNum(mData.id, mData.get_num);
                            if (mData.cost_type == 1)
                            {
                                _dp.Jewel -= mData.cost_num;
                                                                #if TalkingData
                                string name = "道具_" + mData.pdes.Split(spliter)[0] + mData.des;
                                TDGAItem.OnPurchase(name, 1, mData.cost_num);
                                Dictionary <string, object> dic = new Dictionary <string, object>();
                                //dic.Add("name",sk.name);
                                dic.Add("item", name);
                                TalkingDataGA.OnEvent("购买道具", dic);
                                                                #endif
#if Umeng
                                Umeng.GA.Buy(mData.id.ToString(), mData.get_num, mData.cost_num * 1.0f / mData.get_num);
#endif
                            }
                            else if (mData.cost_type == 0)
                            {
                                                                        #if TalkingData
                                string name = "道具_" + mData.pdes.Split(spliter)[0] + mData.des;
                                Dictionary <string, object> dic1 = new Dictionary <string, object>();
                                dic1.Add("item", name);
                                TalkingDataGA.OnEvent("金币购买道具", dic1);
                                                                        #endif
                                _dp.Coin -= mData.cost_num;
                            }
#if Umeng
                            Umeng.GA.Event(UmengKey.BuySuccess, dict);
#endif
                            WGGameUIView.Instance.freshPlayerUI(UI_FRESH.COIN | UI_FRESH.BCOIN);
                            WGGameUIView.Instance.freshSkillNum();

                            view.hiddenView();
                            WGAlertViewController.Self.showTipView(1001);

//								WGAlertViewController.Self.showAlertView(1001).alertViewBehavriour =(ab1,view1) => {
//									switch(ab1)
//									{
//									case MDAlertBehaviour.CLICK_OK:
//										view1.hiddenView();
//										break;
//									case MDAlertBehaviour.DID_HIDDEN:
//										WGAlertViewController.Self.hiddeAlertView(view1.gameObject);
//										break;
//									}
//								};

                            break;
                        }

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

                        case MDAlertBehaviour.DID_HIDDEN:
                            WGAlertViewController.Self.hiddeAlertView(view.gameObject);
                            break;
                        }
                    };
                }
            }
            else
            {
                int msgID = mData.cost_type == 0?7003:1003;
                WGAlertViewController.Self.showAlertView(msgID, 1002, 1007).alertViewBehavriour = (ab, view) => {
                    switch (ab)
                    {
                    case MDAlertBehaviour.CLICK_OK:
                        view.hiddenView();
                        if (mData.cost_type == 1)
                        {
                            WGShopView.curShopView.InitWillShowWithTabView(SHOP_TAB_VIEW.JEWEL_SHOP);
                        }
                        else if (mData.cost_type == 0)
                        {
                            WGShopView.curShopView.InitWillShowWithTabView(SHOP_TAB_VIEW.Coin_SHOP);
                        }
                        break;

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

                    case MDAlertBehaviour.DID_HIDDEN:
                        WGAlertViewController.Self.hiddeAlertView(view.gameObject);
                        break;
                    }
                };
            }
        }
    }
Exemple #15
0
    private void OnGUI()
    {
        int i = 0;

        GUI.Box(new Rect(10, 10, Screen.width - 20, Screen.height - 20), "Demo Menu");

        GUI.Label(new Rect(left, top + (step * i++), width, height), deviceId);
        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "getDeviceId"))
        {
            deviceId = TalkingDataGA.GetDeviceId();
        }

        GUI.Label(new Rect(left, top + (step * i++), width, height), oaid);
        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "getOAID"))
        {
            oaid = TalkingDataGA.GetOAID();
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "SetLocation"))
        {
            TalkingDataGA.SetLocation(39.94, 116.43);
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Create Profile"))
        {
            profile = TDGAProfile.SetProfile("User" + index++);
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Set Profile Name"))
        {
            if (profile != null)
            {
                profile.SetProfileName("name");
            }
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Set Profile Type"))
        {
            if (profile != null)
            {
                profile.SetProfileType(ProfileType.WEIXIN);
            }
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Set Level"))
        {
            if (profile != null)
            {
                profile.SetLevel(level++);
            }
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Set Gender"))
        {
            if (profile != null)
            {
                profile.SetGender(Gender.MALE);
            }
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Set Age"))
        {
            if (profile != null)
            {
                profile.SetAge(21);
            }
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Set Game Server"))
        {
            if (profile != null)
            {
                profile.SetGameServer("server1");
            }
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Mission Begin"))
        {
            TDGAMission.OnBegin("miss001");
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Mission Completed"))
        {
            TDGAMission.OnCompleted("miss001");
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Mission Failed"))
        {
            TDGAMission.OnFailed("miss001", "failed");
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Charge Request"))
        {
            TDGAVirtualCurrency.OnChargeRequest("order01", "iap", 10, "CNY", 10, "UnionPay");
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Charge Success"))
        {
            TDGAVirtualCurrency.OnChargeSuccess("order01");
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Reward"))
        {
            TDGAVirtualCurrency.OnReward(100, "reason");
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Item Purchase"))
        {
            TDGAItem.OnPurchase("itemid001", 10, 10);
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Item Use"))
        {
            TDGAItem.OnUse("itemid001", 1);
        }

#if TDGA_CUSTOM
        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Custome Event"))
        {
            Dictionary <string, object> dic = new Dictionary <string, object>
            {
                { "StringValue", "Pi" },
                { "NumberValue", 3.14 }
            };
            TalkingDataGA.OnEvent("action_id", dic);
        }
#endif
    }