private void OnCheckConnectionOk() { // All OK Msg.Log("LoginScreenController.OnCheckConnectionOk callback was called"); _connCheckState = ConnCheckState.NetworkCheckPassed; ConnectionLog.text = "Internet connection ok."; // to be safe, the logic to enable buttons has been moved to update() }
private void OnCheckConnectionFail() { // Fail Msg.Log("LoginScreenController.OnCheckConnectionFail callback was called"); _connCheckState = ConnCheckState.NetworkCheckFailed; ConnectionLog.text = "No internet connection found, will keep trying. Try the offline demo?"; // Try again Invoke("CheckConnectionInvokable", 5f); }
// Use this for initialization void Start() { // Do the fade, always FadeSetupAndActivate(); // Check for cardboard being available in the project build (eg it is there for Android, prob iOS, but not Windows, Mac) string[] d = UnityEngine.XR.XRSettings.supportedDevices; for (int i = 0; i < d.Length; i++) { Msg.Log("VRSettings.supportedDevices: " + d[i]); if (d[i] == "cardboard") { _cardboardAvailable = true; } } // Called from login scene LabelVersion.text = GetVersion(); // Defaults _connCheckState = ConnCheckState.Idle; _connLog = ""; ConnectionLog.text = ""; Instructions.text = ""; // Only offer cardboard if we found it in the build OptionA_ViewVr.interactable = _cardboardAvailable; //OptionC_ShowOff.interactable = false; _letsGoApprovedIsInProgress = false; // Try to get stored value InputField_AddrTx.text = PlayerPrefs.GetString(c_addr_or_tx_value, ""); AutoGrowDropdown.value = PlayerPrefs.GetInt(c_auto_grow_Depth, 2); // index 2 means depth 3, a fair default I think // Any remote settings? if (NewsText != null) { NewsText.text = ""; } RemoteSettings.Updated += new RemoteSettings.UpdatedEventHandler(OnRemoteUpdate); CheckConnectionInvokable(); }
/// <summary> /// May be called by invoke /// </summary> private void CheckConnectionInvokable() { _connCheckState = ConnCheckState.NetworkCheck; Msg.Log("Checking internet connection..."); _iAdaptor.CheckConnectionPossible(() => OnCheckConnectionOk(), () => OnCheckConnectionFail()); }
private void CheckConnection() { _connLog = ""; if (_epmIsOfflineToEdit) { GameManager.Instance.SetOffineMode(_epmIsOfflineToEdit); } // Trigger the first connection check _connCheckState = ConnCheckState.NetCheck; ConnLog("Checking internet connection..."); // This asynchronously raises event when NetCheck done, and we've hooked event OnConnNetCheckReturned // to process results and trigger next check GameManager.Instance.GetConnData_NetCheck(); // this just for testing //_isItOkToPressPlayButton = true; }
// Use this for initialization void Start() { GameManager.Instance.OnConnNetCheckReturned += OnConnNetCheckReturned; GameManager.Instance.OnServerUpReturned += OnServerUpReturned; GameManager.Instance.OnLoginCredReturned += OnLoginCredReturned; GameManager.Instance.OnVerDetReturned += OnVerDetReturned; _connCheckState = ConnCheckState.Idle; // if this flag in inspector is false, we must have been called from real GameLogin scene if (_isRunImmediatelySkipGui == false) { GameLogin.IsCalledFromLoginScreen = true; } // these defaults also set by the "set to defaults" button SetDefaults(); // game version contains version info #if UNITY_EDITOR _gameVersion += ": Editor"; #elif UNITY_WEBPLAYER _gameVersion += ": Web Player"; #elif UNITY_STANDALONE _gameVersion += ": Standalone"; #else _gameVersion += ": Unknown"; #endif if (_isRunImmediatelySkipGui) { // cant set this, it means later calls appear to be offline _epmIsOfflineToEdit = true; _sceneToLoadWhenFinished = null; // if we are skipping gui, leave scene alone StartGame(); } }
private void OnVerDetReturned(object sender, VerDetEventArgs vdea) { HanaVersion hv = vdea.HanaVer; WwwResponse r = GameManager.Instance.GetConnResponse_VerDet(hv); if (String.IsNullOrEmpty(r.WwwError)) { // Version determination was ok _hanaVersion = hv; ConnLog("Version " + hv.ToString() + " is supported"); // Checks are now complete _connCheckState = ConnCheckState.CheckPassed; ConnLog("Checks complete, please press Start button!"); _isItOkToPressPlayButton = true; } else { // Check failed, either start a new version check or if we have exhausted // supported versions then report failure switch (hv) { case HanaVersion.v1_00_60: ConnLog("HANA version is not supported"); _connCheckState = ConnCheckState.CheckFailed; break; case HanaVersion.v1_00_70: // Trigger the next version check ConnLog("Check for version " + HanaVersion.v1_00_60.ToString()); GameManager.Instance.GetConnData_VerDet(HanaVersion.v1_00_60, _epmHostToEdit, _epmInstanceToEdit); break; case HanaVersion.v1_00_72: // Trigger the next version check ConnLog("Check for version " + HanaVersion.v1_00_70.ToString()); GameManager.Instance.GetConnData_VerDet(HanaVersion.v1_00_70, _epmHostToEdit, _epmInstanceToEdit); break; default: break; } } }
private void OnServerUpReturned(object sender, EventArgs e) { WwwResponse r = GameManager.Instance.GetConnResponse_ServerUp(); //print("GameLogin has received event OnConnNetCheckReturned, it contained" + r.WwwError); if (String.IsNullOrEmpty(r.WwwError)) { ConnLog("HANA server pinged ok"); // Trigger the next connection check _connCheckState = ConnCheckState.LoginCred; ConnLog("Checking login credentials..."); GameManager.Instance.StartGamePartial(_epmHostToEdit, _epmInstanceToEdit, _usernameToEdit, _passwordToEdit); GameManager.Instance.GetConnData_LoginCred(); } else { ConnLog("HANA server ping failed, error: " + r.WwwError); _connCheckState = ConnCheckState.CheckFailed; ConnLog("If the internet connection check was ok, this means host or instance is wrong, or server is down"); } }
private void OnLoginCredReturned(object sender, EventArgs e) { WwwResponse r = GameManager.Instance.GetConnResponse_LoginCred(); if (String.IsNullOrEmpty(r.WwwError)) { ConnLog("Login credentials ok"); // Trigger the next connection check _connCheckState = ConnCheckState.VerDet; ConnLog("Checking HANA version..."); ConnLog("Check for version " + HanaVersion.v1_00_72.ToString()); GameManager.Instance.GetConnData_VerDet(HanaVersion.v1_00_72, _epmHostToEdit, _epmInstanceToEdit); } else { ConnLog("Login credentials not ok, error: " + r.WwwError); ConnLog("Cause is usually incorrect username or password, or the user missing authorisations for EPM demo content"); _connCheckState = ConnCheckState.CheckFailed; } }
private void OnConnNetCheckReturned(object sender, EventArgs e) { WwwResponse r = GameManager.Instance.GetConnResponse_NetCheck(); //print("GameLogin has received event OnConnNetCheckReturned, it contained" + r.WwwError); if (String.IsNullOrEmpty(r.WwwError)) ConnLog("Internet connection ok"); else { ConnLog("Internet connection not ok, error: " + r.WwwError); ConnLog("Internet connection might be being blocked by a firewall?"); } // Trigger the next connection check _connCheckState = ConnCheckState.ServerUp; ConnLog("Checking to see if HANA server can be pinged..."); GameManager.Instance.GetConnData_ServerUp(_epmHostToEdit, _epmInstanceToEdit); }