Exemplo n.º 1
0
        private void InitWindows()
        {
            windowMain            = AddComponent <TWPWindow>();
            windowMain.WindowRect = new Rect(100, 200, 750, 400);
            windowMain.mbTWP      = this;
            windowMain.settings   = settings;

            windowSettings       = AddComponent <TWPWindowSettings>();
            windowSettings.mbTWP = this;

            windowSettingsBlockout            = AddComponent <TWPWindowSettingsBlockout>();
            windowSettingsBlockout.mbTWP      = this;
            windowSettingsBlockoutExtra       = AddComponent <TWPWindowSettingsBlockout>();
            windowSettingsBlockoutExtra.mbTWP = this;

            InitDebugWindow();
        }
        private void DrawWindow_Calendar()
        {
            //Update Check Area
            GUILayout.Label("General Settings", Styles.styleTextHeading);

            GUILayout.BeginVertical(Styles.styleSettingsArea);

            GUILayout.BeginHorizontal();
            GUILayout.BeginVertical(GUILayout.Width(60));
            GUILayout.Space(2); //to even up the text
            GUILayout.Label("Calendar:", Styles.styleTextHeading);
            GUILayout.EndVertical();

            GUILayout.BeginVertical();
            ddlSettingsCalendar.DrawButton();
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            if (DrawToggle(ref settings.ShowCalendarToggle, "Show Calendar Toggle in Main Window", Styles.styleToggle))
            {
                settings.Save();
            }
            GUILayout.EndVertical();

            if (settings.SelectedCalendar == CalendarTypeEnum.Earth)
            {
                GUILayout.Label("Earth Settings", Styles.styleTextHeading);
                GUILayout.BeginVertical(Styles.styleSettingsArea);

                GUILayout.BeginHorizontal();
                GUILayout.Label("Earth Epoch:");

                String strYear, strMonth, strDay;
                strYear  = KSPDateStructure.CustomEpochEarth.Year.ToString();
                strMonth = KSPDateStructure.CustomEpochEarth.Month.ToString();
                strDay   = KSPDateStructure.CustomEpochEarth.Day.ToString();
                if (TWPWindow.DrawYearMonthDay(ref strYear, ref strMonth, ref strDay))
                {
                    try
                    {
                        KSPDateStructure.SetEarthCalendar(strYear.ToInt32(), strMonth.ToInt32(), strDay.ToInt32());
                        settings.EarthEpoch = KSPDateStructure.CustomEpochEarth.ToString("yyyy-MM-dd");
                        settings.Save();
                        mbTWP.windowMain.ResetWindow();
                    }
                    catch (Exception)
                    {
                        LogFormatted("Unable to set the Epoch date using the values provided-{0}-{1}-{2}", strYear, strMonth, strDay);
                    }
                }

                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Reset Earth Epoch"))
                {
                    KSPDateStructure.SetEarthCalendar();
                    settings.EarthEpoch = KSPDateStructure.CustomEpochEarth.ToString("1951-01-01");
                    settings.Save();
                }
                GUILayout.EndHorizontal();

                GUILayout.EndVertical();
            }

            //if RSS not installed and RSS chosen...

            ///section for custom stuff
        }
Exemplo n.º 3
0
        private void InitWindows()
        {
            windowMain = AddComponent<TWPWindow>();
            windowMain.WindowRect = new Rect(100, 200, 750, 400);
            windowMain.mbTWP = this;
            windowMain.settings = settings;

            windowSettings = AddComponent<TWPWindowSettings>();
            windowSettings.mbTWP = this;

            windowSettingsBlockout = AddComponent<TWPWindowSettingsBlockout>();
            windowSettingsBlockout.mbTWP = this;
            windowSettingsBlockoutExtra = AddComponent<TWPWindowSettingsBlockout>();
            windowSettingsBlockoutExtra.mbTWP = this;

            InitDebugWindow();
        }