/** * Timer for rebuy chips in tournament * */ // private IEnumerator reBuyChipTimerOff(string sender){ // yield return new WaitForSeconds (GameConstant.TOURNAMENT_REBUY_TIMER); // // if (sender.Equals (appwarp.TEXASS_SERVER_NAME)) // texassGameManager.canReBuy = false; //// else //// waGameManager.distributeCards (); // // } private void sendGameType(int amt) { JSON_Object jsonObject = new JSON_Object(); jsonObject.put(GameConstant.TAG_SMALL_BLIEND_AMOUNT, amt); jsonObject.put(GameConstant.TAG_GAME_TYPE, appwarp.GAME_TYPE); WarpClient.GetInstance().SendChat(GameConstant.REQUEST_FOR_BLIEND_AMOUNT + jsonObject.ToString()); }
// Use this for initialization void Start() { JSON_Object jo1 = new JSON_Object(); jo1.put("count", 1); jo1.increment("count"); Debug.Log("Should print 2: " + jo1.getInt("count")); JSON_Object jo2 = new JSON_Object("{\"quote\": \"He said, \\\"I like JSON\\\"\"}"); Debug.Log("Should print an escaped quote: " + jo2.toString()); JSONArray ja1 = new JSONArray(); ja1.put(jo1); ja1.put(jo2); Debug.Log("Should print count 2, and an escaped quote: " + ja1.toString()); JSON_Object jo3 = ja1.getJSONObject(1); Debug.Log("Should print the same escaped quote: " + jo3.toString()); string twitterTest = "{\"errors\": [{\"message\": \"The Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.\", \"code\": 68}]}"; JSON_Object jo4 = new JSON_Object(twitterTest); JSONArray ja2 = jo4.getJSONArray("errors"); string message = ja2.getJSONObject(0).getString("message"); int code = ja2.getJSONObject(0).getInt("code"); Debug.Log(message + " code: " + code); }
private void sendPlayerActionToServer(int betAmount, int action) { iTween.Stab(gameObject, iTween.Hash("audioclip", buttonAudio, "pitch", 1)); raiseValue = 0; lastPlayerBetAmt = 0; SliderChips.value = 0f; SliderChips.enabled = false; gameObjectManager.getBetAmountText().text = GameConstant.CURRENCY + raiseValue; JSON_Object requestJson = new JSON_Object(); try { requestJson.put(GameConstant.TAG_PLAYER_NAME, appwarp.username); requestJson.put(GameConstant.TAG_BET_AMOUNT, betAmount); requestJson.putOpt(GameConstant.TAG_ACTION, action); //setPlayerBetAmount(appwarp.username,betAmount); WarpClient.GetInstance().sendMove(GameConstant.REQUEST_FOR_ACTION + requestJson.ToString()); } catch (Exception e) { Debug.Log("GameManager : " + e.ToString()); } }
protected static JSON_Object ParseObject(char[] json, ref int index, ref bool success) { JSON_Object table = new JSON_Object(); int token; // { NextToken(json, ref index); bool done = false; while (!done) { token = LookAhead(json, index); if (token == TOKEN_NONE) { success = false; return(null); } else if (token == TOKEN_COMMA) { NextToken(json, ref index); } else if (token == TOKEN_CURLY_CLOSE) { NextToken(json, ref index); return(table); } else { // name string name = ParseString(json, ref index, ref success); if (!success) { success = false; return(null); } // : token = NextToken(json, ref index); if (token != TOKEN_COLON) { success = false; return(null); } // value object value = ParseValue(json, ref index, ref success); if (!success) { success = false; return(null); } if (value is bool) { table.put(name, (bool)value); } else if (value is double) { table.put(name, (double)value); } else if (value is int) { table.put(name, (int)value); } else if (value is long) { table.put(name, (long)value); } else if (value is string) { table.put(name, (string)value); } else if (value is JSON_Object) { table.put(name, (JSON_Object)value); } else if (value is JSONArray) { table.put(name, (JSONArray)value); } // else // Debug.LogError("JSONObject ParseObject unknown type for array.put()"); } } return(table); }