Exemplo n.º 1
0
        private bool otherStabilizerPresent; // Set to true if other stabilizing mod is present

        #endregion


        /// <summary>
        /// Plugin constructor
        /// </summary>
        public void Awake()
        {
            if (Instance != null)
            {
                Destroy(this);
                return;
            }
            Instance = this;

            CommonWindowProperties.ActiveSkin = UISkinManager.defaultSkin;
            CommonWindowProperties.UnitySkin  = null;
            CommonWindowProperties.RefreshStyles();

            MainView             = null;
            MainModel            = null;
            mainViewVisible      = false;
            SettingsView         = null;
            SettingsModel        = null;
            setttingsViewVisible = false;
            ControlView          = null;
            ControlModel         = null;
            controlViewVisible   = false;

            toolbarButton = null;

            GamePaused = false;
            ShowUI     = true;
            MapMode    = false;
            lastUpdate = DateTime.Now;

            BVControllers = new List <BVController>();

            Configuration.Load();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        internal SettingsWindowView(SettingsWindowModel m, Vector3 mwp, UnityAction close) : base(
                CommonWindowProperties.settingsMinWidth,       // min width
                CommonWindowProperties.settingsMinHeight,      // min height
                CommonWindowProperties.settingsWindowSpacing,  // spacing
                CommonWindowProperties.settingsElementPadding, // padding
                TextAnchor.UpperLeft                           // text anchor
                )
        {
            model = m;
            mainWindowPosition = mwp;
            closeCallback      = close;

            AddChild(TooltipExtension.DeferTooltip(new DialogGUIToggle(model.GetDewarpToggleState(), Localizer.Format("#LOC_BV_AutomaticDewarp"), model.DewarpChecked, 130f)
            {
                tooltipText = Localizer.Format("#LOC_BV_AutomaticDewarp_Tooltip")
            }));
            AddChild(TooltipExtension.DeferTooltip(new DialogGUIToggle(model.GeDisableRotationToggleState(), Localizer.Format("#LOC_BV_DisableRotation"), model.DisableRotationChecked, 130f)
            {
                tooltipText = Localizer.Format("#LOC_BV_DisableRotation_Tooltip")
            }));
            AddChild(TooltipExtension.DeferTooltip(new DialogGUIToggle(model.GeShowBiomeToggleState(), Localizer.Format("#LOC_BV_ShowBiome"), model.ShowBiomeChecked, 130f)
            {
                tooltipText = Localizer.Format("#LOC_BV_ShowBiome_Tooltip")
            }));

            AddChild(new DialogGUIBox("", 140f, 80f, null,
                                      new DialogGUIVerticalLayout(140f, 80f, CommonWindowProperties.settingsWindowSpacing, CommonWindowProperties.boxPadding, TextAnchor.UpperLeft,
                                                                  new DialogGUILabel(Localizer.Format("#LOC_BV_Style"), 135f),
                                                                  new DialogGUISpace(10f),
                                                                  new DialogGUIToggleGroup(
                                                                      new DialogGUIToggle(model.GetKSPSkinToggleState(), Localizer.Format("#LOC_BV_Style_KSP"), model.KSPSkinChecked, 135f),
                                                                      new DialogGUIToggle(model.GetUnitySkinToggleState(), Localizer.Format("#LOC_BV_Style_Unity"), model.UnitySkinChecked, 135f)
                                                                      )
                                                                  )
                                      ));

            AddChild(new DialogGUISpace(4f));

            AddChild(new DialogGUIBox("", 140f, 80f, null,
                                      new DialogGUIVerticalLayout(140f, 80f, CommonWindowProperties.settingsWindowSpacing, CommonWindowProperties.boxPadding, TextAnchor.UpperLeft,
                                                                  new DialogGUILabel(Localizer.Format("#LOC_BV_Toolbar"), 135f),
                                                                  new DialogGUISpace(10f),
                                                                  TooltipExtension.DeferTooltip(new DialogGUIToggle(model.GetKSPToolbarToggleState(), Localizer.Format("#LOC_BV_Toolbar_KSP"), model.KSPToolbarChecked, 135f)
            {
                tooltipText = Localizer.Format("#LOC_BV_Toolbar_KSP_Tooltip")
            }),
                                                                  TooltipExtension.DeferTooltip(new DialogGUIToggle(model.GetTCToggleState(), Localizer.Format("#LOC_BV_Toolbar_TC"), model.TCChecked, 135f)
            {
                tooltipText = Localizer.Format("#LOC_BV_Toolbar_TC_Tooltip")
            })
                                                                  )
                                      ));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Show settings window dialog
        /// </summary>
        private void ShowSettingsWindow()
        {
            if (SettingsView == null)
            {
                if (SettingsModel == null) // Create model for the Settings View
                {
                    SettingsModel = new SettingsWindowModel();
                }

                SettingsView = new SettingsWindowView(SettingsModel, MainView.GetWindowPosition(), ToggleSettingsWindow);
                SettingsView.Show();
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Constructor
        /// </summary>
        internal SettingsWindowView(SettingsWindowModel m, Vector3 mwp, UnityAction close) : base(
                CommonWindowProperties.settingsMinWidth,       // min width
                CommonWindowProperties.settingsMinHeight,      // min height
                CommonWindowProperties.settingsWindowSpacing,  // spacing
                CommonWindowProperties.settingsElementPadding, // padding
                TextAnchor.UpperLeft                           // text anchor
                )
        {
            model = m;
            mainWindowPosition = mwp;
            closeCallback      = close;

            AddChild(TooltipExtension.DeferTooltip(new DialogGUIToggle(model.GetDewarpToggleState(), Localizer.Format("#LOC_BV_AutomaticDewarp"), model.DewarpChecked, 130f)
            {
                tooltipText = Localizer.Format("#LOC_BV_AutomaticDewarp_Tooltip")
            }));
            AddChild(TooltipExtension.DeferTooltip(new DialogGUIToggle(model.GeDisableRotationToggleState(), Localizer.Format("#LOC_BV_DisableRotation"), model.DisableRotationChecked, 130f)
            {
                tooltipText = Localizer.Format("#LOC_BV_DisableRotation_Tooltip")
            }));
            AddChild(TooltipExtension.DeferTooltip(new DialogGUIToggle(model.GeShowBiomeToggleState(), Localizer.Format("#LOC_BV_ShowBiome"), model.ShowBiomeChecked, 130f)
            {
                tooltipText = Localizer.Format("#LOC_BV_ShowBiome_Tooltip")
            }));

            AddChild(new DialogGUIBox("", 140f, 80f, null,
                                      new DialogGUIVerticalLayout(140f, 80f, CommonWindowProperties.settingsWindowSpacing, CommonWindowProperties.boxPadding, TextAnchor.UpperLeft,
                                                                  new DialogGUILabel(Localizer.Format("#LOC_BV_Style"), 135f),
                                                                  new DialogGUISpace(10f),
                                                                  new DialogGUIToggleGroup(
                                                                      new DialogGUIToggle(model.GetKSPSkinToggleState(), Localizer.Format("#LOC_BV_Style_KSP"), model.KSPSkinChecked, 135f),
                                                                      new DialogGUIToggle(model.GetUnitySkinToggleState(), Localizer.Format("#LOC_BV_Style_Unity"), model.UnitySkinChecked, 135f)
                                                                      )
                                                                  )
                                      ));

            AddChild(new DialogGUISpace(4f));

            AddChild(new DialogGUIBox("", 140f, 80f, null,
                                      new DialogGUIVerticalLayout(140f, 80f, CommonWindowProperties.settingsWindowSpacing, CommonWindowProperties.boxPadding, TextAnchor.UpperLeft,
                                                                  new DialogGUILabel(Localizer.Format("#LOC_BV_Toolbar"), 135f),
                                                                  new DialogGUISpace(10f),
                                                                  TooltipExtension.DeferTooltip(new DialogGUIToggle(model.GetKSPToolbarToggleState(), Localizer.Format("#LOC_BV_Toolbar_KSP"), model.KSPToolbarChecked, 135f)
            {
                tooltipText = Localizer.Format("#LOC_BV_Toolbar_KSP_Tooltip")
            }),
                                                                  TooltipExtension.DeferTooltip(new DialogGUIToggle(model.GetTCToggleState(), Localizer.Format("#LOC_BV_Toolbar_TC"), model.TCChecked, 135f)
            {
                tooltipText = Localizer.Format("#LOC_BV_Toolbar_TC_Tooltip")
            })
                                                                  )
                                      ));

            AddChild(new DialogGUISpace(4f));

            DialogGUITextInput heightOffsetField = new DialogGUITextInput("", false, 20, (string s) => { model.HeightOffset = s; return(s); }, model.GetHeightOffset, TMPro.TMP_InputField.ContentType.DecimalNumber, CommonWindowProperties.buttonHeight);

            model.AddLockControlToTextField(heightOffsetField);
            AddChild(new DialogGUIVerticalLayout(
                         new DialogGUILabel(Localizer.Format("#LOC_BV_HeightOffset")),
                         new DialogGUIHorizontalLayout(TextAnchor.MiddleLeft,
                                                       heightOffsetField,
                                                       new DialogGUILabel(Localizer.Format("m")))
                         ));
        }