コード例 #1
0
    /**************************************************** Apple Pay 回调 *********************************************************/
    // itemID = fk3 : 3张房卡
    // itemID = fk9 : 9张房卡
    // itemID = fk30 : 30张房卡
    public void iosiapCallback(string receipt, string itemID)
    {
        WWWForm form = new WWWForm();

        form.AddField("appId", GlobalData.mAppId);
        form.AddField("pid", PlayerInfo.Instance.mPlayerData.pid.ToString());
        form.AddField("itemId", itemID);
        form.AddField("receiptData", receipt);
        form.AddField("time", Haoyun.Utils.TimeUtils.ConvertToTime(System.DateTime.Now).ToString());
        //form.AddField("sig", GlobalData.sig);

        string url = GlobalData.mConstBaseServerUrl + ServerUrlTitle.Url_Iosiap;

        StartCoroutine(GlobalData.SendPost(url, form, delegate(WWW www)
        {
            if (www.text == "OK")
            {
                //uint rcNum = uint.Parse(itemID.Remove(0, 2));
                //GameObject emailTween = ResourceManager.Instance.LoadAsset<GameObject>("EmailTween");
                //emailTween.transform.SetParent(transform.parent);
                //emailTween.transform.localPosition = Vector3.zero;
                //emailTween.transform.localScale = Vector3.one;
                //emailTween.GetComponent<UIEmailTween>().SetInitData((int)rcNum, EEmailType.ERoomCard);
                //PlayerInfo.Instance.AddRoomCard((int)rcNum);
                UIManagers.Instance.EnqueueTip("支付成功,请到邮箱领取");
                TDGAVirtualCurrency.OnChargeSuccess(GlobalData.applePayOrderId);
            }
            else
            {
                UIManagers.Instance.EnqueueTip("支付失败");
            }
        }));
    }
コード例 #2
0
        public static void Recharge()
        {
            if (Temp.Online)
            {
                string rechargeID = string.Empty;
#if UNITY_IOS
                rechargeID = "Recharge_IOS_" + Guid.NewGuid().ToString();
                TDGAVirtualCurrency.OnChargeRequest(rechargeID, "礼包", 6, "CNY", 6, "IOS");
#else
                rechargeID = "Recharge_Android_" + Guid.NewGuid().ToString();
                TDGAVirtualCurrency.OnChargeRequest(rechargeID, "礼包", 6, "CNY", 6, "Android");
#endif
                GameProtocol.Recharge.Send(res =>
                {
                    if (res.Result == ReturnCode.OK)
                    {
                        Save.SetPlayer(res.Player);
                        PlayerPrefs.SetInt("GiftValue", 1);
                        TDGAVirtualCurrency.OnChargeSuccess(rechargeID);
                        MainUI.Instance.ShowPanel <RechargeSuccessPanel>();
                    }
                });
            }
            else
            {
                Save.Player.Recharge();
                MainUI.Instance.ShowPanel <RechargeSuccessPanel>();
            }
        }
コード例 #3
0
    void OnRoomcardClick(GameObject g)
    {
        int    i     = listRoomCardBtn.IndexOf(g.GetComponent <RawImage>());
        string fkNum = cardNum[i].ToString();

        Debug.Log("购买的房卡数量:" + fkNum);

#if UNITY_IPHONE || UNITY_IOS
        AudioManager.Instance.PlayClickBtnAudio();
        if (GameManager.Instance.mGameMode == EGameMode.EAppleOnLine)
        {
            GlobalData.applePayOrderId = System.Guid.NewGuid().ToString("N");
            string itemID = "fk" + fkNum;
            double rmb    = 0.0;
            if (fkNum == "3")
            {
                rmb = 6;
            }
            else if (fkNum == "9")
            {
                rmb = 18;
            }
            else if (fkNum == "30")
            {
                rmb = 60;
            }
            TDGAVirtualCurrency.OnChargeRequest(GlobalData.applePayOrderId, itemID, rmb, "CNY", System.Convert.ToDouble(fkNum), "applePay");
            IOSIAP.GetIns().PurchaseItem(itemID);
        }
#endif
    }
