private IEnumerator PrizeBoop() { //for prize get..................................................................... socket.path = "draw/draw.do"; AwardGetReq reqGet = new AwardGetReq(); reqGet.activityId = int.Parse(activeId.text); reqGet.mobile = mobile.text; reqGet.step = int.Parse(activityStep.text); socket.EmitRawMessage(reqGet.ToJsonStirng()); // wait 3 seconds and continue output.text = "Please wait for 3 seconds......"; yield return(new WaitForSeconds(1)); //wait for response JSONObject resObj = socket.GetResponseJsonObject(); while (resObj == null) //wait for all the time... { Debug.Log("[SocketIO] AwardBoop null, no response! "); output.text = "[SocketIO] AwardBoop null, no response!"; resObj = socket.GetResponseJsonObject(); yield return(new WaitForSeconds(1)); //yield return null; //yield break; } //while( resObj == null ) resObj = socket.GetResponseJsonObject(); AwardGetRsp rspGet = new AwardGetRsp(); rspGet.ParseJsonObject(resObj); Debug.Log("[SocketIO] AwardBoop resultCode: " + rspGet.Result); output.text = "[SocketIO] AwardBoop resultCode: " + rspGet.Result; if (0 == rspGet.Result) { output.text += " awardId:" + rspGet.awardId; output.text += " awardLevel:" + rspGet.awardLevel; output.text += " awardName:" + rspGet.awardName; output.text += " awardType:" + rspGet.awardType; } }
//award loop .... private IEnumerator AwardBoop() { // wait 1 seconds and continue yield return(new WaitForSeconds(1)); AwardReq req = new AwardReq(); req.activityId = 9900002; req.mobile = "13802881234"; socket.EmitRawMessage(req.ToJsonStirng()); //socket.EmitBet("{GameAccountRegisterReq: {Name: 'leaftest6',Password: '******'}}"); // wait 3 seconds and continue yield return(new WaitForSeconds(5)); //wait for response JSONObject resObj = socket.GetResponseJsonObject(); if (resObj == null) { Debug.Log("[SocketIO] AwardBoop null, no response! "); yield return(null); yield break; } //while( resObj == null ) resObj = socket.GetResponseJsonObject(); AwardRsp rsp = new AwardRsp(); rsp.ParseJsonObject(resObj); Debug.Log("[SocketIO] AwardBoop resultCode: " + rsp.Result); //for prize get..................................................................... socket.path = "draw/draw.do"; AwardGetReq reqGet = new AwardGetReq(); reqGet.activityId = 9900002; reqGet.mobile = "13802881234"; socket.EmitRawMessage(reqGet.ToJsonStirng()); // wait 5 seconds and continue yield return(new WaitForSeconds(5)); //wait for response resObj = socket.GetResponseJsonObject(); if (resObj == null) { Debug.Log("[SocketIO] AwardBoop null, no response! "); yield return(null); yield break; } //while( resObj == null ) resObj = socket.GetResponseJsonObject(); AwardGetRsp rspGet = new AwardGetRsp(); rspGet.ParseJsonObject(resObj); Debug.Log("[SocketIO] AwardBoop resultCode: " + rspGet.Result); // wait ONE FRAME and continue //yield return null; }