Exemplo n.º 1
0
        //Info window
        private void Window(int id)
        {
            //Header
            GUI.DragWindow(this.drag);
            GUILayout.BeginVertical();

            //Top info labels
            StringBuilder builder = new StringBuilder("Part name: ").AppendLine(this.part.partInfo.title);

            builder.Append("Symmetry counterparts: ").AppendLine(this.part.symmetryCounterparts.Count.ToString());
            builder.Append("Part mass: ").Append(this.part.TotalMass().ToString("0.###")).Append("t");
            GUILayout.Label(builder.ToString());

            //Beginning scroll
            this.scroll = GUILayout.BeginScrollView(this.scroll, false, false, GUI.skin.horizontalScrollbar, GUI.skin.verticalScrollbar, GUI.skin.box);
            GUILayout.Space(5);
            GUILayout.Label("General:", GuiUtils.BoldLabel, GUILayout.Width(120));

            //General labels
            builder = new StringBuilder("Autocut speed: ").Append(this.cutSpeed).AppendLine("m/s");
            if (this.timer >= 60)
            {
                builder.Append("Deployment timer: ").AppendLine(RCUtils.ToMinutesSeconds(this.timer));
            }
            else if (this.timer > 0)
            {
                builder.Append("Deployment timer: ").Append(this.timer.ToString("0.#")).AppendLine("s");
            }
            if (this.mustGoDown)
            {
                builder.AppendLine("Must go downwards to deploy");
            }
            if (this.deployOnGround)
            {
                builder.AppendLine("Automatically deploys on ground contact");
            }
            if (this.spareChutes >= 0)
            {
                builder.Append("Spare chutes: ").Append(this.chuteCount);
            }
            if (this.delayBeforeCut > 0)
            {
                builder.Append("Delay before cut: ").Append(this.delayBeforeCut);
            }
            else
            {
                builder.Append("Spare chutes: inf");
            }
            GUILayout.Label(builder.ToString());

            //Specific labels
            for (int i = 0; i < this.parachutes.Count; i++)
            {
                GUILayout.Label("___________________________________________", GuiUtils.BoldLabel);
                GUILayout.Space(3);
                GUILayout.Label(RCUtils.ParachuteNumber(i) + ":", GuiUtils.BoldLabel, GUILayout.Width(120));
                this.parachutes[i].RenderGUI();
            }

            //End scroll
            GUILayout.EndScrollView();

            //Copy button if in flight
            if (HighLogic.LoadedSceneIsFlight && this.part.symmetryCounterparts.Count > 0)
            {
                GuiUtils.CenteredButton("Copy to others chutes", CopyToCounterparts);
            }

            //Close button
            GuiUtils.CenteredButton("Close", () => this.visible = false);

            //Closer
            GUILayout.EndVertical();
        }