コード例 #4
0
    public void OnBuyClick(GameObject g)
    {
#if UNITY_IPHONE || UNITY_IOS
        AudioManager.Instance.PlayClickBtnAudio();
        if (GameManager.Instance.mGameMode == EGameMode.EAppleOnLine)
        {
            GlobalData.applePayOrderId = System.Guid.NewGuid().ToString("N");
            string itemID = "fk" + fkNum;
            double rmb    = 0.0;
            if (fkNum == "3")
            {
                rmb = 6;
            }
            else if (fkNum == "9")
            {
                rmb = 18;
            }
            else if (fkNum == "30")
            {
                rmb = 60;
            }
            TDGAVirtualCurrency.OnChargeRequest(GlobalData.applePayOrderId, itemID, rmb, "CNY", System.Convert.ToDouble(fkNum), "applePay");
            IOSIAP.GetIns().PurchaseItem(itemID);
        }
#endif
    }
コード例 #5
0
 /// <summary>
 /// 充值成功时调用
 /// </summary>
 /// <param name="strOrder"></param>
 public void OnChargeSuccess(string strOrder)
 {
     if (!isRuntime)
     {
         return;
     }
     TDGAVirtualCurrency.OnChargeSuccess(strOrder);
 }
コード例 #6
0
 /// <summary>
 /// 游戏内获得物品时调用
 /// </summary>
 /// <param name="rewardNum"></param>
 /// <param name="rsason"></param>
 public void OnReward(int rewardNum, string strRsason)
 {
     if (!isRuntime)
     {
         return;
     }
     TDGAVirtualCurrency.OnReward(rewardNum, strRsason);
 }
コード例 #7
0
 /// <summary>
 /// 用户发起充值请求时调用
 /// </summary>
 /// <param name="strOrder"></param>
 /// <param name="currencyAmount"></param>
 /// <param name="paymentType"></param>
 public void OnChargeRequest(string strOrder, int currencyAmount, string paymentType)
 {
     if (!isRuntime)
     {
         return;
     }
     TDGAVirtualCurrency.OnChargeRequest(strOrder, "iap", currencyAmount, "CH", currencyAmount, paymentType);
 }
コード例 #8
0
    public void OnChargeRequest(string order, string name, double price, string moneyType, double rmb, string paymentType)
    {
#if UNITY_ANDROID
        if (this.useTaklingData)
        {
            TDGAVirtualCurrency.OnChargeRequest(order, name, price, moneyType, rmb, paymentType);
        }
#endif
    }
コード例 #9
0
    public void OnChargeSuccess(string order)
    {
#if UNITY_ANDROID
        if (this.useTaklingData)
        {
            TDGAVirtualCurrency.OnChargeSuccess(order);
        }
#endif
    }
コード例 #10
0
    public void IAPReqHandle(object e, Hashtable hash)
    {
        Debug.Log("IAPReqHandle");
        string punchID      = (string)hash["PurchID"];
        string orderID      = (string)hash["OrderID"];
        var    chargeRecord = Tables.TableReader.Recharge.GetRecord(punchID);

        TDGAVirtualCurrency.OnChargeRequest(orderID, chargeRecord.Id, chargeRecord.Price, "CH", chargeRecord.Num, "PT");
    }
コード例 #11
0
 public static void OnChargeSuccess(string orderId)
 {
     if (Application.platform != RuntimePlatform.OSXEditor && Application.platform != RuntimePlatform.WindowsEditor)
     {
         TDGAVirtualCurrency.GetAgent().CallStatic("onChargeSuccess", new object[]
         {
             orderId
         });
     }
 }
コード例 #12
0
    public void IAPSucessHandle(object e, Hashtable hash)
    {
        Debug.Log("IAPSucessHandle");

        string punchID      = (string)hash["PurchID"];
        string orderID      = (string)hash["OrderID"];
        var    chargeRecord = Tables.TableReader.Recharge.GetRecord(punchID);

        TDGAVirtualCurrency.OnChargeSuccess(orderID);
    }
