Exemplo n.º 1
0
    private void changeTimes()
    {
        //Gets time from json, splits into a string array, converts that array to integers, and converts HH:MM:SS to seconds
        string timeO2String = getValues.jsnData.t_oxygen;

        string[] O2Array        = timeO2String.Split(':');
        int[]    intO2Array     = Array.ConvertAll <string, int>(O2Array, int.Parse);
        int      O2SecondsValue = 3600 * intO2Array[0] + 60 * intO2Array[1] + intO2Array[2];

        string timeBatteryString = getValues.jsnData.t_battery;

        string[] BatteryArray        = timeBatteryString.Split(':');
        int[]    intBatteryArray     = Array.ConvertAll <string, int>(BatteryArray, int.Parse);
        int      BatterySecondsValue = 3600 * intBatteryArray[0] + 60 * intBatteryArray[1] + intBatteryArray[2];

        string timeH2OString = getValues.jsnData.t_water;

        string[] H2OArray        = timeH2OString.Split(':');
        int[]    intH2OArray     = Array.ConvertAll <string, int>(H2OArray, int.Parse);
        int      H2OSecondsValue = 3600 * intH2OArray[0] + 60 * intH2OArray[1] + intH2OArray[2];

        // finds the lowest value from the seconds obtained from each
        int lowest = Mathf.Min(O2SecondsValue, BatterySecondsValue, H2OSecondsValue);

        if (lowest == O2SecondsValue)
        {
            textO2time.GetComponent <TextMeshProUGUI>().color    = Color.red;
            TimeO2DispNum.GetComponent <TextMeshProUGUI>().color = Color.red;
            lowestCase = 1;
        }
        else
        {
            textO2time.GetComponent <TextMeshProUGUI>().color    = Color.white;
            TimeO2DispNum.GetComponent <TextMeshProUGUI>().color = Color.white;
        }
        if (lowest == BatterySecondsValue)
        {
            textBatterytime.GetComponent <TextMeshProUGUI>().color    = Color.red;
            TimeBatteryDispNum.GetComponent <TextMeshProUGUI>().color = Color.red;
            lowestCase = 2;
        }
        else
        {
            textBatterytime.GetComponent <TextMeshProUGUI>().color    = Color.white;
            TimeBatteryDispNum.GetComponent <TextMeshProUGUI>().color = Color.white;
        }
        if (lowest == H2OSecondsValue)
        {
            textH2Otime.GetComponent <TextMeshProUGUI>().color    = Color.red;
            TimeH2ODispNum.GetComponent <TextMeshProUGUI>().color = Color.red;
            lowestCase = 3;
        }
        else
        {
            textH2Otime.GetComponent <TextMeshProUGUI>().color    = Color.white;
            TimeH2ODispNum.GetComponent <TextMeshProUGUI>().color = Color.white;
        }
    }
Exemplo n.º 2
0
 private void updateVitalScreen()
 {
     PO2VitalDispNum.GetComponent <Text>().text           = currentPO2.ToString() + " psia";
     batteryVitalDispNum.GetComponent <Text>().text       = currentBattery.ToString() + " Ah";
     BPMDispNum.GetComponent <TextMeshProUGUI>().text     = currentBPM.ToString() + " BPM";
     TSUBDispNum.GetComponent <TextMeshProUGUI>().text    = currentTSUB.ToString() + " degF";
     PO2RateDispNum.GetComponent <TextMeshProUGUI>().text = currentPO2Rate.ToString() + " psi/min";
     PSOPDispNum.GetComponent <Text>().text = currentPSOP.ToString() + " psia";
     PSOPRateDispNum.GetComponent <TextMeshProUGUI>().text = currentPSOPRate.ToString() + " psi/min";
     PSUBDispNum.GetComponent <Text>().text                        = currentPSUB.ToString() + " psia";
     PSUITDispNum.GetComponent <Text>().text                       = currentPSUIT.ToString() + " psid";
     PH2OgDispNum.GetComponent <TextMeshProUGUI>().text            = currentPH2Og.ToString() + " psia";
     PH2OLDispNum.GetComponent <TextMeshProUGUI>().text            = currentPH2OL.ToString() + " psia";
     VFanDispNum.GetComponent <Text>().text                        = currentVFan.ToString() + " RPM";
     textEMU1O2PRESSUREVALUE.GetComponent <TextMeshProUGUI>().text = currentEMU1O2Value.ToString() + " psi";
     textEMU2O2PRESSUREVALUE.GetComponent <TextMeshProUGUI>().text = currentEMU2O2Value.ToString() + " psi";
     TimeO2DispNum.GetComponent <TextMeshProUGUI>().text           = getValues.jsnData.t_oxygen;
     TimeBatteryDispNum.GetComponent <TextMeshProUGUI>().text      = getValues.jsnData.t_battery;
     TimeH2ODispNum.GetComponent <TextMeshProUGUI>().text          = getValues.jsnData.t_water;
 }