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 }
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>(); } }
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 }
/// <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); }
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 }
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"); }
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); } }
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); } }
public void TDGAVirtualCurrencyOnChargeRequest(string orderId, string iapId, double currencyAmount, string currencyType, double virtualCurrencyAmount, string paymentType) { TDGAVirtualCurrency.OnChargeRequest(orderId, iapId, currencyAmount, currencyType, virtualCurrencyAmount, paymentType); }
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 } }); } }
/// <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); }
/// <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; } } }
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 }