コード例 #13
0
    void GetReward(bool bDouble)
    {
        DataPlayerController dpc  = DataPlayerController.getInstance();
        DataPlayer           _dp  = dpc.data;
        BCGameObjectType     type = WGDataController.Instance.GetBCObjType(curReward.reward);
        BCObj obj = WGDataController.Instance.GetBCObj(curReward.reward);

        switch (type)
        {
        case BCGameObjectType.Coin:
            _dp.Coin = _dp.Coin + curReward.got_num;
            if (bDouble)
            {
                _dp.Coin = _dp.Coin + curReward.got_num;
            }
            break;

        case BCGameObjectType.Collection:
            dpc.addCollectionNum(curReward.reward, curReward.got_num);
            if (bDouble)
            {
                dpc.addCollectionNum(curReward.reward, curReward.got_num);
            }
            break;

        case BCGameObjectType.Item:
            dpc.AddSkillNum(curReward.reward, curReward.got_num);
            if (bDouble)
            {
                dpc.AddSkillNum(curReward.reward, curReward.got_num);
            }
            break;

        case BCGameObjectType.Jewel:
            _dp.Jewel += curReward.got_num;
            if (bDouble)
            {
                _dp.Jewel += curReward.got_num;
            }
                        #if TalkingData
            TDGAVirtualCurrency.OnReward(curReward.got_num, "DailyReward");
                        #endif
                        #if Umeng
            Umeng.GA.Bonus(curReward.got_num, Umeng.GA.BonusSource.Source2);
                        #endif
            break;
        }

        _dp.lastDailyRewardTime = Core.now;

        dpc.saveDataPlayer();

        WGGameUIView.Instance.freshPlayerUI(UI_FRESH.BCOIN | UI_FRESH.COIN);
    }
コード例 #14
0
 public static void OnReward(double virtualCurrencyAmount, string reason)
 {
     if (Application.platform != RuntimePlatform.OSXEditor && Application.platform != RuntimePlatform.WindowsEditor)
     {
         TDGAVirtualCurrency.GetAgent().CallStatic("onReward", new object[]
         {
             virtualCurrencyAmount,
             reason
         });
     }
 }
コード例 #15
0
 public static void OnChargeRequest(string orderId, string iapId, double currencyAmount, string currencyType, double virtualCurrencyAmount, string paymentType)
 {
     if (Application.platform != RuntimePlatform.OSXEditor && Application.platform != RuntimePlatform.WindowsEditor)
     {
         TDGAVirtualCurrency.GetAgent().CallStatic("onChargeRequest", new object[]
         {
             orderId,
             iapId,
             currencyAmount,
             currencyType,
             virtualCurrencyAmount,
             paymentType
         });
     }
 }
コード例 #16
0
ファイル: LeSDK.cs プロジェクト: zhengfujun/Encyclopedia
    void UpdatePayRes()
    {
        Action Over = () =>
        {
            CancelInvoke("UpdatePayRes");
            GameApp.SendMsg.EndWaitUI();
        };

        string PayRes = TestPlugins.Call <string>("GetPayRes");

        Debug.Log(StringBuilderTool.ToInfoString("支付结果:", PayRes));

        string[] s = PayRes.Split('#');
        if (s.Length > 0)
        {
            if (s[0] != "Wait")
            {
                Over();

                if (s[0] == "SUCCESS")
                {
                    if (s.Length > 1)
                    {
                        string[] msg = s[1].Split('&');
                        for (int i = 0; i < msg.Length; i++)
                        {
                            string[] data = msg[i].Split('=');
                            if (data.Length == 2)
                            {
                                Debug.Log(StringBuilderTool.ToInfoString(data[0], "=", data[1], "\n"));
                            }
                        }
                    }
                    GameApp.Instance.CommonHintDlg.OpenHintBox("支付成功!");
#if UNITY_ANDROID
                    TDGAVirtualCurrency.OnChargeSuccess(GameApp.Instance.Platform.PlatformInfo.orderId);
#endif
                    //GameApp.Instance.CommonMsgDlg.OpenSimpleMsgBox(StringBuilderTool.ToInfoString("支付成功!\n", s[1]));
                }
                else
                {
                    GameApp.Instance.CommonMsgDlg.OpenSimpleMsgBox(StringBuilderTool.ToInfoString("支付失败!\n", s[1]));
                }
            }
        }
    }
