void RequestFailure() { //Debug.Log("request failure"); _requestFailure = true; LoadingAlert.FinishLoading(); HTTPAlert.Present("HTTP Error", "Could not connect to the game server. Check your internet connection", null, null, true); }
void SetToken(string json) { Debug.Log("SetToken with " + json); TokenResponseData tokenResponseData = JsonConvert.DeserializeObject <TokenResponseData>(json); //Debug.Log("setting token - " + json); if (tokenResponseData.status == "ok") { Token = tokenResponseData.token; _playerID = tokenResponseData.player_id; } else { HTTPAlert.Present("Error", "Login failed", null, null, true); } }
IEnumerator SignIn() { OnlineManager.Instance.SetServer(); yield return(StartCoroutine(OnlineManager.Instance.StartLogin(_username, _password))); //Debug.Log(OnlineManager.Token); if (OnlineManager.Token != null && OnlineManager.Token != "") { yield return(StartCoroutine(OnlineManager.Instance.StartGetPlayer(OnlineManager._playerID))); if (OnlineManager.Instance.PlayerReponseData.player.gamemaster) { GameManager.Client = false; SceneManager.LoadScene("Moderator"); } if (!OnlineManager.Instance.GetRequestFailure) { if (OnlineManager.Instance.PlayerID == null || OnlineManager.Instance.PlayerReponseData.status != "ok") { LoadingAlert.FinishLoading(); HTTPAlert.Present("Login Error", OnlineManager.Instance.Error, null, null, true); } else { yield return(StartCoroutine(OnlineManager.Instance.StartGetGame())); yield return(StartCoroutine(OnlineManager.Instance.StartGetGear())); Database.Instance.BuildAllData(); Database.Instance.BuildGearList(); PathManager.Instance.Initialize(); if (!Avatar.Instance.Embodied) { UIViewController.ActivateUIView(AvatarCreationView.Load()); UIViewController.ActivateUIView(AvatarStatsView.Load()); } LoadingAlert.FinishLoading(); Deactivate(); } } } }
void DisplayError(Dictionary <string, object> dict) { _error = ""; string message = ""; if (dict != null) { message = dict["message"].ToString(); _error = dict["message"].ToString(); } else { message = "Error fetching data from server"; } //Debug.Log("presenting error"); LoadingAlert.FinishLoading(); HTTPAlert.Present("Error", message, null, null, true); }