private IEnumerator PrizeChanceBoop() { AwardReq req = new AwardReq(); req.activityId = int.Parse(activeId.text); req.mobile = mobile.text; req.step = int.Parse(activityStep.text); socket.EmitRawMessage(req.ToJsonStirng()); //socket.EmitBet("{GameAccountRegisterReq: {Name: 'leaftest6',Password: '******'}}"); // wait 3 seconds and continue output.text = "Please wait for 3 seconds......"; yield return(new WaitForSeconds(3)); //wait for response JSONObject resObj = socket.GetResponseJsonObject(); while (resObj == null) { 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(); AwardRsp rsp = new AwardRsp(); rsp.ParseJsonObject(resObj); Debug.Log("[SocketIO] AwardBoop resultCode: " + rsp.Result); output.text = "[SocketIO] AwardBoop resultCode: " + rsp.Result; }
//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; }