コード例 #17
0
ファイル: LeSDK.cs プロジェクト: zhengfujun/Encyclopedia
    public void Pay(GoodsInfo CurWaitBuyGoodsInfo)
    {
        Debug.Log("支付");

#if UNITY_ANDROID
        TDGAVirtualCurrency.OnChargeRequest(GameApp.Instance.Platform.PlatformInfo.orderId, CurWaitBuyGoodsInfo.ID.ToString(), CurWaitBuyGoodsInfo.GetPrice(), "CH", CurWaitBuyGoodsInfo.GetPrice(), "LePay");
#endif

        LePayInfo tempPI = new LePayInfo(CurWaitBuyGoodsInfo.GetPriceStr(),
                                         CurWaitBuyGoodsInfo.ID.ToString(), CurWaitBuyGoodsInfo.Name, CurWaitBuyGoodsInfo.Des,
                                         "http://platform01.baobaolong.club/platform/billing/callback/letvCallback", GameApp.Instance.Platform.PlatformInfo.orderId);

        if (CallSDKFun("Pay", tempPI.ToString(SDKInfo)))
        {
            GameApp.SendMsg.StartWaitUI();
            InvokeRepeating("UpdatePayRes", 0, 0.5f);
        }
    }
コード例 #18
0
    void OnBtnGetReward()
    {
        WGDataController     _dataCtrl = WGDataController.Instance;
        DataPlayerController dpc       = DataPlayerController.getInstance();

        if (dpc.data.dicGotAchReward[preAchievementData.id] != 1)
        {
            WGAlertViewController.Self.showAlertView(1016).alertViewBehavriour = (ab, view) => {
                switch (ab)
                {
                case MDAlertBehaviour.CLICK_OK:
                    view.hiddenView();
                    break;

                case MDAlertBehaviour.DID_HIDDEN:
                    WGAlertViewController.Self.hiddeAlertView(view.gameObject);
                    break;
                }
            };
            return;
        }

        int objID  = preAchievementData.reward[0];
        int gotNum = preAchievementData.reward[1];

        BCObj obj = _dataCtrl.GetBCObj(objID);

        switch (obj.BCType)
        {
        case BCGameObjectType.Item:
            dpc.AddSkillNum(objID, gotNum);
            WGGameUIView.Instance.freshSkillNum();
            break;

        case BCGameObjectType.Collection:
            dpc.addCollectionNum(objID, gotNum);
            break;

        case BCGameObjectType.Coin:
            dpc.data.Coin += gotNum;
            WGGameUIView.Instance.freshPlayerUI(UI_FRESH.COIN);
            break;

        case BCGameObjectType.Jewel:
            dpc.data.Jewel += gotNum;
#if TalkingData
            TDGAVirtualCurrency.OnReward(gotNum, "AchievementReward");
#endif
#if Umeng
            Umeng.GA.Bonus(gotNum, Umeng.GA.BonusSource.Source4);
#endif
            WGGameUIView.Instance.freshPlayerUI(UI_FRESH.BCOIN);
            break;
        }

        dpc.data.dicGotAchReward[preAchievementData.id] = -1;

//		WGAlertViewController.Self.showAlertView(1015).alertViewBehavriour =(ab,view)=>{
//			switch(ab)
//			{
//			case MDAlertBehaviour.CLICK_OK:
//				view.hiddenView();
//				if(curAchViewManager != null)
//				{
//					curAchViewManager.ReloadAchievement();
//				}
//				break;
//			case MDAlertBehaviour.DID_HIDDEN:
//				WGAlertViewController.Self.hiddeAlertView(view.gameObject);
//				break;
//			}
//		};
        if (curAchViewManager != null)
        {
            curAchViewManager.ReloadAchievement();
        }
    }
