IEnumerator GetTestPHP(string platform) { WWW www = new WWW("http://jh.fanhougame.net/getServerList.php?platform=" + platform); yield return(www); if (www.isDone) { if (!string.IsNullOrEmpty(www.error)) { MessageBox.Instance.Show(3, "", "获取服务器列表失败", "重试", () => LocalServerList()); yield break; } var jsonBackObj = JsonConvertor <PhpBackObj> .Json2Object(www.text); if (jsonBackObj != null) { this.ShowSelectServer(jsonBackObj); } else { MessageBox.Instance.Show(3, "", "获取服务器列表失败", "重试", () => LocalServerList()); } } }
private void LocalServerList() { //StartCoroutine(GetTestPHP("1")); StringBuilder strBuilder = new StringBuilder(""); Server[] ServerList = LocalServerListConfig.LocalServerList; for (int i = 0, imax = ServerList.Length; i < imax; i++) { strBuilder.Append("{\"No\":").Append(ServerList[i].No.ToString()).Append(","); strBuilder.Append("\"Name\":\"").Append(ServerList[i].Name).Append("\","); strBuilder.Append("\"Version\":").Append(1).Append(","); strBuilder.Append("\"IP\":\"").Append(ServerList[i].IP).Append("\","); strBuilder.Append("\"Port\":").Append(ServerList[i].Port.ToString()).Append(","); strBuilder.Append("\"ActorNumber\":").Append(ServerList[i].ActorNumber.ToString()).Append(","); strBuilder.Append("\"Status\":").Append(ServerList[i].Status.ToString()).Append(","); strBuilder.Append("\"Recommend_status\":").Append(ServerList[i].Recommend_status.ToString()).Append("}"); if (i < imax - 1) { strBuilder.Append(","); } } var testJson = "{\"ErrorCode\":\"1\",\"ErrorDesc\":\"\u6709\u6548\",\"ServerInfo\":[" + strBuilder.ToString() + "]}"; testJson = testJson.Replace("\"", "'"); var jsonBackObj = JsonConvertor <PhpBackObj> .Json2Object(testJson); this.ShowSelectServer(jsonBackObj); }
private void PhpServerCallback(string backJson) { backJson = backJson.Replace("\"", "'"); var jsonBackObj = JsonConvertor <PhpBackObj> .Json2Object(backJson); TraceUtil.Log("BackJson:" + backJson); ShowSelectServer(jsonBackObj); }
public IEnumerator RequestPropagandaList(ButtonCallBack callBack) { WWW www = new WWW("http://jh.fanhougame.net/gm/?from=front&service=GameManagerService&action=getAutoTalkInfo"); yield return(www); if (www.isDone && string.IsNullOrEmpty(www.error)) { PhpAutoPropaganda phpPropaganda = JsonConvertor <PhpAutoPropaganda> .Json2Object(www.text); callBack(phpPropaganda); } }
/// <summary> /// PhpService CallBack Handler. 目前暂不调用,Php服务器目前仅返回服务器IP列表,没有做平台验证。 /// 需要修改服务器Json串请请看LoginUIPanel。 /// </summary> /// <param name="backJson"></param> public void PhpServerCallback(string backJson) { var testJson = "{\"ErrorCode\":\"1\",\"ErrorDesc\":\"\u6709\u6548\",\"ServerInfo\":[{\"No\":1,\"Name\":\"112.124.54.108\",\"IP\":\"112.124.54.108\",\"Port\":8000,\"ActorNumber\":3,\"Status\":1},{\"No\":2,\"Name\":\"192.168.0.190\",\"IP\":\"192.168.0.190\",\"Port\":8000,\"ActorNumber\":150,\"Status\":2},{\"No\":3,\"Name\":\"192.168.2.91\",\"IP\":\"192.168.2.91\",\"Port\":8000,\"ActorNumber\":150,\"Status\":3},{\"No\":4,\"Name\":\"192.168.0.40\",\"IP\":\"192.168.0.40\",\"Port\":8000,\"ActorNumber\":150,\"Status\":1},{\"No\":5,\"Name\":\"192.168.3.21\",\"IP\":\"192.168.3.21\",\"Port\":8000,\"ActorNumber\":150,\"Status\":0},{\"No\":6,\"Name\":\"192.168.1.67\",\"IP\":\"192.168.1.67\",\"Port\":8000,\"ActorNumber\":150,\"Status\":0},{\"No\":7,\"Name\":\"127.0.0.1\",\"IP\":\"127.0.0.1\",\"Port\":8000,\"ActorNumber\":3,\"Status\":1},{\"No\":8,\"Name\":\"192.168.2.62\",\"IP\":\"192.168.2.62\",\"Port\":8000,\"ActorNumber\":3,\"Status\":1}]}"; var jsonBackObj = JsonConvertor <PhpBackObj> .Json2Object(testJson); if (OnLoginComplete != null) { OnLoginComplete(jsonBackObj); } else { TraceUtil.Log("没有监听Php服务返回事件"); } }
IEnumerator PurchaseThroughPHP() { StringBuilder sb = new StringBuilder(payUrl); //sb.Append("?servIp=").Append(LoginManager.Instance.LoginSSActorInfo.SZServerIP); //sb.Append("&servPort=").Append(LoginManager.Instance.LoginSSActorInfo.wPort.ToString()); sb.Append("?actorId=").Append(LoginManager.Instance.LoginSSActorInfo.lActorID.ToString()); sb.Append("&gameWorldId=").Append(JHPlatformConnManager.Instance.GameWorldId.ToString()); sb.Append("&platformMoneyNum=").Append(CurrencyNum.ToString()); sb.Append("&payNum=").Append(GoldNum.ToString()); sb.Append("&openid=").Append(PlayerInfo["openid"]); sb.Append("&openkey=").Append(PlayerInfo["accessToken"]); sb.Append("&pay_token=").Append(PlayerInfo["payToken"]); sb.Append("&pf=").Append(PlayerInfo["pf"]); sb.Append("&pfkey=").Append(PlayerInfo["pfkey"]); sb.Append("&zoneid=1"); sb.Append("&mediaType=1"); //1:QQ 2: WX(微信) string wholeUrl = sb.ToString(); string sig = HMACSHAEncoding(wholeUrl.Substring(wholeUrl.IndexOf("/tencent")), TencentConfigData.appKey + "&"); sb.Append("&sig=").Append(sig); //Debug.Log("url = " + sb.ToString()); WWW www = new WWW(sb.ToString()); LoadingUI.Instance.Show(); yield return(www); LoadingUI.Instance.Close(); if (www.isDone) { if (!string.IsNullOrEmpty(www.error)) { TraceUtil.Log("网络错误。。。。"); OnPurchaseResult(null); yield break; } } //Debug.Log("//////////////////payment msg = " + www.text); var purchaseInfo = JsonConvertor <PurchaseInfo> .Json2Object(www.text); if (purchaseInfo != null) { OnPurchaseResult(purchaseInfo); } }
private IEnumerator AuthorPHP() { WWW www = new WWW(string.Format(m_UCConfigData.PhpLoginAuthorURL, m_sid)); yield return(www); if (www.isDone) { if (OnRequestPHPBackResult != null) { var jsonBackObj = JsonConvertor <PhpBackObj> .Json2Object(www.text.Replace("\"", "'")); OnRequestPHPBackResult(jsonBackObj); } } }
private IEnumerator AuthorPHP() { WWW www = new WWW("http://jh.fanhougame.net/xiaomi/loginCheck.php"); yield return(www); if (www.isDone) { if (OnRequestPHPBackResult != null) { var jsonBackObj = JsonConvertor <PhpBackObj> .Json2Object(www.text.Replace("\"", "'")); PlatformLoginBehaviour.message += "jsonBackObj:: " + jsonBackObj; OnRequestPHPBackResult(jsonBackObj); } } }
IEnumerator CheckBalance() { StringBuilder sb = new StringBuilder(balanceUrl); sb.Append("?openid=").Append(PlayerInfo["openid"]); sb.Append("&openkey=").Append(PlayerInfo["accessToken"]); sb.Append("&pay_token=").Append(PlayerInfo["payToken"]); sb.Append("&pf=").Append(PlayerInfo["pf"]); sb.Append("&pfkey=").Append(PlayerInfo["pfkey"]); sb.Append("&zoneid=1"); sb.Append("&mediaType=1"); //1:QQ 2: WX(微信) string wholeUrl = sb.ToString(); string sig = HMACSHAEncoding(wholeUrl.Substring(wholeUrl.IndexOf("/tencent")), TencentConfigData.appKey + "&"); sb.Append("&sig=").Append(sig); //Debug.Log("url = " + sb.ToString()); WWW www = new WWW(sb.ToString()); yield return(www); if (www.isDone) { if (!string.IsNullOrEmpty(www.error)) { TraceUtil.Log("网络错误。。。。"); if (OnBalanceResult != null) { OnBalanceResult(null); } yield break; } } //Debug.Log("//////////////////payment msg = " + www.text); var purchaseInfo = JsonConvertor <PurchaseInfo> .Json2Object(www.text); //Debug.Log("msg = " + purchaseInfo.balance); if (purchaseInfo != null && OnBalanceResult != null) { OnBalanceResult(purchaseInfo); } }
private IEnumerator AuthorPHP() { WWW www = new WWW(serverListUrl); yield return(www); if (www.isDone) { if (!string.IsNullOrEmpty(www.error)) { TraceUtil.Log("www error = " + www.error); if (OnRequestPHPResult != null) { OnRequestPHPResult(null); } yield break; } //m_message="Statue:"+www.error; //m_message+=www.text; //Debug.Log("Serverinfo = " + www.text); if (OnRequestPHPResult != null) { //Debug.Log("OnRequestPHPResult not null"); PlatformLoginBehaviour.message = "PHP BackInfo:" + www.text.Replace("\"", "'"); var jsonBackObj = JsonConvertor <PhpBackObj> .Json2Object(www.text.Replace("\"", "'")); if (jsonBackObj != null) { PlatformLoginBehaviour.message += jsonBackObj.ServerInfo.Length; //Debug.Log("json convert right ........."); OnRequestPHPResult(jsonBackObj); } //else //{ //Debug.Log("json convert wrong....."); //Debug.Log("show again = " + www.text); //} } //else //{ // Debug.Log("OnRequestPHPResult is null"); //} } }
private IEnumerator AuthorPHP(string tokenKey, string tokenSecret) { WWW www = new WWW("http://jh.fanhougame.net/oppo/demo.php?tokenSecret=" + tokenSecret + "&token=" + tokenKey); yield return(www); if (www.isDone) { //m_message="Statue:"+www.error; //m_message+=www.text; if (OnRequestPHPResult != null) { PlatformLoginBehaviour.message = "PHP BackInfo:" + www.text.Replace("\"", "'"); var jsonBackObj = JsonConvertor <PhpBackObj> .Json2Object(www.text.Replace("\"", "'")); PlatformLoginBehaviour.message += jsonBackObj.ServerInfo.Length; OnRequestPHPResult(jsonBackObj); } } }