Beispiel #1
0
        protected Window(string windowTitle, float defaultWidth, float defaultHeight)
        {
            _logger           = new Logger(this);
            UiScale           = 1f;
            Resizable         = true;
            HideCloseButton   = false;
            HideWhenPaused    = true;
            defaultWindowSize = new Vector2(defaultWidth, defaultHeight);

            this.windowTitle = windowTitle;
            this.windowId    = windowTitle.GetHashCode() + new System.Random().Next(65536);

            configNodeName = windowTitle.Replace(" ", "");

            windowPos = new Rect((Screen.width - wScale(defaultWindowSize.x)) / 2, (Screen.height - wScale(defaultWindowSize.y)) / 2, wScale(defaultWindowSize.x), wScale(defaultWindowSize.y));
            mouseDown = false;
            visible   = false;

            var texture = TextureHelper.FromResource("ScienceChecklist.icons.resize.png", 16, 16);

            resizeContent = (texture != null) ? new GUIContent(texture, "Drag to resize the window") : new GUIContent("R", "Drag to resize the window");

            var closetexture = TextureHelper.FromResource("ScienceChecklist.icons.close.png", 16, 16);

            closeContent = (closetexture != null) ? new GUIContent(closetexture, "Close window") : new GUIContent("X", "Close window");
        }
Beispiel #2
0
        public StatusWindow(ScienceChecklistAddon Parent)
            : base("[x] Science! Here and Now", 250, 30)
        {
            _parent                      = Parent;
            _logger                      = new Logger(this);
            _filter                      = new ExperimentFilter(_parent);
            _filter.DisplayMode          = DisplayMode.CurrentSituation;
            _filter.EnforceLabLanderMode = true;

            _emptyTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false);
            _emptyTexture.SetPixels(new[] { Color.clear });
            _emptyTexture.Apply();
            _progressTexture = TextureHelper.FromResource("ScienceChecklist.icons.scienceProgress.png", 13, 13);
            _completeTexture = TextureHelper.FromResource("ScienceChecklist.icons.scienceComplete.png", 13, 13);

            _availableScienceExperiments = new Dictionary <string, bool>( );

            _parent.Config.HideCompleteEventsChanged      += (s, e) => RefreshFilter(s, e);
            _parent.Config.CompleteWithoutRecoveryChanged += (s, e) => RefreshFilter(s, e);

            _parent.ScienceEventHandler.FilterUpdateEvent += (s, e) => RefreshFilter(s, e);
            _parent.ScienceEventHandler.SituationChanged  += (s, e) => UpdateSituation(s, e);
            this.Resizable = false;
            _filter.UpdateFilter( );
        }
Beispiel #3
0
        /// <summary>
        /// Creates a new instance of the ScienceWindow class.
        /// </summary>
        public ScienceWindow()
        {
            _logger                  = new Logger(this);
            _rect                    = new Rect(40, 40, 500, 400);
            _rect3                   = new Rect(40, 40, 400, 200);
            _scrollPos               = new Vector2();
            _filter                  = new ExperimentFilter();
            _progressTexture         = TextureHelper.FromResource("ScienceChecklist.icons.scienceProgress.png", 13, 13);
            _completeTexture         = TextureHelper.FromResource("ScienceChecklist.icons.scienceComplete.png", 13, 13);
            _progressTextureCompact  = TextureHelper.FromResource("ScienceChecklist.icons.scienceProgressCompact.png", 8, 8);
            _completeTextureCompact  = TextureHelper.FromResource("ScienceChecklist.icons.scienceCompleteCompact.png", 8, 8);
            _currentSituationTexture = TextureHelper.FromResource("ScienceChecklist.icons.currentSituation.png", 25, 21);
            _currentVesselTexture    = TextureHelper.FromResource("ScienceChecklist.icons.currentVessel.png", 25, 21);
            _unlockedTexture         = TextureHelper.FromResource("ScienceChecklist.icons.unlocked.png", 25, 21);
            _allTexture              = TextureHelper.FromResource("ScienceChecklist.icons.all.png", 25, 21);
            _searchTexture           = TextureHelper.FromResource("ScienceChecklist.icons.search.png", 25, 21);
            _clearSearchTexture      = TextureHelper.FromResource("ScienceChecklist.icons.clearSearch.png", 25, 21);
            _settingsTexture         = TextureHelper.FromResource("ScienceChecklist.icons.settings.png", 25, 21);
            _maximizeTexture         = TextureHelper.FromResource("ScienceChecklist.icons.minimize.png", 25, 21);
            _minimizeTexture         = TextureHelper.FromResource("ScienceChecklist.icons.maximize.png", 25, 21);

            _emptyTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false);
            _emptyTexture.SetPixels(new[] { Color.clear });
            _emptyTexture.Apply();
            _settingsPanel = new SettingsPanel();
            _settingsPanel.HideCompleteEventsChanged      += (s, e) => _filter.UpdateFilter( );
            _settingsPanel.CheckDebrisChanged             += (s, e) => _filter.UpdateExperiments( );
            _settingsPanel.CompleteWithoutRecoveryChanged += (s, e) => _filter.UpdateFilter( );
        }
