コード例 #1
0
        public void AddExperiment(SEP_ExperimentHandler h)
        {
            if (h == null)
            {
                return;
            }

            if (h.vessel != vessel)
            {
                return;
            }

            SEP_ExperimentSection section = new SEP_ExperimentSection(h, h.vessel);

            if (section == null)
            {
                return;
            }

            experiments.Add(h);
            experimentSections.Add(section);

            if (vesselUISection == null)
            {
                return;
            }

            vesselUISection.AddExperimentSection(section);

            _expcount = getExpCountString();

            vesselUISection.setExpCount(_expcount);
        }
コード例 #2
0
        public void RemoveExperiment(SEP_ExperimentHandler h)
        {
            if (h == null)
            {
                return;
            }

            for (int i = experiments.Count - 1; i >= 0; i--)
            {
                SEP_ExperimentHandler handler = experiments[i];

                if (handler == null)
                {
                    continue;
                }

                if (handler != h)
                {
                    continue;
                }

                experiments.Remove(h);
                break;
            }

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

                if (section == null)
                {
                    continue;
                }

                if (section.Handler != h)
                {
                    continue;
                }

                section.OnDestroy();
                experimentSections.Remove(section);
                section = null;

                break;
            }

            _expcount = getExpCountString();

            if (vesselUISection != null)
            {
                vesselUISection.setExpCount(_expcount);
            }
        }
コード例 #3
0
        private void onAddExperiment(Vessel v, SEP_ExperimentHandler h)
        {
            if (v == null)
            {
                return;
            }

            if (v != vessel)
            {
                return;
            }

            if (h == null)
            {
                return;
            }

            if (h.vessel != vessel)
            {
                return;
            }

            SEP_ExperimentSection section = addExperimentSection(h);

            if (section == null)
            {
                return;
            }

            experiments.Add(h);
            experimentSections.Add(section);

            if (vesselUISection == null)
            {
                return;
            }

            vesselUISection.AddExperimentSection(section);

            _expcount = getExpCountString();
        }
コード例 #4
0
        private void onRemoveExperiment(Vessel v, SEP_ExperimentHandler h)
        {
            if (v == null)
            {
                return;
            }

            if (v != vessel)
            {
                return;
            }

            if (h == null)
            {
                return;
            }

            if (experiments.Any(a => a == h))
            {
                experiments.Remove(h);
            }

            if (experimentSections.Any(e => e.Handler == h))
            {
                SEP_ExperimentSection section = experimentSections.FirstOrDefault(x => x.Handler == h);

                if (section == null)
                {
                    return;
                }

                section.OnDestroy();
                experimentSections.Remove(section);
                section = null;
            }

            _expcount = getExpCountString();
        }