コード例 #19
0
ファイル: YeHuoSDK.cs プロジェクト: linbozhang/ThrowCoin
    void OnMessage(string msg)
    {
        mMessage += msg + "\n";


        YHSDKMessage sdMsg = SDK.Deserialize <YHSDKMessage>(msg);

        //WG.Log("OnMessage==="+msg);
        if (sdMsg.a == 1)          //isMusicOn
        {
            if (sdMsg.k == 1)      //on

            {
                if (BCSoundPlayer.Instance != null)
                {
                    BCSoundPlayer.Instance.SwitchMusic = true;
                    BCSoundPlayer.Instance.SwitchSound = true;
                }
                else
                {
                    PlayerPrefs.SetInt(KEYMUSIC, 1);
                    PlayerPrefs.SetInt(KEYSOUND, 1);
                }
            }
            else if (sdMsg.k == 0)                // off

            {
                if (BCSoundPlayer.Instance != null)
                {
                    BCSoundPlayer.Instance.SwitchMusic = false;
                    BCSoundPlayer.Instance.SwitchSound = false;
                }
                else
                {
                    PlayerPrefs.SetInt(KEYMUSIC, 0);
                    PlayerPrefs.SetInt(KEYSOUND, 0);
                }
            }
        }
        else if (sdMsg.a == 2)            //getPayTipType  k=0 LONG_TIP; k= 1 SHORT_TIP;k=2 NO_TIP;
        //WG.Log ("getPayTipType===" + sdMsg.k);

        {
            mTipType = sdMsg.k;
        }
        else if (sdMsg.a == 3)            //payResult
        //WG.Log ("payResult ====" + sdMsg.k + "payCode====" + sdMsg.s);

        {
            if (dicPayBlock.ContainsKey(sdMsg.s))
            {
                System.Action <bool> myAct = dicPayBlock [sdMsg.s];
                dicPayBlock.Remove(sdMsg.s);
                if (myAct != null)
                {
                    myAct(sdMsg.k == 0);
                }
            }

            if (dicPayOrder.ContainsKey(sdMsg.s))
            {
                string order = dicPayOrder [sdMsg.s];
                if (sdMsg.k == 0)
                {
                                        #if TalkingData
                    TDGAVirtualCurrency.OnChargeSuccess(order);
                    int payKey = System.Int32.Parse(sdMsg.s);
                    payKey %= 100;
                                        #endif
//					string payName=WGDataController.Instance.getYHMDPay((YHPayType)payKey).name;
//					Dictionary<string ,object> dic=new Dictionary<string,object>();
//					dic.Add("item",payName);
//					TalkingDataGA.OnEvent("购买成功",dic);
                }
                dicPayOrder.Remove(sdMsg.s);
            }
        }
        else if (sdMsg.a == 4)
        {
            WGGameWorld.Instance.keyEscape = 0;
            if (sdMsg.k == 0)               // exit game
            {
                WGGameWorld.Instance.OnApplicationPause(true);
                HKDataStatistics.Self.OnApplicationPause(true);
                //TalkingDataGA.OnKill();
            }
            else                 //cancel exit game
                                 //HKDataStatistics.Self.OnApplicationPause (false);
            {
            }
        }
        else if (sdMsg.a == 5)            //getSpecificFunction callback
        {
            if (sdMsg.s.Equals("4"))      //对话费,超级老虎机,十连抽
            {
                bTiger_HuaFei = sdMsg.k == 1;
                Debug.Log("superTiger:" + bTiger_HuaFei);
                //bTiger_HuaFei=false;
                getSpecificFunction(8);                 //客服控制
            }
            else if (sdMsg.s.Equals("8"))               //客服控制默认关闭
            {
                bKeFu = (sdMsg.k == 0?false:true);
                getSpecificFunction(16);                 //文案是否清楚
            }
            else if (sdMsg.s.Equals("16"))               //文案是否清楚
            {
                bMsgClear = sdMsg.k == 0;
                getSpecificFunction(32);                 //SuperTiger
            }
            else if (sdMsg.s.Equals("32"))               //普通老虎机

            {
                bCommonTiger = sdMsg.k == 1;
                getSpecificFunction(64);
            }
            else if (sdMsg.s.Equals("64"))             //新手礼包
            {
                bShowNewhandGift = sdMsg.k == 1;
                getSpecificFunction(128);
            }
            else if (sdMsg.s.Equals("128"))             //幸运礼包
            {
                bShowLuckGift = sdMsg.k == 1;
                getSpecificFunction(256);
            }
            else if (sdMsg.s.Equals("256"))              //土豪礼包
            {
                bShowRichGift = sdMsg.k == 1;
                getSpecificFunction(512);
            }
            else if (sdMsg.s.Equals("512"))             //狂暴礼包
            {
                bShowPoweGift = sdMsg.k == 1;
                getSpecificFunction(1024);
            }
            else if (sdMsg.s.Equals("1024"))             //双倍奖励
            {
                bShowDoubleGift = sdMsg.k == 1;
                getSpecificFunction(2);
            }
            else if (sdMsg.s.Equals("2"))             //角色3合一
            {
                bShow3RoalGift = sdMsg.k == 1;
                Debug.Log("show3RoalGift" + bShow3RoalGift);
                getSpecificFunction(1);
            }
            else if (sdMsg.s.Equals("1"))             //指哪打哪

            {
                bShowFinger = sdMsg.k == 1;
                Debug.Log("showFinger" + bShowFinger);
            }
        }
        else if (sdMsg.a == 6)
        {
            mUserID = sdMsg.s;
        }
    }
