Пример #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>
        /// Show dialog window
        /// </summary>
        /// <returns></returns>
        internal PopupDialog Show()
        {
            if (dialog == null)
            {
                dialog = PopupDialog.SpawnPopupDialog(
                    CommonWindowProperties.controlWindowAnchorMin, // min anchor
                    CommonWindowProperties.controlWindowAnchorMax, // max anchor
                    new MultiOptionDialog(
                        "BVControlWindow",                         // name
                        "",                                        // message
                        Localizer.Format("#LOC_BV_Title"),         // title
                        CommonWindowProperties.ActiveSkin,         // skin
                        geometry,                                  // position and size
                        this                                       // dialog layout
                        ),
                    false,                                         // persist across scenes
                    CommonWindowProperties.ActiveSkin,             // skin
                    false                                          // is modal
                    );

                CommonWindowProperties.AddFloatingButton(
                    dialog.transform,
                    -CommonWindowProperties.controlElementPadding.right - CommonWindowProperties.controlWindowSpacing, -CommonWindowProperties.controlElementPadding.top,
                    CommonWindowProperties.ActiveSkin.button,
                    "X",
                    Localizer.Format("#LOC_BV_Close"),
                    closeCallback
                    );
            }

            return(dialog);
        }
Пример #3
0
 /// <summary>
 /// Change active skin
 /// </summary>
 private void ChangeSkin()
 {
     if (kspSkin)
     {
         CommonWindowProperties.ActiveSkin = UISkinManager.defaultSkin;
         Configuration.Skin = 0;
     }
     else
     {
         CommonWindowProperties.ActiveSkin = CommonWindowProperties.UnitySkin;
         Configuration.Skin = 1;
     }
     CommonWindowProperties.RefreshStyles();
     BonVoyage.Instance.ResetWindows();
 }
Пример #4
0
        /// <summary>
        /// Get Unity skin - only accessible in OnGUI
        /// </summary>
        void OnGUI()
        {
            if (GamePaused && !ShowUI)
            {
                return;
            }

            if (CommonWindowProperties.UnitySkin == null)
            {
                CommonWindowProperties.UnitySkin = StyleConverter.Convert(GUI.skin);

                // Load Unity skin, if it was saved in the config
                if (Configuration.Skin == 1)
                {
                    CommonWindowProperties.ActiveSkin = CommonWindowProperties.UnitySkin;
                    CommonWindowProperties.RefreshStyles();
                }
            }
        }