Beispiel #4
0
        public StatusWindow(ScienceChecklistAddon Parent)
            : base(Localizer.Format("#autoLOC_[x]_Science!_129") /*[x] Science! Here and Now*/, 250, 30)
        {
            _parent                      = Parent;
            UiScale                      = _parent.Config.UiScale;
            _logger                      = new Logger(this);
            _filter                      = new ExperimentFilter(_parent);
            _filter.DisplayMode          = DisplayMode.CurrentSituation;
            _filter.EnforceLabLanderMode = true;

            _emptyTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false);
            _emptyTexture.SetPixels(new[] { Color.clear });
            _emptyTexture.Apply();
            _progressTexture = TextureHelper.FromResource("ScienceChecklist.icons.scienceProgress.png", 13, 13);
            _completeTexture = TextureHelper.FromResource("ScienceChecklist.icons.scienceComplete.png", 13, 13);

            _GfxTimeWarp         = TextureHelper.FromResource("ScienceChecklist.icons.time-warp.png", 13, 13);
            _GfxTimeWarpOff      = TextureHelper.FromResource("ScienceChecklist.icons.time-warp-x.png", 13, 13);
            _GfxAudioAlert       = TextureHelper.FromResource("ScienceChecklist.icons.audio-alert.png", 13, 13);
            _GfxAudioAlertOff    = TextureHelper.FromResource("ScienceChecklist.icons.audio-alert-off.png", 13, 13);
            _GfxResultsWindow    = TextureHelper.FromResource("ScienceChecklist.icons.report.png", 13, 13);
            _GfxResultsWindowOff = TextureHelper.FromResource("ScienceChecklist.icons.report-x.png", 13, 13);

            _availableScienceExperiments = new Dictionary <string, bool>( );

            _parent.Config.HideCompleteEventsChanged      += (s, e) => RefreshFilter(s, e);
            _parent.Config.CompleteWithoutRecoveryChanged += (s, e) => RefreshFilter(s, e);

            _parent.ScienceEventHandler.FilterUpdateEvent += (s, e) => RefreshFilter(s, e);
            _parent.ScienceEventHandler.SituationChanged  += (s, e) => UpdateSituation(s, e);
            this.Resizable = false;
            _filter.UpdateFilter( );
            _parent.Config.UiScaleChanged += OnUiScaleChange;
        }
        public ScienceWindow(ScienceChecklistAddon Parent, SettingsWindow settingsWindow, HelpWindow helpWindow)
        {
            _parent         = Parent;
            _settingsWindow = settingsWindow;
            _helpWindow     = helpWindow;

            _logger       = new Logger(this);
            _defaultSize  = new Vector2(500, 400);
            _rect         = wScale(new Rect(40, 40, _defaultSize.x, _defaultSize.y));
            _defaultSize3 = new Vector2(400, 200);
            _rect3        = wScale(new Rect(40, 40, _defaultSize3.x, _defaultSize3.y));
            _scrollPos    = new Vector2();
            _filter       = new ExperimentFilter(_parent);

            _progressTexture         = TextureHelper.FromResource("ScienceChecklist.icons.scienceProgress.png", 13, 13);
            _completeTexture         = TextureHelper.FromResource("ScienceChecklist.icons.scienceComplete.png", 13, 13);
            _progressTextureCompact  = TextureHelper.FromResource("ScienceChecklist.icons.scienceProgressCompact.png", 8, 8);
            _completeTextureCompact  = TextureHelper.FromResource("ScienceChecklist.icons.scienceCompleteCompact.png", 8, 8);
            _currentSituationTexture = TextureHelper.FromResource("ScienceChecklist.icons.currentSituation.png", 25, 21);
            _currentVesselTexture    = TextureHelper.FromResource("ScienceChecklist.icons.currentVessel.png", 25, 21);
            _notCurrentVesselTexture = TextureHelper.FromResource("ScienceChecklist.icons.notCurrentVessel.png", 25, 21);
            _unlockedTexture         = TextureHelper.FromResource("ScienceChecklist.icons.unlocked.png", 25, 21);
            _allTexture         = TextureHelper.FromResource("ScienceChecklist.icons.all.png", 25, 21);
            _searchTexture      = TextureHelper.FromResource("ScienceChecklist.icons.search.png", 25, 21);
            _clearSearchTexture = TextureHelper.FromResource("ScienceChecklist.icons.clearSearch.png", 25, 21);
            _minimizeTexture    = TextureHelper.FromResource("ScienceChecklist.icons.minimize.png", 16, 16);
            _maximizeTexture    = TextureHelper.FromResource("ScienceChecklist.icons.maximize.png", 16, 16);
            _closeTexture       = TextureHelper.FromResource("ScienceChecklist.icons.close.png", 16, 16);
            _helpTexture        = TextureHelper.FromResource("ScienceChecklist.icons.help.png", 16, 16);
            _settingsTexture    = TextureHelper.FromResource("ScienceChecklist.icons.settings.png", 16, 16);

            _emptyTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false);
            _emptyTexture.SetPixels(new[] { Color.clear });
            _emptyTexture.Apply();

            _parent.Config.HideCompleteEventsChanged      += (s, e) => RefreshFilter(s, e);
            _parent.Config.CompleteWithoutRecoveryChanged += (s, e) => RefreshFilter(s, e);

            _parent.ScienceEventHandler.FilterUpdateEvent += (s, e) => RefreshFilter(s, e);
            _parent.ScienceEventHandler.SituationChanged  += (s, e) => UpdateSituation(s, e);

            _parent.Config.UiScaleChanged += OnUiScaleChange;
        }
