Exemple #1
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);
        }