void onHttpCallback(string str) { if (curTransing == null) { curTransing = null; getCardsCode(); return; } if (str == "") { curTransing = null; getCardsCode(); return; } Variant v = JsonManager.StringToVariant(str); if (v["r"] == 1) { debug.Log("获得激活码:" + curTransing.id + " " + str); GiftCardData cardta = new GiftCardData(); cardta.id = curTransing.id; cardta.code = v["res"]; cardta.cardType = curTransing; cardta.initTimer(); if (dGiftCardData.ContainsKey(cardta.id)) { GiftCardData temp = dGiftCardData[cardta.id]; lGiftCards.Remove(temp); } dGiftCardData[cardta.id] = cardta; lGiftCards.Add(cardta); debug.Log("lGiftCards.clount::" + lGiftCards.Count); } else { Globle.err_output(v["r"]); debug.Log("激活码领取的错误码:" + v["r"]); } curTransing = null; getCardsCode(); }
public override void record_createRole(Variant data) { // "{\"roleId\":\"1\",\"roleName\":\"chasname\",\"roleLevel\":\"1\",\"roleGold\":\"300\",\"roleYb\":\"200\", // \"roleServerId\":\"1\",\"roleServerName\":\"servername\",\"rolevip\":\"1\",\"rolePartyName\":\"哈利噶多\", // \"rolePartyId\":\"123\",\"rolePower\":\"1234\",\"rolePartyRoleId\":\"1231\",\"rolePartyRoleName\":\"哈利波特\", // \"roleProfessionId\":\"12\",\"roleProfession\":\"无敌法师\",\"roleFriendlist\":\" \"}"; Globle.YR_role_enter_time = Globle.getStrTimeNomal(NetClient.instance.CurServerTimeStamp); int cid = data["cid"]; string name = data["name"]; if (name.Length > 2) { name = name.Remove(name.Length - 2); } uint zhuan = data["zhua"]; uint lvl = data["lvl"]; int professionId = data["carr"]; Variant v = new Variant(); v["roleId"] = cid; v["roleName"] = name; v["roleLevel"] = getlv(zhuan, lvl); v["roleGold"] = 0; v["roleYb"] = 0; v["roleCreateTime"] = NetClient.instance.CurServerTimeStamp; //v["roleleveluptime"] = NetClient.instance.CurServerTimeStamp; v["roleServerId"] = Globle.curServerD.sid; v["roleServerName"] = Globle.curServerD.server_name; v["rolevip"] = 0; v["rolePartyName"] = ""; v["rolePartyId"] = ""; v["rolePower"] = 0; v["rolePartyRoleId"] = ""; v["rolePartyRoleName"] = ""; v["roleProfessionId"] = professionId; v["roleProfession"] = ""; v["roleFriendlist"] = ""; v["gpuid"] = Globle.YR_srvlists__platuid; v["roleEnterTime"] = Globle.YR_role_enter_time; string serverInfoJsonString = JsonManager.VariantToString(v); AnyPlotformSDK.Call_Cmd("createRole", "lanRole", serverInfoJsonString, false); debug.Log("[record]createRole:" + serverInfoJsonString); }
public virtual void stopVoice(string path) { connInfo info = NetClient.instance.getObject(OBJECT_NAME.DATA_CONN) as connInfo; Variant v = new Variant(); v["sid"] = Globle.curServerD.sid; v["platid"] = Globle.YR_srvlists__platuid; v["uid"] = PlayerModel.getInstance().uid; v["token"] = info.token == "" ? "76b03211848f7db9b922a39fbe1d1978_2015-09-26 15:11:20-100000503" : info.token; v["url"] = path; string voicejsonString = JsonManager.VariantToString(v); AnyPlotformSDK.Call_Cmd("stopVoice", "lanVoice", voicejsonString, false); }
public static void POSTSvr(string query, string param, Action <Variant> cb, bool rcvJSONHandler = true, string method = "POST") { ////这里要改成异步的才能继续 //return; if (query == null || query == "" || cb == null) { return; } IURLReq urlReq = os.net.CreateURLReq(null); urlReq.url = query; urlReq.contentType = NetConst.URL_CONTENT_TYPE_URLENCODE; urlReq.dataFormat = NetConst.URL_DATA_FORMAT_TEXT; string data = ""; data += param; debug.Log(" POSTSvr query:" + query + "\n param:" + param); urlReq.data = data; //DebugTrace.dumpObj("POSTSvr data:" + data); urlReq.method = method; urlReq.load( //delegate(IURLReq r, byte[] vari) delegate(IURLReq r, object vari) { if (vari == null) { DebugTrace.print(" POSTSvr urlReq.load vari Null!"); } string str = vari as string; DebugTrace.print(" POSTSvr urlReq.loaded str[" + str + "]!"); Variant t = JsonManager.StringToVariant(str); if (cb != null) { cb(JsonManager.StringToVariant(str)); } }, null, null ); }
public override void Pay(rechargeData data) { // "{\"serverId\":\"300001\",\"serverName\":\"双线1区\",\"serverDesc\":\"s1\", // \"roleId\":\"1\",\"roleName\":\"haha\",\"productId\":\"1\",\"productName\":\"asdf\", // \"productPrice\":\"1\",\"productCount\":\"1\",\"productDesc\":\"description\",\"change_rate\":\"0\",\"productyb\":\"10\"}"; debug.Log("begin-pay"); Variant v = new Variant(); debug.Log("serverId:" + Globle.curServerD.sid); v["gpuid"] = Globle.YR_srvlists__platuid; v["serverId"] = Globle.curServerD.sid; v["serverIds"] = Globle.curServerD.sids; v["serverName"] = Globle.curServerD.server_name; v["serverDesc"] = Globle.curServerD.sid; v["roleId"] = PlayerModel.getInstance().cid; v["roleName"] = PlayerModel.getInstance().name; v["productId"] = data.payid; v["roleCreateTime"] = PlayerModel.getInstance().crttm; v["roleLevel"] = getlv(PlayerModel.getInstance().up_lvl, PlayerModel.getInstance().lvl); if (Application.platform == RuntimePlatform.Android) { v["productShopId"] = data.pay_android_id; } else if (Application.platform == RuntimePlatform.IPhonePlayer) { v["productShopId"] = data.pay_ios_id; } debug.Log("rechargeData:" + RechargeModel.getInstance().getRechargeDataById(data.id)); debug.Log("name:" + data.name); v["productName"] = data.name; v["productPrice"] = data.golden; v["productCount"] = 1; v["productDesc"] = data.desc1; v["change_rate"] = 0; v["productyb"] = data.golden_value; debug.Log("end-pay"); string LanPayInfoJsonString = JsonManager.VariantToString(v); AnyPlotformSDK.Call_Cmd("pay", "lanPay", LanPayInfoJsonString); }
void onHttpSevenCards(string str) { if (str == "") { return; } Variant v = JsonManager.StringToVariant(str); if (v["r"] == 1) { debug.Log("领取成功"); } else { Globle.err_output(v["r"]); debug.Log("激活码领取的错误码:" + v["r"]); } }
public override void record_createRole(Variant data) { int cid = data["cid"]; string name = data["name"]; if (name.Length > 2) { name = name.Remove(name.Length - 2); } uint zhuan = data["zhua"]; uint lvl = data["lvl"]; int professionId = data["carr"]; Variant v = new Variant(); v["roleId"] = cid; v["roleName"] = name; v["roleLevel"] = getlv(zhuan, lvl); v["roleGold"] = 0; v["roleYb"] = 0; v["roleCreateTime"] = NetClient.instance.CurServerTimeStamp; //v["roleleveluptime"] = NetClient.instance.CurServerTimeStamp; v["roleServerId"] = Globle.curServerD.sid; v["roleServerName"] = Globle.curServerD.server_name; v["rolevip"] = 0; v["roleLevelUpTime"] = NetClient.instance.CurServerTimeStamp; v["rolePartyName"] = ""; v["rolePartyId"] = ""; v["rolePower"] = 0; v["rolePartyRoleId"] = ""; v["rolePartyRoleName"] = ""; v["roleProfessionId"] = professionId; v["roleProfession"] = ""; v["roleFriendlist"] = ""; v["rolePartyMasterID"] = ""; v["rolePartyMasterName"] = ""; string serverInfoJsonString = JsonManager.VariantToString(v); AnyPlotformSDK.Call_Cmd("createRole", "lanRole", serverInfoJsonString, false); debug.Log("[record]createRole:" + serverInfoJsonString); }
public virtual void record_selectionSever() { if (Globle.Lan != "zh_cn") { return; } Variant v = new Variant(); v["serverId"] = Globle.curServerD.sid; v["serverIds"] = Globle.curServerD.sids; string serverInfoJsonString = JsonManager.VariantToString(v); AnyPlotformSDK.Call_Cmd("selectServer", "lanServer", serverInfoJsonString, false); debug.Log("[record]selectionSever:" + serverInfoJsonString); }
void onHttpShortCars(string str) { if (str == "") { return; } Variant v = JsonManager.StringToVariant(str); if (v["r"] == 1) { debug.Log("获得激活码:" + v["res"] + " " + str); string id = v["res"]; HttpAppMgr.instance.sendInputGiftCode(id); } else { Globle.err_output(v["r"]); debug.Log("激活码领取的错误码:" + v["r"]); } }
private void onHttpShortCars(string str) { bool flag = str == ""; if (!flag) { Variant variant = JsonManager.StringToVariant(str, true); bool flag2 = variant["r"] == 1; if (flag2) { debug.Log("获得激活码:" + variant["res"] + " " + str); string code = variant["res"]; HttpAppMgr.instance.sendInputGiftCode(code); } else { Globle.err_output(variant["r"]); debug.Log("激活码领取的错误码:" + variant["r"]); } } }
public override void record_login() { // "{\"roleId\":\"1\",\"roleName\":\"chasname\",\"roleLevel\":\"1\",\"roleGold\":\"300\",\"roleYb\":\"200\", // \"roleServerId\":\"1\",\"roleServerName\":\"servername\",\"rolevip\":\"1\",\"rolePartyName\":\"哈利噶多\", // \"rolePartyId\":\"123\",\"rolePower\":\"1234\",\"rolePartyRoleId\":\"1231\",\"rolePartyRoleName\":\"哈利波特\", //\"roleProfessionId\":\"12\",\"roleProfession\":\"无敌法师\",\"roleFriendlist\":\" \"}"; Globle.YR_role_enter_time = Globle.getStrTimeNomal(NetClient.instance.CurServerTimeStamp); Variant v = new Variant(); v["roleId"] = PlayerModel.getInstance().cid; v["roleName"] = PlayerModel.getInstance().name; v["roleLevel"] = getlv(PlayerModel.getInstance().up_lvl, PlayerModel.getInstance().lvl); v["roleGold"] = PlayerModel.getInstance().money; v["roleYb"] = PlayerModel.getInstance().gold; v["roleCreateTime"] = PlayerModel.getInstance().crttm; //v["roleleveluptime"] = PlayerModel.getInstance().crttm; v["roleServerId"] = Globle.curServerD.sid; v["roleServerName"] = Globle.curServerD.server_name; v["rolevip"] = PlayerModel.getInstance().vip; v["rolePartyName"] = ""; v["rolePartyId"] = PlayerModel.getInstance().clanid; v["rolePower"] = PlayerModel.getInstance().combpt; v["rolePartyRoleId"] = ""; v["rolePartyRoleName"] = ""; v["roleProfessionId"] = PlayerModel.getInstance().profession; v["roleProfession"] = ""; v["roleFriendlist"] = ""; v["gpuid"] = Globle.YR_srvlists__platuid; v["roleEnterTime"] = Globle.YR_role_enter_time; string serverInfoJsonString = JsonManager.VariantToString(v); AnyPlotformSDK.Call_Cmd("enterGame", "lanRole", serverInfoJsonString, false); debug.Log("[record]login:" + serverInfoJsonString); }
public virtual void endVoiceRecord() { if (!recordingVoice) { return; } recordingVoice = false; connInfo info = NetClient.instance.getObject(OBJECT_NAME.DATA_CONN) as connInfo; Variant v = new Variant(); v["sid"] = Globle.curServerD.sid; v["platid"] = Globle.YR_srvlists__platuid; v["uid"] = PlayerModel.getInstance().uid; v["token"] = info.token == "" ? "76b03211848f7db9b922a39fbe1d1978_2015-09-26 15:11:20-100000503" : info.token; v["url"] = m_voice_url; string voicejsonString = JsonManager.VariantToString(v); AnyPlotformSDK.Call_Cmd("finishRecord", "lanVoice", voicejsonString, false); // recordingVoice = false; }
public override void record_createRole(Variant data) { int val = data["cid"]; string text = data["name"]; bool flag = text.Length > 2; if (flag) { text = text.Remove(text.Length - 2); } uint up_lv = data["zhua"]; uint lv = data["lvl"]; int val2 = data["carr"]; Variant variant = new Variant(); variant["roleId"] = val; variant["roleName"] = text; variant["roleLevel"] = this.getlv(up_lv, lv); variant["roleGold"] = 0; variant["roleYb"] = 0; variant["roleCreateTime"] = NetClient.instance.CurServerTimeStamp; variant["roleServerId"] = Globle.curServerD.sid; variant["roleServerName"] = Globle.curServerD.server_name; variant["rolevip"] = 0; variant["rolePartyName"] = ""; variant["rolePartyId"] = ""; variant["rolePower"] = 0; variant["rolePartyRoleId"] = ""; variant["rolePartyRoleName"] = ""; variant["roleProfessionId"] = val2; variant["roleProfession"] = ""; variant["roleFriendlist"] = ""; string text2 = JsonManager.VariantToString(variant); AnyPlotformSDK.Call_Cmd("createRole", "lanRole", text2, false); debug.Log("[record]createRole:" + text2); }
public static Variant StringToVariant(string jsonString, bool one = true) { if (one) { JsonManager.data_value.Clear(); } Variant variant = new Variant(); bool flag = jsonString.Length <= 0; Variant result; if (flag) { DebugTrace.print(" >>>>>>>>>>>> JsonManager StringToVariant err! <<<<<<<<<<<< "); result = variant; } else { jsonString = jsonString.Remove(0, 1); jsonString = jsonString.Remove(jsonString.Length - 1); jsonString = JsonManager.setMtool(jsonString, '[', ']', "data_arr"); jsonString = JsonManager.setMtool(jsonString, '{', '}', "data_value"); string[] array = jsonString.Split(new char[] { ',' }); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string text = array2[i]; string text2 = text.Replace("\"", ""); text2 = text2.Replace("\\", ""); string[] array3 = text2.Split(new char[] { ':' }); bool flag2 = array3.Length < 2; if (flag2) { bool flag3 = array3.Length != 0; if (!flag3) { DebugTrace.print("Erorr: jsons Text Erorr"); result = null; return(result); } bool flag4 = array3[0].Contains("data_value"); if (flag4) { variant._arr.Add(JsonManager.StringToVariant(JsonManager.data_value[array3[0]], false)); } else { bool flag5 = array3[0].Contains("data_arr"); if (!flag5) { DebugTrace.print("Erorr: jsons Text Erorr"); result = null; return(result); } variant._arr.Add(JsonManager.StringToVariant(JsonManager.data_value[array3[0]], false)); } } else { bool flag6 = array3.Length > 2; if (flag6) { for (int j = 2; j < array3.Length; j++) { string[] expr_1C6_cp_0 = array3; int expr_1C6_cp_1 = 1; expr_1C6_cp_0[expr_1C6_cp_1] = expr_1C6_cp_0[expr_1C6_cp_1] + ":" + array3[j]; } } bool flag7 = array3[1].Contains("data_value"); if (flag7) { variant[array3[0]] = JsonManager.StringToVariant(JsonManager.data_value[array3[1]], false); } else { bool flag8 = array3[1].Contains("data_arr"); if (flag8) { variant[array3[0]] = JsonManager.StringToVariant(JsonManager.data_value[array3[1]], false); } else { variant[array3[0]] = array3[1]; } } } } result = variant; } return(result); }