Ejemplo n.º 1
0
        public ExperimentSubjectList(KsmGuiBase parent, ExperimentInfo expInfo) : base(parent)
        {
            KnownSubjectsToggle = new KsmGuiToggle(this, "Show only known subjects", true, ToggleKnownSubjects, null, -1, 21);

            KsmGuiBase listHeader = new KsmGuiBase(this);

            listHeader.SetLayoutElement(true, false, -1, 16);
            listHeader.AddImageComponentWithColor(KsmGuiStyle.boxColor);

            KsmGuiText rndHeaderText = new KsmGuiText(listHeader, "RnD", "Science points\nretrieved in RnD", TextAlignmentOptions.Left);

            rndHeaderText.TextComponent.color     = Lib.KolorToColor(Lib.Kolor.Science);
            rndHeaderText.TextComponent.fontStyle = FontStyles.Bold;
            rndHeaderText.TopTransform.SetAnchorsAndPosition(TextAnchor.MiddleLeft, TextAnchor.MiddleLeft, 10, 0);
            rndHeaderText.TopTransform.SetSizeDelta(50, 16);

            KsmGuiText flightHeaderText = new KsmGuiText(listHeader, "Flight", "Science points\ncollected in all vessels", TextAlignmentOptions.Left);

            flightHeaderText.TextComponent.color     = Lib.KolorToColor(Lib.Kolor.Science);
            flightHeaderText.TextComponent.fontStyle = FontStyles.Bold;
            flightHeaderText.TopTransform.SetAnchorsAndPosition(TextAnchor.MiddleLeft, TextAnchor.MiddleLeft, 60, 0);
            flightHeaderText.TopTransform.SetSizeDelta(50, 16);

            KsmGuiText valueHeaderText = new KsmGuiText(listHeader, "Value", "Remaining science value\naccounting for data retrieved in RnD\nand collected in flight", TextAlignmentOptions.Left);

            valueHeaderText.TextComponent.color     = Lib.KolorToColor(Lib.Kolor.Science);
            valueHeaderText.TextComponent.fontStyle = FontStyles.Bold;
            valueHeaderText.TopTransform.SetAnchorsAndPosition(TextAnchor.MiddleLeft, TextAnchor.MiddleLeft, 110, 0);
            valueHeaderText.TopTransform.SetSizeDelta(50, 16);

            KsmGuiText completedHeaderText = new KsmGuiText(listHeader, "Completed", "How many times the subject\nhas been retrieved in RnD", TextAlignmentOptions.Left);

            completedHeaderText.TextComponent.color     = Lib.KolorToColor(Lib.Kolor.Yellow);
            completedHeaderText.TextComponent.fontStyle = FontStyles.Bold;
            completedHeaderText.TopTransform.SetAnchorsAndPosition(TextAnchor.MiddleLeft, TextAnchor.MiddleLeft, 160, 0);
            completedHeaderText.TopTransform.SetSizeDelta(100, 16);

            KsmGuiVerticalScrollView scrollView = new KsmGuiVerticalScrollView(this);

            scrollView.SetLayoutElement(true, true, 320, -1, -1, 250);
            scrollView.ContentGroup.padding = new RectOffset(0, 5, 5, 5);

            BodiesSituationsBiomesSubject subjects = GetSubjectsForExperiment(expInfo);

            if (subjects != null)
            {
                foreach (ObjectPair <int, SituationsBiomesSubject> bodySubjects in GetSubjectsForExperiment(expInfo))
                {
                    CelestialBody body      = FlightGlobals.Bodies[bodySubjects.Key];
                    BodyContainer bodyEntry = new BodyContainer(scrollView, body, bodySubjects.Value);
                    BodyContainers.Add(bodyEntry);
                }
            }

            SetUpdateCoroutine(new KsmGuiUpdateCoroutine(Update));
            ForceExecuteCoroutine();
            ToggleKnownSubjects(true);
        }
Ejemplo n.º 2
0
            public BodyContainer(KsmGuiBase parent, CelestialBody body, SituationsBiomesSubject situationsAndSubjects) : base(parent)
            {
                KsmGuiHeader header = new KsmGuiHeader(this, body.name, KsmGuiStyle.boxColor);

                header.TextObject.TextComponent.fontStyle = FontStyles.Bold;
                header.TextObject.TextComponent.color     = Lib.KolorToColor(Lib.Kolor.Orange);
                header.TextObject.TextComponent.alignment = TextAlignmentOptions.Left;
                bodyToggle = new KsmGuiIconButton(header, Textures.KsmGuiTexHeaderArrowsUp, ToggleBody);
                bodyToggle.SetIconColor(Lib.Kolor.Orange);
                bodyToggle.MoveAsFirstChild();

                SubjectsContainer = new SubjectsContainer(this, situationsAndSubjects);
            }