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.LoadImage("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.LoadImage("icons\\close.png", 16, 16); closeContent = (closetexture != null) ? new GUIContent(closetexture, "Close window") : new GUIContent("X", "Close window"); }
public StatusWindow(ScienceChecklistAddon Parent) : base("[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.LoadImage("icons\\scienceProgress.png", 13, 13); _completeTexture = TextureHelper.LoadImage("icons\\scienceComplete.png", 13, 13); _GfxTimeWarp = TextureHelper.LoadImage("icons\\time-warp.png", 13, 13); _GfxTimeWarpOff = TextureHelper.LoadImage("icons\\time-warp-x.png", 13, 13); _GfxAudioAlert = TextureHelper.LoadImage("icons\\audio-alert.png", 13, 13); _GfxAudioAlertOff = TextureHelper.LoadImage("icons\\audio-alert-off.png", 13, 13); _GfxResultsWindow = TextureHelper.LoadImage("icons\\report.png", 13, 13); _GfxResultsWindowOff = TextureHelper.LoadImage("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.LoadImage("icons\\scienceProgress.png", 13, 13); _completeTexture = TextureHelper.LoadImage("icons\\scienceComplete.png", 13, 13); _progressTextureCompact = TextureHelper.LoadImage("icons\\scienceProgressCompact.png", 8, 8); _completeTextureCompact = TextureHelper.LoadImage("icons\\scienceCompleteCompact.png", 8, 8); _currentSituationTexture = TextureHelper.LoadImage("icons\\currentSituation.png", 25, 21); _currentVesselTexture = TextureHelper.LoadImage("icons\\currentVessel.png", 25, 21); _unlockedTexture = TextureHelper.LoadImage("icons\\unlocked.png", 25, 21); _allTexture = TextureHelper.LoadImage("icons\\all.png", 25, 21); _searchTexture = TextureHelper.LoadImage("icons\\search.png", 25, 21); _clearSearchTexture = TextureHelper.LoadImage("icons\\clearSearch.png", 25, 21); _minimizeTexture = TextureHelper.LoadImage("icons\\minimize.png", 16, 16); _maximizeTexture = TextureHelper.LoadImage("icons\\maximize.png", 16, 16); _closeTexture = TextureHelper.LoadImage("icons\\close.png", 16, 16); _helpTexture = TextureHelper.LoadImage("icons\\help.png", 16, 16); _settingsTexture = TextureHelper.LoadImage("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; }
// 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.LoadImage("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.LoadImage("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.LoadImage("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.LoadImage("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( ); } }