Beispiel #1
0
 // Start is called before the first frame update
 void Start()
 {
     if (ownIPField != null)
     {
         ownIPField.text = BMANetworkController.LocalIPAddress();
     }
     if (ipField != null)
     {
         ipField.text = GameObject.FindGameObjectWithTag("NetworkController").GetComponent <NetworkManager>().networkAddress;
     }
 }
Beispiel #2
0
    public void openScreen()
    {
        switch (EventSystem.current.currentSelectedGameObject.name)
        {
        //Main Menu
        case "Simulate_Btn":
            //EditorUtility.DisplayDialog("Button Name", "Simulation", "OKAY");
            SceneManager.LoadScene("Simulation_Scrn");
            break;

        case "Tutorial_Btn":
            SceneManager.LoadScene("Tutorial_Scrn");
            break;

        case "Evaluate_Btn":
            //EditorUtility.DisplayDialog("Button Name", "Evaluation", "OKAY");
            break;

        case "Manual_Btn":
            SceneManager.LoadScene("Manual_Scrn");
            break;

        case "Input_Btn":
            //EditorUtility.DisplayDialog("Button Name", "Eingabe", "OKAY");
            break;

        case "Instruction_Btn":
            //EditorUtility.DisplayDialog("Button Name", "Handbuch", "OKAY");
            break;

        //Simulation Menu
        case "Team_Btn":
            //EditorUtility.DisplayDialog("Button Name", "Team", "OKAY");
            SceneManager.LoadScene("Teacher_Student_Scrn");
            break;

        case "Single_Btn":
            //EditorUtility.DisplayDialog("Button Name", "Single", "OKAY");
            GlobalSettings.Instance.clientType = GlobalSettings.ClientType.SinglePlayer;
            SceneManager.LoadScene("ScenarioSelection_Scrn");
            break;

        case "Partner_Btn":
            //EditorUtility.DisplayDialog("Button Name", "Partner", "OKAY");
            break;

        case "Trainer_Btn":
            //Trainer-Rolle speichern

            //nächsten Screen aufrufen
            GlobalSettings.Instance.clientType = GlobalSettings.ClientType.Teacher;
            SceneManager.LoadScene("Load_Create_Scrn");
            break;

        case "NewScenario_Btn":
            GlobalSettings.Instance.filePathJSON = "";
            SceneManager.LoadScene("ScenarioInput_Scrn");
            break;

        case "LoadScenario_Btn":
            SceneManager.LoadScene("ScenarioSelection_Scrn");
            break;

        case "Student_Btn":
            //Schüler-Rolle speichern

            //nächsten Screen aufrufen
            GlobalSettings.Instance.clientType = GlobalSettings.ClientType.Student;
            SceneManager.LoadScene("IP_Adress_Scrn");
            break;

        case "SaveIP_Btn":
            //wenn Schüler
            bmaNetworkController = GameObject.FindGameObjectWithTag("NetworkController").GetComponent <BMANetworkController>();

            bmaNetworkController.connectWithIPField(ownIPField, ipField);

            SceneManager.LoadScene("SampleScene");

            break;

        case "Home_Btn":
            switch (SceneManager.GetActiveScene().name)
            {
            case "ScenarioInput_Scrn":
                SceneManager.LoadScene("Load_Create_Scrn");
                break;

            case "IP_Adress_Scrn":
                SceneManager.LoadScene("Teacher_Student_Scrn");
                break;

            case "Teacher_Student_Scrn":
                SceneManager.LoadScene("Simulation_Scrn");
                break;

            case "Simulation_Scrn":
                SceneManager.LoadScene("MainMenu_Scrn");
                break;

            case "Load_Create_Scrn":
                SceneManager.LoadScene("Teacher_Student_Scrn");
                break;

            case "ScenarioSelection_Scrn":
                if (GlobalSettings.Instance.clientType == GlobalSettings.ClientType.Student)
                {
                    SceneManager.LoadScene("Teacher_Student_Scrn");
                }
                else
                {
                    SceneManager.LoadScene("Load_Create_Scrn");
                }
                break;

            default:
                SceneManager.LoadScene("MainMenu_Scrn");
                break;
            }
            break;

        default:
            break;
        }
    }
    /// <summary>
    /// Nach der ResetTime ohne Input die Anzeige resetten
    /// </summary>
    void Update()
    {
        if (Time.time - startTime > 2 && GlobalSettings.Instance.clientType == GlobalSettings.ClientType.Student &&
            AlarmList.Instance.gameObject.activeSelf == false)
        {
            BMANetworkController bmaNetworkController = GameObject.FindGameObjectWithTag("NetworkController").GetComponent <BMANetworkController>();
            bmaNetworkController.disconnect();
            SceneManager.LoadScene("IP_Adress_Scrn");
        }

        // Alarmliste aktivieren, wenn diese durch einen anderen Modus deaktiviert wurde
        if (GlobalSettings.Instance.clientType == GlobalSettings.ClientType.SinglePlayer &&
            AlarmList.Instance.gameObject.activeSelf == false)
        {
            AlarmList.Instance.gameObject.SetActive(true);
        }


        if (fatState != State.Test && Time.time - lastInputTime > ResetTimeInSeconds)
        {
            //cursorPosition = 0;
            fatState = State.Alarmanzeige;
            updateDisplay();
        }

        // AcousticsFlag setzen, abhängig von der LED
        if (!fwControlPanelLeftLEDView.acousticSignalLEDIsOn() && fatList.getAlarmCount() > 0)
        {
            acousticsFlag = true;
        }
        else
        {
            acousticsFlag = false;
        }

        // Hausalarm ein-/ausschalten
        if (acousticsFlag)
        {
            hausalarmSound.PlaySecondClick();
        }
        else
        {
            hausalarmSound.StopSecondClick();
        }

        // Buzzer ein-/ausschalten (schaltet sich aut. wieder ein)
        if (lastBuzzerMessage < fatList.getAlarmCount() - 1)
        {
            buzzerSound.PlaySecondClick();
            buzzerFlag = false;
        }
        if (buzzerFlag)
        {
            buzzerSound.StopSecondClick();
        }

        if (testLightMode)
        {
            lightningTimer += Time.deltaTime;
        }
    }