private void showEndLevelMessage()
    {
        MessageDisplay M = gameObject.AddComponent <MessageDisplay>();

        M.ShowMessage("You've picked up all ingredients, you can go home!");
        //todo - show pop up box message
    }
Esempio n. 2
0
 public static void Show(string msg)
 {
     if (instance != null)
     {
         instance.ShowMessage(msg);
     }
 }
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.TryGetComponent(out Diver diver) && !IsOn)
     {
         AudioSource.clip = CheckpointActivatedClip;
         AudioSource.Play();
         MessageDisplay.ShowMessage("Checkpoint!");
         SaveManager.Checkpoint(Index);
         Activate();
     }
 }
    public void itemAdded(string name, GameObject value)
    {
        if (firstItem)
        {
            M.ShowMessage("Press z to swap between items!");
            firstItem = false;
        }
        if (find(name) != null)
        {
            return;
        }
        ListNode newNode = new ListNode(current.getNext(), name, value);

        current.setNode(newNode);
        current = newNode;
        updateImage();
    }
Esempio n. 5
0
 void TreasureGet()
 {
     MessageDisplay.ShowMessage("Treasure!");
     AudioSource.Play();
     Destroy(gameObject);
 }
 void OnTriggerStay2D(Collider2D other)
 {
     M.ShowMessage("Press f to pick up items!");
 }
