示例#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();
        }
示例#2
0
        /// <summary>
        /// Constructor
        /// </summary>
        internal ControlWindowView(ControlWindowModel m, UnityAction close) : base(
                CommonWindowProperties.controlMinWidth,       // min width
                CommonWindowProperties.controlMinHeight,      // min height
                CommonWindowProperties.controlWindowSpacing,  // spacing
                CommonWindowProperties.controlElementPadding, // padding
                TextAnchor.UpperLeft                          // text anchor
                )
        {
            model         = m;
            closeCallback = close;

            AddChild(model.GetStatsListLayout());

            // Set a target section
            DialogGUITextInput latField = new DialogGUITextInput("", false, 20, (string s) => { model.Latitude = s; return(s); }, model.GetLatitude, TMPro.TMP_InputField.ContentType.DecimalNumber, CommonWindowProperties.buttonHeight);

            model.AddLockControlToTextField(latField);
            DialogGUITextInput lonField = new DialogGUITextInput("", false, 20, (string s) => { model.Longitude = s; return(s); }, model.GetLongitude, TMPro.TMP_InputField.ContentType.DecimalNumber, CommonWindowProperties.buttonHeight);

            model.AddLockControlToTextField(lonField);
            AddChild(new DialogGUILabel(Localizer.Format("#LOC_BV_Control_SetTarget") + ":"));
            AddChild(new DialogGUIHorizontalLayout(TextAnchor.MiddleLeft,
                                                   new DialogGUILabel(Localizer.Format("#LOC_BV_Control_Lat") + ":"),
                                                   latField,
                                                   new DialogGUISpace(2f),
                                                   new DialogGUILabel(Localizer.Format("#LOC_BV_Control_Lon") + ":"),
                                                   lonField,
                                                   new DialogGUIButton(Localizer.Format("#LOC_BV_Control_Set"), model.SetButtonClicked, model.EnableButtons, 40f, CommonWindowProperties.buttonHeight - 4, false)
                                                   ));
            AddChild(new DialogGUIHorizontalLayout(
                         new DialogGUIButton(Localizer.Format("#LOC_BV_Control_PickOnMap"), model.PickOnMapButtonClicked, model.EnableButtons, 90f, CommonWindowProperties.buttonHeight - 4, false),
                         new DialogGUIButton(Localizer.Format("#LOC_BV_Control_CurrenTarget"), model.CurrentTargetButtonClicked, model.EnableButtons, 104f, CommonWindowProperties.buttonHeight - 4, false)
                         ));
            AddChild(new DialogGUIHorizontalLayout(
                         new DialogGUIButton(Localizer.Format("#LOC_BV_Control_CurrentWaypoint"), model.CurrentWaypointButtonClicked, model.EnableButtons, 124f, CommonWindowProperties.buttonHeight - 4, false)
                         ));

            AddChild(new DialogGUISpace(3f));

            AddChild(new DialogGUIHorizontalLayout(
                         new DialogGUIFlexibleSpace(),
                         TooltipExtension.DeferTooltip(new DialogGUIButton(Localizer.Format("#LOC_BV_Control_Check"), model.SystemCheckButtonClicked, model.EnableButtons, 120f, CommonWindowProperties.buttonHeight, false)
            {
                tooltipText = Localizer.Format("#LOC_BV_Control_Check_Tooltip")
            }),
                         new DialogGUIFlexibleSpace()
                         ));

            AddChild(new DialogGUISpace(5f));

            AddChild(new DialogGUIHorizontalLayout(
                         new DialogGUIFlexibleSpace(),
                         new DialogGUIButton(model.GetGoButtonText, model.GoButtonClicked, null, 120f, CommonWindowProperties.buttonHeight + 4, false, CommonWindowProperties.Style_Button_Bold_Yellow),
                         new DialogGUIFlexibleSpace()
                         ));
        }
示例#3
0
        /// <summary>
        /// Show control window dialog
        /// </summary>
        private void ShowControlWindow()
        {
            if (ControlView == null)
            {
                if (ControlModel == null) // Create model for the Settings View
                {
                    ControlModel = new ControlWindowModel();
                }

                if (HighLogic.LoadedSceneIsFlight)
                {
                    ControlModel.SetController(GetControllerOfVessel(FlightGlobals.ActiveVessel));
                }
                else
                {
                    ControlModel.SetController(null);
                }
                ControlView = new ControlWindowView(ControlModel, ToggleControlWindow);
                ControlView.Show();
            }
        }