コード例 #20
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);
        }
    }
コード例 #21
0
    /// <summary>
    /// 检测是否有没有提交的充值成功请求
    /// </summary>
    public static void UnlockProducts(string proId)
    {
        if (!string.IsNullOrEmpty(proId))
        {
            string orderId;
            switch (proId)
            {
            case price6:
                DbManager.Instance.GotSilver(50000);
                Messenger.Broadcast <string>(NotifyTypes.GetStorePanelData, UserModel.CurrentUserData.CurrentCitySceneId);
                AlertCtrl.Show("银子 +50000");
                orderId = Statics.GetNowTimeStamp().ToString();
                TDGAVirtualCurrency.OnChargeRequest(orderId, price6, 6, "CH", 6, "iap");
                TDGAVirtualCurrency.OnChargeSuccess(orderId);
                addPay(6);    //记录充值
                break;

            case price18:
                DbManager.Instance.GotSilver(200000);
                Messenger.Broadcast <string>(NotifyTypes.GetStorePanelData, UserModel.CurrentUserData.CurrentCitySceneId);
                AlertCtrl.Show("银子 +200000");
                orderId = Statics.GetNowTimeStamp().ToString();
                TDGAVirtualCurrency.OnChargeRequest(orderId, price18, 18, "CH", 18, "iap");
                TDGAVirtualCurrency.OnChargeSuccess(orderId);
                addPay(18);    //记录充值
                break;

            case prop1:
                PropItemContainer.SendRewards(PropType.NocturnalClothing, 10);
//                    IOSNativePopUpManager.showMessage("提示", "获得了10件夜行衣");
                orderId = Statics.GetNowTimeStamp().ToString();
                TDGAVirtualCurrency.OnChargeRequest(orderId, prop1, 1, "CH", 1, "iap");
                TDGAVirtualCurrency.OnChargeSuccess(orderId);
                addPay(1);    //记录充值
                break;

            case prop3:
                PropItemContainer.SendRewards(PropType.Bodyguard, 10);
//                    IOSNativePopUpManager.showMessage("提示", "获得了10位镖师");
                orderId = Statics.GetNowTimeStamp().ToString();
                TDGAVirtualCurrency.OnChargeRequest(orderId, prop3, 1, "CH", 1, "iap");
                TDGAVirtualCurrency.OnChargeSuccess(orderId);
                addPay(1);    //记录充值
                break;

            case prop4:
                PropItemContainer.SendRewards(PropType.LimePowder, 10);
//                    IOSNativePopUpManager.showMessage("提示", "获得了10包石灰粉");
                orderId = Statics.GetNowTimeStamp().ToString();
                TDGAVirtualCurrency.OnChargeRequest(orderId, prop4, 1, "CH", 1, "iap");
                TDGAVirtualCurrency.OnChargeSuccess(orderId);
                addPay(1);    //记录充值
                break;

            case prop5:
                PropItemContainer.SendRewards(PropType.Scout, 10);
//                    IOSNativePopUpManager.showMessage("提示", "获得了10个探子");
                orderId = Statics.GetNowTimeStamp().ToString();
                TDGAVirtualCurrency.OnChargeRequest(orderId, prop5, 1, "CH", 1, "iap");
                TDGAVirtualCurrency.OnChargeSuccess(orderId);
                addPay(1);    //记录充值
                break;

            case worker10:
                DbManager.Instance.SetPlusWorkerNum(DbManager.Instance.GetPlusWorkerNum() + 10);
                DbManager.Instance.SetMaxWorkerNum(DbManager.Instance.GetMaxWorkerNum() + 10);
                DbManager.Instance.SetWorkerNum(DbManager.Instance.GetWorkerNum() + 10);
                WorkshopPanelCtrl.MakeWorkerNumChange(DbManager.Instance.GetWorkerNum(), DbManager.Instance.GetMaxWorkerNum());
                AlertCtrl.Show("成功招募了10个家丁");
                orderId = Statics.GetNowTimeStamp().ToString();
                TDGAVirtualCurrency.OnChargeRequest(orderId, worker10, 3, "CH", 3, "iap");
                TDGAVirtualCurrency.OnChargeSuccess(orderId);
                addPay(3);    //记录充值
                break;

            default:
                IOSNativePopUpManager.showMessage("提示", "不匹配的内购项目");
                SendEvent("ProductIdError", DbManager.Instance.HostData.Lv.ToString(), DbManager.Instance.HostData.Name);
                break;
            }
        }
    }