Esempio n. 7
0
        /// <summary>
        /// Reads parameters from UI elements.
        /// </summary>
        /// <param name="p">Parameters instance to read control values into</param>
        /// <returns>True if no validation problems</returns>
        private bool ReadParameters(Parameters p)
        {
            errorProvider.SetError(threshold1Input, "");
            errorProvider.SetError(threshold2Input, "");
            errorProvider.SetError(threshold3Input, "");
            errorProvider.SetError(threshold4Input, "");
            errorProvider.SetError(b23Input, "");

            errorProvider.SetError(ECGnameInput, "");
            errorProvider.SetError(minHeartrateInput, "");
            errorProvider.SetError(maxHeartrateInput, "");

            errorProvider.SetError(EOGnameInput, "");
            errorProvider.SetError(SEMlengthInput, "");
            errorProvider.SetError(SEMthresholdInput, "");
            errorProvider.SetError(SEMbeforeInput, "");

            errorProvider.SetError(inputERPlabel, "");
            errorProvider.SetError(inputERPbefore, "");
            errorProvider.SetError(inputERPafter, "");

            errorProvider.SetError(alphapeakInput, "");
            errorProvider.SetError(alphaStartInput, "");
            errorProvider.SetError(alphaEndInput, "");

            errorProvider.SetError(stageClengthInput, "");
            errorProvider.SetError(resultsFilenameInput, "");
            errorProvider.SetError(resultsPathInput, "");

            errorProvider.SetError(kriterienFaktorInput, "");
            errorProvider.SetError(segmentLengthInput, "");

            errorProvider.SetError(textBox_UntergrenzeDT, "");

            // Validate & collect values

            //checkboxes to bool values is easy
            p.leaveTempNodes     = checkBox7.Checked;
            p.purgeOldTempNodes  = checkBox8.Checked;
            p.Amygdala_LORETA    = checkBoxROI.Checked;
            p.adapted_bands      = checkBoxNewBands.Checked;
            p.new_tree           = checkBoxNewTree.Checked;
            p.a2pa2t             = checkBoxA2PA2T.Checked;
            p.ACFauto            = checkBoxAPFauto.Checked;
            p.adaptAbsThresholds = checkBoxKriterienAnpassen.Checked;
            p.batch        = checkBoxBatch.Checked;
            p.batchexclude = checkBoxBatchExclude.Checked;
            p.csv          = checkBoxCSV.Checked;

            if ((checkBox2.Checked) && (string.IsNullOrEmpty(EOGnameInput.Text)))
            {
                errorProvider.SetError(EOGnameInput, "Please provide a name.");
                return(false);
            }

            if ((checkBox2.Checked) && (AutomationSupport.Application.ActiveNode.Dataset.Channels[EOGnameInput.Text] == null))
            {
                errorProvider.SetError(EOGnameInput, "No such channel found in history node.");
                return(false);
            }

            p.EOGname = EOGnameInput.Text;

            if ((checkBox5.Checked) && (string.IsNullOrEmpty(SCLEDAnameInput.Text)))
            {
                errorProvider.SetError(SCLEDAnameInput, "Please provide a name.");
                return(false);
            }

            if ((checkBox5.Checked) && (AutomationSupport.Application.ActiveNode.Dataset.Channels[SCLEDAnameInput.Text] == null))
            {
                errorProvider.SetError(SCLEDAnameInput, "No such channel found in history node.");
                return(false);
            }

            p.SCLEDAdetect = checkBox5.Checked;
            p.SCLEDAname   = SCLEDAnameInput.Text;

            if ((checkBox6.Checked) && (string.IsNullOrEmpty(TEMPnameInput.Text)))
            {
                errorProvider.SetError(TEMPnameInput, "Please provide a name.");
                return(false);
            }

            if ((checkBox6.Checked) && (AutomationSupport.Application.ActiveNode.Dataset.Channels[TEMPnameInput.Text] == null))
            {
                errorProvider.SetError(TEMPnameInput, "No such channel found in history node.");
                return(false);
            }

            p.TEMPdetect = checkBox6.Checked;
            p.TEMPname   = TEMPnameInput.Text;

            if (!double.TryParse(threshold1Input.Text, out p.absThresholdA))
            {
                errorProvider.SetError(threshold1Input, "Needs to be numeric.");
                return(false);
            }

            if (!double.TryParse(threshold2Input.Text, out p.relThresholdA))
            {
                errorProvider.SetError(threshold2Input, "Needs to be numeric.");
                return(false);
            }

            if (!double.TryParse(threshold3Input.Text, out p.relThresholdA1))
            {
                errorProvider.SetError(threshold3Input, "Needs to be numeric.");
                return(false);
            }

            if (!double.TryParse(threshold4Input.Text, out p.relThresholdA2))
            {
                errorProvider.SetError(threshold4Input, "Needs to be numeric.");
                return(false);
            }

            if (!double.TryParse(b23Input.Text, out p.absThresholdB23))
            {
                errorProvider.SetError(b23Input, "Needs to be numeric.");
                return(false);
            }

            if (!float.TryParse(alphapeakInput.Text, out p.alphacenter))
            {
                errorProvider.SetError(alphapeakInput, "Needs to be numeric.");
                return(false);
            }

            if (!float.TryParse(bandBox9.Text, out p.alpharadius))
            {
                errorProvider.SetError(bandBox9, "Needs to be numeric.");
                return(false);
            }


            if (!float.TryParse(kriterienFaktorInput.Text, out p.absThresholdsFactor))
            {
                errorProvider.SetError(kriterienFaktorInput, "Needs to be numeric.");
                return(false);
            }


            if ((p.alphacenter < 8) || (p.alphacenter > 13))
            {
                errorProvider.SetError(alphapeakInput, "Alpha peak should be between 8 and 13 Hz.");
                return(false);
            }

            if (!uint.TryParse(stageClengthInput.Text, out p.stageClength))
            {
                errorProvider.SetError(stageClengthInput, "Needs to be a positive integer.");
                return(false);
            }

            if ((checkBoxAPFauto.Checked) && (!uint.TryParse(alphaStartInput.Text, out p.ACFfrom)))
            {
                errorProvider.SetError(alphaStartInput, "Needs to be a positive integer.");
                return(false);
            }

            if ((checkBoxAPFauto.Checked) && (!uint.TryParse(alphaEndInput.Text, out p.ACFto)))
            {
                errorProvider.SetError(alphaEndInput, "Needs to be a positive integer.");
                return(false);
            }

            if (p.ACFfrom + 10 > p.ACFto)//this only happens if the previous 2 tryparse()s succeeded
            {
                errorProvider.SetError(alphaStartInput, "Start and end point need to be at least 10 seconds apart.");
                errorProvider.SetError(alphaEndInput, "Start and end point need to be at least 10 seconds apart.");
                return(false);
            }

            if (!float.TryParse(textBox_UntergrenzeDT.Text, out p.lower_bound_DeltaTheta))
            {
                errorProvider.SetError(textBox_UntergrenzeDT, "Needs to be numeric.");
                return(false);
            }

            if ((p.lower_bound_DeltaTheta != 0.5) && (p.lower_bound_DeltaTheta != 1) && (p.lower_bound_DeltaTheta != 1.5) && (p.lower_bound_DeltaTheta != 2) && (p.lower_bound_DeltaTheta != 2.5) && (p.lower_bound_DeltaTheta != 3) && (p.lower_bound_DeltaTheta != 3.5) && (p.lower_bound_DeltaTheta != 4) && (p.lower_bound_DeltaTheta != 4.5))
            {
                errorProvider.SetError(textBox_UntergrenzeDT, "Needs to be a multiple of 0.5 Hz, minimum 0.5, maximum 4.5 Hz.");
                return(false);
            }


            p.createSegments = checkBox1.Checked;

            if ((checkBox1.Checked) && (!uint.TryParse(segmentLengthInput.Text, out p.segmentLength)))
            {
                errorProvider.SetError(segmentLengthInput, "Needs to be a positive integer.");
                return(false);
            }

            if (p.segmentLength < 100)
            {
                errorProvider.SetError(segmentLengthInput, "Needs to be at least 100 ms. Values between 500 and 3000 are recommended.");
                return(false);
            }

            if ((checkBox3.Checked) && (string.IsNullOrEmpty(ECGnameInput.Text)))
            {
                errorProvider.SetError(ECGnameInput, "Please provide a name.");
                return(false);
            }

            if ((checkBox3.Checked) && (AutomationSupport.Application.ActiveNode.Dataset.Channels[ECGnameInput.Text] == null))
            {
                errorProvider.SetError(ECGnameInput, "No such channel found in history node.");
                return(false);
            }

            p.RRdetect = checkBox3.Checked;
            p.ECGname  = ECGnameInput.Text;


            if ((checkBox3.Checked) && (!uint.TryParse(minHeartrateInput.Text, out p.minHeartrate)))
            {
                errorProvider.SetError(segmentLengthInput, "Needs to be a positive integer.");
                return(false);
            }

            if ((checkBox3.Checked) && (!uint.TryParse(maxHeartrateInput.Text, out p.maxHeartrate)))
            {
                errorProvider.SetError(maxHeartrateInput, "Needs to be a positive integer.");
                return(false);
            }

            p.SEMdetect = checkBox2.Checked;

            if (!uint.TryParse(SEMbeforeInput.Text, out p.SEMbefore))
            {
                errorProvider.SetError(SEMbeforeInput, "Needs to be a positive integer.");
                return(false);
            }

            if (p.SEMbefore % 10 != 0)
            {
                errorProvider.SetError(SEMbeforeInput, "Needs to be divisible by 10.");
                return(false);
            }

/*            if (!uint.TryParse(SEMafterInput.Text, out p.SEMafter))
 *          {
 *              errorProvider.SetError(SEMafterInput, "Needs to be a positive integer.");
 *              return false;
 *          }
 *
 *          if (p.SEMafter % 10 != 0)
 *          {
 *              errorProvider.SetError(SEMafterInput, "Needs to be divisible by 10.");
 *              return false;
 *          }*/

            if (!uint.TryParse(SEMlengthInput.Text, out p.SEMlength))
            {
                errorProvider.SetError(SEMlengthInput, "Needs to be a positive integer.");
                return(false);
            }

            if (p.SEMlength % 10 != 0)
            {
                errorProvider.SetError(SEMlengthInput, "Needs to be divisible by 10.");
                return(false);
            }

            if (!uint.TryParse(SEMthresholdInput.Text, out p.SEMthreshold))
            {
                errorProvider.SetError(SEMthresholdInput, "Needs to be a positive integer.");
                return(false);
            }

            p.erp = checkBoxERP.Checked;

            if (checkBoxERP.Checked)
            {
                if (string.IsNullOrEmpty(inputERPlabel.Text))
                {
                    errorProvider.SetError(inputERPlabel, "Please provide a description that distinguishes markers of ERP periods to classify.");
                    return(false);
                }

                p.erp_description = inputERPlabel.Text;

                if (!uint.TryParse(inputERPbefore.Text, out p.erp_before))
                {
                    errorProvider.SetError(inputERPbefore, "Needs to be a positive integer.");
                    return(false);
                }
                if (!uint.TryParse(inputERPafter.Text, out p.erp_after))
                {
                    errorProvider.SetError(inputERPafter, "Needs to be a positive integer.");
                    return(false);
                }
                if ((p.erp_before + p.erp_after) < 400)
                {
                    errorProvider.SetError(inputERPbefore, "Minimum duration of measurement to classify: 400ms.");
                    errorProvider.SetError(inputERPafter, "Minimum duration of measurement to classify: 400ms.");
                    return(false);
                }
            }

            if (string.IsNullOrEmpty(resultsPathInput.Text))
            {
                errorProvider.SetError(resultsPathInput, "Please provide a results file path.");
                return(false);
            }

            if (!Directory.Exists(resultsPathInput.Text))
            {
                errorProvider.SetError(resultsPathInput, "Directory not found.");
                return(false);
            }
            p.resultsPath = resultsPathInput.Text;

            if (string.IsNullOrEmpty(resultsFilenameInput.Text))
            {
                errorProvider.SetError(resultsFilenameInput, "Please provide a results file name.");
                return(false);
            }

            p.resultsFilenameWC = resultsFilenameInput.Text;
            p.resultsFilename   = p.resultsFilenameWC.Replace("$h", AutomationSupport.Application.ActiveNode.HistoryFile.Name).Replace("$n", AutomationSupport.Application.ActiveNode.Name) + ".txt";

            if (File.Exists(p.resultsPath + p.resultsFilename) || (p.csv && File.Exists(p.resultsPath + p.resultsFilename.Replace(".txt", ".csv"))))
            {
                if (MessageDisplay.AskYesNo("NodeIterator::Execute", "Node Iterator", "Results files (.txt and/or .csv) exist, delete them?")
                    == MessageResult.Yes)
                {
                    try
                    {
                        if (File.Exists(p.resultsPath + p.resultsFilename))
                        {
                            File.Delete(p.resultsPath + p.resultsFilename);
                        }
                        if (p.csv && File.Exists(p.resultsPath + p.resultsFilename.Replace(".txt", ".csv")))
                        {
                            File.Delete(p.resultsPath + p.resultsFilename.Replace(".txt", ".csv"));
                        }
                        return(true);
                    }
                    catch
                    {
                        MessageDisplay.ShowMessage("VIGALL::Execute", "VIGALL", "Could not delete existing results file.");
                        errorProvider.SetError(resultsFilenameInput, "Please provide a new results file name.");
                        return(false);
                    }
                }
                else
                {
                    errorProvider.SetError(resultsFilenameInput, "Please provide a new results file name.");
                    return(false);
                }
            }

            return(true);
        }