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>(); } }
/**************************************************** 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("支付失败"); } })); }
/// <summary> /// 充值成功时调用 /// </summary> /// <param name="strOrder"></param> public void OnChargeSuccess(string strOrder) { if (!isRuntime) { return; } TDGAVirtualCurrency.OnChargeSuccess(strOrder); }
public void OnChargeSuccess(string order) { #if UNITY_ANDROID if (this.useTaklingData) { TDGAVirtualCurrency.OnChargeSuccess(order); } #endif }
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); }
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])); } } } }
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 TDGAVirtualCurrencyOnChargeSuccess(string orderId) { TDGAVirtualCurrency.OnChargeSuccess(orderId); }
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> 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; } } }
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; } }
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 }