コード例 #22
0
 /// <summary>
 /// 支付开始
 /// </summary>
 /// <param name="orderId">订单ID</param>
 /// <param name="iapId">充值物品ID</param>
 /// <param name="amount">现金金额或现金等价物的额度</param>
 /// <param name="type">货币单位 例:人民币 CNY;美元 USD;欧元 EUR;</param>
 /// <param name="vAmount">虚拟币金额</param>
 /// <param name="paymentType">支付的途径,最多16个字符。例如:“支付宝”、“苹果官方”、“XX 支付SDK</param>
 public void OnChargeStart(string orderId, string iapId, double amount, string type, double vAmount, string paymentType)
 {
     TDGAVirtualCurrency.OnChargeRequest(orderId, iapId, amount, type, vAmount, paymentType);
 }
コード例 #23
0
 /// <summary>
 /// 获得虚拟币记录
 /// </summary>
 /// <param name="virtualCurrency"></param>
 /// <param name="reason"></param>
 public void OnReward(double virtualCurrency, string reason = "")
 {
     TDGAVirtualCurrency.OnReward(virtualCurrency, reason);
 }
コード例 #24
0
 public void TDGAVirtualCurrencyOnChargeSuccess(string orderId)
 {
     TDGAVirtualCurrency.OnChargeSuccess(orderId);
 }
コード例 #25
0
 public void TDGAVirtualCurrencyOnChargeRequest(string orderId, string iapId, double currencyAmount,
                                                string currencyType, double virtualCurrencyAmount, string paymentType)
 {
     TDGAVirtualCurrency.OnChargeRequest(orderId, iapId, currencyAmount, currencyType, virtualCurrencyAmount, paymentType);
 }
コード例 #26
0
    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
                }
            });
        }
    }
コード例 #27
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
    }