Beispiel #6
0
        // Add the buttons
        private void AddButtons( )
        {
            Texture2D StockTexture;



            _checklistButton = new UnifiedButton( );


            if (BlizzysToolbarButton.IsAvailable)
            {
                _checklistButton.UseBlizzyIfPossible = Config.UseBlizzysToolbar;

                var texturePath = "ScienceChecklist/ChecklistSmall.png";
                if (!GameDatabase.Instance.ExistsTexture(texturePath))
                {
                    var texture = TextureHelper.FromResource("ScienceChecklist.icons.icon-small.png", 24, 24);
                    var ti      = new GameDatabase.TextureInfo(null, texture, false, true, true);
                    ti.name = texturePath;
                    GameDatabase.Instance.databaseTexture.Add(ti);
                }
//				_logger.Info( "Load : Blizzy texture" );


                _checklistButton.BlizzyNamespace   = WINDOW_NAME_CHECKLIST;
                _checklistButton.BlizzyButtonId    = "checklist_button";
                _checklistButton.BlizzyToolTip     = "[x] Science! Checklist";
                _checklistButton.BlizzyText        = "Science Report and Checklist";
                _checklistButton.BlizzyTexturePath = texturePath;
                _checklistButton.BlizzyVisibility  = new GameScenesVisibility(GameScenes.SPACECENTER, GameScenes.EDITOR, GameScenes.FLIGHT, GameScenes.TRACKSTATION);
//				_logger.Info( "Load : Set Blizzy Stuff" );
            }



            StockTexture = TextureHelper.FromResource("ScienceChecklist.icons.icon.png", 38, 38);

/*			if( StockTexture != null )
 *                              _logger.Info( "Load : Stock texture" );
 *                      else
 *                              _logger.Info( "Load : cant load texture" );*/
            _checklistButton.LauncherTexture    = StockTexture;
            _checklistButton.LauncherVisibility =
                ApplicationLauncher.AppScenes.SPACECENTER |
                ApplicationLauncher.AppScenes.FLIGHT |
                ApplicationLauncher.AppScenes.MAPVIEW |
                ApplicationLauncher.AppScenes.VAB |
                ApplicationLauncher.AppScenes.SPH |
                ApplicationLauncher.AppScenes.TRACKSTATION;
//			_logger.Info( "Load : Set Stock Stuff" );


            _checklistButton.ButtonOn   += ChecklistButton_Open;
            _checklistButton.ButtonOff  += ChecklistButton_Close;
            _checklistButton.RightClick += ChecklistButton_RightClick;
            _checklistButton.Add( );



            if (Config.RighClickMutesMusic)              // So we need both buttons
            {
                _statusButton = new UnifiedButton( );


                if (BlizzysToolbarButton.IsAvailable)
                {
                    _statusButton.UseBlizzyIfPossible = Config.UseBlizzysToolbar;

                    var texturePath = "ScienceChecklist/StatusSmall.png";
                    if (!GameDatabase.Instance.ExistsTexture(texturePath))
                    {
                        var texture = TextureHelper.FromResource("ScienceChecklist.icons.icon-status-small.png", 24, 24);
                        var ti      = new GameDatabase.TextureInfo(null, texture, false, true, true);
                        ti.name = texturePath;
                        GameDatabase.Instance.databaseTexture.Add(ti);
                    }
                    //				_logger.Info( "Load : Blizzy texture" );


                    _statusButton.BlizzyNamespace   = WINDOW_NAME_CHECKLIST;
                    _statusButton.BlizzyButtonId    = "status_button";
                    _statusButton.BlizzyToolTip     = "[x] Science! Here & Now";
                    _statusButton.BlizzyText        = "Science Status Window";
                    _statusButton.BlizzyTexturePath = texturePath;
                    _statusButton.BlizzyVisibility  = new GameScenesVisibility(GameScenes.FLIGHT);
                    //				_logger.Info( "Load : Set Blizzy Stuff" );
                }



                StockTexture = TextureHelper.FromResource("ScienceChecklist.icons.icon-status.png", 38, 38);

                /*			if( StockTexture != null )
                 *                              _logger.Info( "Load : Stock texture" );
                 *                      else
                 *                              _logger.Info( "Load : cant load texture" );*/
                _statusButton.LauncherTexture    = StockTexture;
                _statusButton.LauncherVisibility =
                    ApplicationLauncher.AppScenes.FLIGHT |
                    ApplicationLauncher.AppScenes.MAPVIEW;
                //			_logger.Info( "Load : Set Stock Stuff" );


                _statusButton.ButtonOn  += StatusButton_Open;
                _statusButton.ButtonOff += StatusButton_Close;
                _statusButton.Add( );
            }
        }
        // Add the buttons
        private void AddButtons()
        {
            //Texture2D StockTexture;

            if (checklistToolbarControl == null)
            {
                checklistToolbarControl = gameObject.AddComponent <ToolbarControl>();
                checklistToolbarControl.AddToAllToolbars(null, null,
                                                         ApplicationLauncher.AppScenes.SPACECENTER |
                                                         ApplicationLauncher.AppScenes.FLIGHT |
                                                         ApplicationLauncher.AppScenes.MAPVIEW |
                                                         ApplicationLauncher.AppScenes.VAB |
                                                         ApplicationLauncher.AppScenes.SPH |
                                                         ApplicationLauncher.AppScenes.TRACKSTATION,
                                                         MODID,
                                                         "xScienceButton1",
                                                         "[x]_Science!/PluginData/Icons/icon",
                                                         "[x]_Science!/PluginData/Icons/icon-small",
                                                         MODNAME
                                                         );
                checklistToolbarControl.AddLeftRightClickCallbacks(LeftButtonToggle, RightButton);
            }

            //_checklistButton = new UnifiedButton( gameObject, 1);

#if false
            if (BlizzysToolbarButton.IsAvailable)
            {
                _checklistButton.UseBlizzyIfPossible = Config.UseBlizzysToolbar;

                var texturePath = "ScienceChecklist/ChecklistSmall.png";
                if (!GameDatabase.Instance.ExistsTexture(texturePath))
                {
                    var texture = TextureHelper.FromResource("ScienceChecklist.icons.icon-small.png", 24, 24);
                    var ti      = new GameDatabase.TextureInfo(null, texture, false, true, true);
                    ti.name = texturePath;
                    GameDatabase.Instance.databaseTexture.Add(ti);
                }
//				_logger.Info( "Load : Blizzy texture" );


                _checklistButton.BlizzyNamespace   = WINDOW_NAME_CHECKLIST;
                _checklistButton.BlizzyButtonId    = "checklist_button";
                _checklistButton.BlizzyToolTip     = "[x] Science! Checklist";
                _checklistButton.BlizzyText        = "Science Report and Checklist";
                _checklistButton.BlizzyTexturePath = texturePath;
                _checklistButton.BlizzyVisibility  = new GameScenesVisibility(GameScenes.SPACECENTER, GameScenes.EDITOR, GameScenes.FLIGHT, GameScenes.TRACKSTATION);
//				_logger.Info( "Load : Set Blizzy Stuff" );
            }



            StockTexture = TextureHelper.FromResource("ScienceChecklist.icons.icon.png", 38, 38);

/*			if( StockTexture != null )
 *                              _logger.Info( "Load : Stock texture" );
 *                      else
 *                              _logger.Info( "Load : cant load texture" );*/
            _checklistButton.LauncherTexture    = StockTexture;
            _checklistButton.LauncherVisibility =
                ApplicationLauncher.AppScenes.SPACECENTER |
                ApplicationLauncher.AppScenes.FLIGHT |
                ApplicationLauncher.AppScenes.MAPVIEW |
                ApplicationLauncher.AppScenes.VAB |
                ApplicationLauncher.AppScenes.SPH |
                ApplicationLauncher.AppScenes.TRACKSTATION;
//			_logger.Info( "Load : Set Stock Stuff" );


            _checklistButton.ButtonOn   += ChecklistButton_Open;
            _checklistButton.ButtonOff  += ChecklistButton_Close;
            _checklistButton.RightClick += ChecklistButton_RightClick;
            _checklistButton.Add( );
#endif


            if (Config.RighClickMutesMusic) // So we need both buttons
            {
#if false
                _statusButton = new UnifiedButton(gameObject, 2);

                if (BlizzysToolbarButton.IsAvailable)
                {
                    _statusButton.UseBlizzyIfPossible = Config.UseBlizzysToolbar;

                    var texturePath = "ScienceChecklist/StatusSmall.png";
                    if (!GameDatabase.Instance.ExistsTexture(texturePath))
                    {
                        var texture = TextureHelper.FromResource("ScienceChecklist.icons.icon-status-small.png", 24, 24);
                        var ti      = new GameDatabase.TextureInfo(null, texture, false, true, true);
                        ti.name = texturePath;
                        GameDatabase.Instance.databaseTexture.Add(ti);
                    }
                    //				_logger.Info( "Load : Blizzy texture" );


                    _statusButton.BlizzyNamespace   = WINDOW_NAME_CHECKLIST;
                    _statusButton.BlizzyButtonId    = "status_button";
                    _statusButton.BlizzyToolTip     = "[x] Science! Here & Now";
                    _statusButton.BlizzyText        = "Science Status Window";
                    _statusButton.BlizzyTexturePath = texturePath;
                    _statusButton.BlizzyVisibility  = new GameScenesVisibility(GameScenes.FLIGHT);
                    //				_logger.Info( "Load : Set Blizzy Stuff" );
                }
                UnifiedButton.toolbarControl.SetTexture("[x]_Science!/PluginData/Icons/icon-status", "[x]_Science!/PluginData/Icons/icon-status-small");



                StockTexture = TextureHelper.FromResource("ScienceChecklist.icons.icon-status.png", 38, 38);

                /*			if( StockTexture != null )
                 *                              _logger.Info( "Load : Stock texture" );
                 *                      else
                 *                              _logger.Info( "Load : cant load texture" );*/
                _statusButton.LauncherTexture    = StockTexture;
                _statusButton.LauncherVisibility =
                    ApplicationLauncher.AppScenes.FLIGHT |
                    ApplicationLauncher.AppScenes.MAPVIEW;
                //			_logger.Info( "Load : Set Stock Stuff" );


                _statusButton.ButtonOn  += StatusButton_Open;
                _statusButton.ButtonOff += StatusButton_Close;
                _statusButton.Add( );
#endif
                if (statusToolbarControl == null)
                {
                    statusToolbarControl = gameObject.AddComponent <ToolbarControl>();
                    statusToolbarControl.AddToAllToolbars(StatusButton_Open, StatusButton_Close,
                                                          ApplicationLauncher.AppScenes.FLIGHT |
                                                          ApplicationLauncher.AppScenes.MAPVIEW,
                                                          MODID + "2",
                                                          "xScienceButton2",
                                                          "[x]_Science!/PluginData/Icons/icon-status",
                                                          "[x]_Science!/PluginData/Icons/icon-status-small",
                                                          WINDOW_CHECKLIST
                                                          );
                }
            }
            if (statusToolbarControl != null)
            {
                if (_statusWindow.IsVisible())
                {
                    statusToolbarControl.SetTrue(true);
                }
                else
                {
                    statusToolbarControl.SetFalse(true);
                }
            }
        }