private IEnumerator ServerRequest(WWW www) { yield return(www); if (www.error == null) { string response = www.text; Debug.Log("response " + response); try { JSONNode node = JSON.Parse(response); loading.SetActive(false); if (node != null) { string result = node["status"]; if (result.Equals("OK")) { NoFriendFound.SetActive(false); JSONNode FrndList = node["data"]; Debug.Log("count " + FrndList.Count); for (int i = 0; i < FrndList.Count; i++) { JSONNode data = FrndList[i]; string FrndName = data["name"]; string MyID = data["id"]; string myImage = data["image"]; GameObject newCell = Instantiate(cell); newCell.transform.SetParent(container.transform); newCell.transform.localScale = new Vector3(1, 1, 1); // newCell.GetComponent<FacebookFriendCell>().UpdateCell(MyID, FrndName, myImage, false); } } else { NoFriendFound.SetActive(true); GameConstantData.showToast(transform, node["message"]); } } else { NoFriendFound.SetActive(true); } } catch (System.Exception ex) { Debug.Log(ex.Message); } } else { NoFriendFound.SetActive(true); loading.SetActive(false); } }
public void PlayNow() { //print ("coin is " + coin); if (coin > 0) { GameConstantData.entryFee = coin; SceneManager.LoadSceneAsync("GameScene"); } else { GameConstantData.showToast(transform, "First select the coin to start game."); } }
void searchTable() { if (PlayerPrefs.GetInt(LudoTags.ENTRY_FEE) <= int.Parse(PlayerPrefs.GetString(GetPlayerDetailsTags.PLAYER_COIN))) { Debug.Log("Search Game Room"); Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add(LudoTags.GAME_TYPE, PlayerPrefs.GetInt(LudoTags.GAME_TYPE)); dic.Add(LudoTags.ENTRY_FEE, PlayerPrefs.GetInt(LudoTags.ENTRY_FEE)); dic.Add(LudoTags.ROOM_TYPE, PlayerPrefs.GetInt(LudoTags.ROOM_TYPE)); dic.Add(LudoTags.USER_LIMIT, PlayerPrefs.GetInt(LudoTags.USER_LIMIT)); dic.Add(LudoTags.GOTI_LIMIT, PlayerPrefs.GetInt(LudoTags.GOTI_LIMIT)); dic.Add(Tags.DOMAIN, Tags.URL); WarpClient.GetInstance().JoinRoomWithProperties(dic); } else { GameConstantData.showToast("You do not have sufficient coin."); } }
public void createTable() { if (PlayerPrefs.GetInt(LudoTags.ENTRY_FEE) <= int.Parse(PlayerPrefs.GetString(GetPlayerDetailsTags.PLAYER_COIN))) { Debug.Log("Create Game Room"); Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add(LudoTags.GAME_TYPE, PlayerPrefs.GetInt(LudoTags.GAME_TYPE)); dic.Add(LudoTags.ENTRY_FEE, PlayerPrefs.GetInt(LudoTags.ENTRY_FEE)); dic.Add(LudoTags.ROOM_TYPE, PlayerPrefs.GetInt(LudoTags.ROOM_TYPE)); dic.Add(LudoTags.USER_LIMIT, PlayerPrefs.GetInt(LudoTags.USER_LIMIT)); dic.Add(LudoTags.GOTI_LIMIT, PlayerPrefs.GetInt(LudoTags.GOTI_LIMIT)); dic.Add(Tags.DOMAIN, Tags.URL); WarpClient.GetInstance().CreateRoom("New Room", "ludo", PlayerPrefs.GetInt(LudoTags.USER_LIMIT), dic); } else { GameConstantData.showToast("You do not have sufficient coin."); } }
public void CreateTableAction() { if (coin > 0) { if (coin <= int.Parse(PlayerPrefs.GetString(GetPlayerDetailsTags.PLAYER_COIN))) { PlayerPrefs.SetInt(LudoTags.ENTRY_FEE, coin); if (PlayerPrefs.GetInt(LudoTags.ROOM_TYPE) == LudoTags.PRIVATE) { PlayerPrefs.SetString(GameTags.PRIVATE_TABLE_TYPE, GameTags.CREATE_TABLE); } // SceneManager.LoadSceneAsync("GameScene"); } else { GameConstantData.showToast("You do not have sufficient coin."); } } else { GameConstantData.showToast("first select the coin to start game?"); } }
private IEnumerator ServerRequestRedeem(WWW www) { yield return(www); if (www.error == null) { loading.SetActive(false); string response = www.text; try{ Debug.Log("Responce " + response); JSONNode node = JSON.Parse(response); loading.SetActive(false); if (node != null) { string status = node["status"]; JSONNode data = node["data"]; //Debug.Log ("Data1 " + data1); Debug.Log("Data " + data.ToString()); Debug.Log("status " + status); if (status.Equals("OK")) { if (data.Count <= 0) { NoRecord.SetActive(true); } else { NoRecord.SetActive(false); } for (int i = 0; i < data.Count; i++) { string status_type = ""; JSONNode userHis = data[i]; string amount = userHis["amount"]; string date = userHis["date"]; string status_str = userHis["status"]; if (status_str.Equals("1")) { status_type = "success"; } else { status_type = "Failed"; } GameObject newCell = Instantiate(redeem_cell); newCell.transform.SetParent(container.transform); newCell.transform.localScale = new Vector3(1, 1, 1); // newCell.GetComponent<RedeemCell>().UpdateCell(amount, date, status_type); } } else { //print ("failed?"); NoRecord.SetActive(true); GameConstantData.showToast(transform, node["message"]); } } } catch (System.Exception ex) { Debug.Log(ex.Message); } } else { loading.SetActive(false); } }