// Use this for initialization Successfully bid for game You don't have sufficient balance for bid public void CreateRoomMethod() { print("CreateRoomMethod"); if (GameLobbyName.Length == 0) { StartCoroutine(WarningForRoom("PLEASE SELECT THE Amount", 1)); } else if (GameLobbyName.Equals("nothing")) { StartCoroutine(WarningForRoom("You don't have sufficient balance for bid", 2)); } else if (Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork || Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork) { foreach (GameObject go in Amounts) { go.GetComponent <Toggle> ().interactable = false; } CreateRoomButton.GetComponent <Button> ().interactable = false; LoadingImage.SetActive(true); if (PhotonNetwork.AuthValues == null) { PhotonNetwork.AuthValues = new Photon.Realtime.AuthenticationValues(); } string PlayerName = PlayerPrefs.GetString("username"); PhotonNetwork.AuthValues.UserId = PlayerName; PhotonNetwork.LocalPlayer.NickName = PlayerName; PhotonNetwork.ConnectUsingSettings(); } }
public void AmountSelectionMethod() { print("AmountSelectionMethod"); GameLobbyName = EventSystem.current.currentSelectedGameObject.name; LoadingImage.SetActive(true); CreateRoomButton.SetActive(false); StartCoroutine(AmountCheckingBeforeEntering()); }
IEnumerator AmountCheckingBeforeEntering() { print("AmountCheckingBeforeEntering"); UnityWebRequest www = new UnityWebRequest("http://apienjoybtc.exioms.me/api/Balance/balancefetch?userid=" + PlayerPrefs.GetString("userid") + "&gamesessionid=1&dblbidamt=" + GameLobbyName); www.chunkedTransfer = false; www.downloadHandler = new DownloadHandlerBuffer(); yield return(www.SendWebRequest()); if (www.error != null) { print("Something went Wrong"); } string msg = www.downloadHandler.text; msg = msg.Substring(1, msg.Length - 2); JSONNode jn = SimpleJSON.JSONData.Parse(msg); msg = null; msg = jn [0]; if (msg.Equals("Successful")) { print("GameLobbyName:" + GameLobbyName); print("Have enough balance"); StartCoroutine(WarningForRoom("You can bid", .5f)); CreateRoomButton.SetActive(true); LoadingImage.SetActive(false); } else if (msg.Equals("Youdon'thavesufficientbalanceforbid")) { print("You don't have sufficient balance for bid"); CreateRoomButton.SetActive(true); GameLobbyName = null; GameLobbyName = "nothing"; StartCoroutine(WarningForRoom("You don't have sufficient balance for bid", 2)); } }