private void CreateExperimentSection(IExperimentSection section)
        {
            GameObject sectionObject = Instantiate(ExperimentSectionPrefab);

            if (sectionObject == null)
            {
                return;
            }

            sectionObject.transform.SetParent(ExperimentSectionTransform, false);

            SEP_ExperimentSection experiment = sectionObject.GetComponent <SEP_ExperimentSection>();

            if (experiment == null)
            {
                return;
            }

            experiment.setExperiment(section, this);

            if (Minimize != null)
            {
                experiment.toggleVisibility(Minimize.isOn);
            }
            else
            {
                experiment.toggleVisibility(true);
            }

            experiments.Add(experiment);
        }
        private void CreateExperimentSections(IList <IExperimentSection> sections)
        {
            if (sections == null)
            {
                return;
            }

            if (ExperimentSectionPrefab == null)
            {
                return;
            }

            if (ExperimentSectionTransform == null)
            {
                return;
            }

            for (int i = sections.Count - 1; i >= 0; i--)
            {
                IExperimentSection section = sections[i];

                if (section == null)
                {
                    continue;
                }

                CreateExperimentSection(section);
            }
        }
        public void AddExperimentSection(IExperimentSection section)
        {
            if (section == null)
            {
                return;
            }

            CreateExperimentSection(section);
        }
Exemple #4
0
        public void setExperiment(IExperimentSection experiment, SEP_VesselSection vessel)
        {
            if (experiment == null)
            {
                return;
            }

            if (vessel == null)
            {
                return;
            }

            parent = vessel;

            experimentInterface = experiment;

            if (Title != null)
            {
                Title.text = experiment.Name;
            }

            if (Remaining != null)
            {
                Remaining.text = experimentInterface.DaysRemaining;
            }

            if (ToggleBackground != null && PlayIcon != null && PauseIcon != null)
            {
                ToggleBackground.sprite = experimentInterface.IsRunning ? PauseIcon : PlayIcon;
            }

            if (BaseSlider != null && FrontSlider != null)
            {
                BaseSlider.normalizedValue = Mathf.Clamp01(experimentInterface.Calibration);

                FrontSlider.normalizedValue = Mathf.Clamp01(experimentInterface.Progress);
            }

            experimentInterface.setParent(this);
        }
        public void setExperiment(IExperimentSection experiment, SEP_VesselSection vessel)
        {
            if (experiment == null)
            {
                return;
            }

            if (vessel == null)
            {
                return;
            }

            parent = vessel;

            experimentInterface = experiment;

            if (Title != null)
            {
                Title.OnTextUpdate.Invoke(experiment.Name);
            }

            if (Remaining != null)
            {
                Remaining.OnTextUpdate.Invoke(experimentInterface.DaysRemaining);
            }

            toggleState = !experimentInterface.IsRunning;

            UpdateToggleButton(experimentInterface.IsRunning);

            if (BaseSlider != null && FrontSlider != null)
            {
                BaseSlider.normalizedValue = Mathf.Clamp01(experimentInterface.Calibration);

                FrontSlider.normalizedValue = Mathf.Clamp01(experimentInterface.Progress);
            }

            experimentInterface.setParent(this);
        }