// DH change public void ProcessConvergeBetUpdate (NetworkResponse response) { ResponseConvergeBetUpdate args = response as ResponseConvergeBetUpdate; Debug.Log ("In responseconvergebetupdate"); won = args.winStatus; wonAmount = args.wonAmount; Debug.Log ("won/wonamount: " + won + " " + wonAmount); if (betAccepted) { Debug.Log ("Bet accepted"); if (won == 1) { Debug.Log ("you won"); balance = balance + wonAmount - bet; } else { Debug.Log ("you lost"); balance -= bet; } } else { // this person did not play Debug.Log("You did not play this round"); won = -1; // signals he did not play } results = true; betAccepted = false; windowClosed = false; closedResponseSent = false; Debug.Log ("new balance: " + balance); }
public static NetworkResponse Parse(MemoryStream dataStream) { ResponseConvergeBetUpdate response = new ResponseConvergeBetUpdate(); using (BinaryReader br = new BinaryReader(dataStream, Encoding.UTF8)) { short winStatus = br.ReadInt16(); int wonAmount = br.ReadInt32(); // winStatus = 1 -> won round, 0 -> lost round, or didn't play response.winStatus = winStatus; response.wonAmount = wonAmount; } return(response); }