private void GoForwardToNextStep(int iauId) { // release the lock of the current IAU currentIau.iau_locked = "0"; StartCoroutine(UpdateIauLocked(currentIau)); // Go to the next IAU base on the flow table for (int i = 0; i < flowEntries.Count; i++) { FlowEntry flow = flowEntries[i]; if (flow.current_iau_id.Equals(currentIau.iau_id)) { if (flow.future_iau_id != null) { StartCoroutine(GetIAUById(flow.future_iau_id)); // lock the future Iau StartCoroutine(UpdateIauLocked(flow.future_iau_id, "1")); // play sound effect noticing the Astronaut of the update PlaySoundEffect(TelemetryController.SOUND_EFFECT_COMPLETE, false); } else { GameObject btn = GameObject.FindGameObjectWithTag("confirm_button"); if (btn != null) { btn.GetComponent <Button>().interactable = false; btn.GetComponentInChildren <Text>().text = "End"; } } break; } } }
private IEnumerator WaitForCompletionAndGoForward(int iauId) { if (!currentIau.iau_confirm_level.Equals("3")) { string hostName = ConnectionController.HOST_NAME; string url = "http://" + hostName + "/NasaSuits/api/eva/iau/GetIAU.php?iau_id=" + iauId; WWW response = new WWW(url); yield return(response); IAU iau = null; try { iau = JsonConvert.DeserializeObject <IAU>(response.text); } catch (Exception e) { Debug.Log("Exception while parsiong Json object " + response.text); Debug.Log(e); } if (iau != null && !iau.iau_completed.Equals("1")) { RemoveAllIAUContent(); DisplayLoadingScene("IAU " + currentIau.iau_step + "." + currentIau.iau_sub_step + ": " + currentIau.iau_high_level_action + " is checking by Flight Crews and Groung Crews.\nWaiting for Completion status"); } // wait until the IAU is marked completed by Flight Crews or Ground Crews WaitForSeconds waitTime = new WaitForSeconds(1); while (iau != null && !iau.iau_completed.Equals("1")) { Debug.Log("IAU is waiting for Completion"); response = new WWW(url); yield return(response); try { iau = JsonConvert.DeserializeObject <IAU>(response.text); } catch (Exception e) { Debug.Log("Exception while parsiong Json object " + response.text); Debug.Log(e); } yield return(waitTime); } // When the IAU is marked completed // Remove the loading scene RemoveLoadingScene(); } // release the lock of the current IAU currentIau.iau_locked = "0"; StartCoroutine(UpdateIauLocked(currentIau)); // Go to the next IAU base on the flow table for (int i = 0; i < flowEntries.Count; i++) { FlowEntry flow = flowEntries[i]; if (flow.current_iau_id.Equals(currentIau.iau_id)) { if (flow.future_iau_id != null) { StartCoroutine(GetIAUById(flow.future_iau_id)); // lock the future Iau StartCoroutine(UpdateIauLocked(flow.future_iau_id, "1")); // play sound effect noticing the Astronaut of the update PlaySoundEffect(TelemetryController.SOUND_EFFECT_COMPLETE, false); } else { GameObject btn = GameObject.FindGameObjectWithTag("confirm_button"); if (btn != null) { btn.GetComponent <Button>().interactable = false; btn.GetComponentInChildren <Text>().text = "End"; } } break; } } }