protected override Rect Setup()
        {
            formatter = (System.Globalization.NumberFormatInfo)System.Globalization.NumberFormatInfo.CurrentInfo.Clone();
            formatter.CurrencySymbol        = string.Empty;
            formatter.CurrencyDecimalDigits = 2;
            formatter.NumberDecimalDigits   = 2;
            formatter.PercentDecimalDigits  = 2;
            audio = AudioPlayer.Audio;
            if (audio == null)
            {
                Log.Debug("[ScienceAlert]:DraggableOptionsWindow: Failed to find AudioPlayer instance");
            }

            filterList.Add(new GUIContent("Unresearched"));
            filterList.Add(new GUIContent("Not maxed"));
            filterList.Add(new GUIContent("< 50% collected"));
            filterList.Add(new GUIContent("< 90% collected"));

            openButton     = ResourceUtil.GetEmbeddedTexture("Textures.btnOpen.png");
            deleteButton   = ResourceUtil.GetEmbeddedTexture("Textures.btnDelete.png");
            renameButton   = ResourceUtil.GetEmbeddedTexture("Textures.btnRename.png");
            saveButton     = ResourceUtil.GetEmbeddedTexture("Textures.btnSave.png");
            expandButton   = ResourceUtil.GetEmbeddedTexture("Textures.btnExpand.png");
            collapseButton = Instantiate(expandButton);
            ResourceUtil.FlipTexture(collapseButton, true, true);
            collapseButton.Compress(false);
            expandButton.Compress(false);

            blackPixel.SetPixel(0, 0, Color.black);
            blackPixel.Apply();
            blackPixel.filterMode = FilterMode.Bilinear;
            whiteLabel            = Instantiate(Settings.Skin);
            whiteLabel.label.onNormal.textColor  = Color.white;
            whiteLabel.toggle.onNormal.textColor = Color.white;
            whiteLabel.label.onActive.textColor  = Color.white;
            submenu       = OpenPane.None;
            Title         = "ScienceAlert Options";
            miniLabelLeft = new GUIStyle(Skin.label)
            {
                fontSize = 10
            };
            miniLabelLeft.normal.textColor = miniLabelLeft.onNormal.textColor = Color.white;
            miniLabelRight = new GUIStyle(miniLabelLeft)
            {
                alignment = TextAnchor.MiddleRight
            };
            miniLabelCenter = new GUIStyle(miniLabelLeft)
            {
                alignment = TextAnchor.MiddleCenter
            };
            Settings.Instance.OnSave += OnAboutToSave;
            OnVisibilityChange       += OnVisibilityChanged;
            GameEvents.onVesselChange.Add(OnVesselChanged);
            LoadFrom(Settings.Instance.additional.GetNode("OptionsWindow") ?? new ConfigNode());
            return(new Rect(windowRect.x, windowRect.y, 324f, Screen.height / 5 * 3));
        }
        /******************************************************************************
        *                    Implementation Details
        ******************************************************************************/

        protected override Rect Setup()
        {
            // position blocker in front of ApplicationLauncher buttons. The window is going to be drawn on
            // top of them regardless; this will just prevent us from accidentally interacting with them
            backstop.SetZ(ApplicationLauncher.Instance.anchor.transform.position.z - 50f);

            // culture setting
            Log.Normal("Configuring NumberFormatInfo for current locale");
            formatter = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone();
            formatter.CurrencySymbol        = string.Empty;
            formatter.CurrencyDecimalDigits = 2;
            formatter.NumberDecimalDigits   = 2;
            formatter.PercentDecimalDigits  = 2;


            audio = AudioPlayer.Audio;

            if (audio == null)
            {
                Log.Error("DraggableOptionsWindow: Failed to find AudioPlayer instance");
            }


            var rawIds    = ResearchAndDevelopment.GetExperimentIDs();
            var sortedIds = rawIds.OrderBy(expid => ResearchAndDevelopment.GetExperiment(expid).experimentTitle);

            Log.Debug("OptionsWindow: sorted {0} experiment IDs", sortedIds.Count());

            foreach (var id in sortedIds)
            {
                experimentIds.Add(id, (int)Convert.ChangeType(ProfileManager.ActiveProfile[id].Filter, ProfileManager.ActiveProfile[id].Filter.GetTypeCode()));
                Log.Debug("Settings: experimentId {0} has filter index {1}", id, experimentIds[id]);
            }

            /*
             *  Unresearched = 0,
             *  NotMaxed = 1,
             *  LessThanFiftyPercent = 2,
             *  LessThanNinetyPercent = 3
             */
            filterList.Add(new GUIContent("Unresearched"));
            filterList.Add(new GUIContent("Not maxed"));
            filterList.Add(new GUIContent("< 50% collected"));
            filterList.Add(new GUIContent("< 90% collected"));


            openButton   = ResourceUtil.GetEmbeddedTexture("ScienceAlert.Resources.btnOpen.png", false);
            saveButton   = ResourceUtil.GetEmbeddedTexture("ScienceAlert.Resources.btnSave.png", false);
            returnButton = ResourceUtil.GetEmbeddedTexture("ScienceAlert.Resources.btnReturn.png", false);
            deleteButton = ResourceUtil.GetEmbeddedTexture("ScienceAlert.Resources.btnDelete.png", false);
            renameButton = ResourceUtil.GetEmbeddedTexture("ScienceAlert.Resources.btnRename.png", false);

            var tex = ResourceUtil.GetEmbeddedTexture("ScienceAlert.Resources.btnExpand.png", false);

            if (tex == null)
            {
                Log.Error("Failed to retrieve expand button texture from stream");
            }
            else
            {
                Log.Debug("Collapse button texture loaded successfully");
                expandButton = tex;

                collapseButton = UnityEngine.Texture.Instantiate(expandButton) as Texture2D;
                ResourceUtil.FlipTexture(collapseButton, true, true);

                collapseButton.Compress(false);
                expandButton.Compress(false);
            }

            blackPixel.SetPixel(0, 0, Color.black); blackPixel.Apply();
            blackPixel.filterMode = FilterMode.Bilinear;

            whiteLabel = (GUISkin)GUISkin.Instantiate(Settings.Skin);
            whiteLabel.label.onNormal.textColor  = Color.white;
            whiteLabel.toggle.onNormal.textColor = Color.white;
            whiteLabel.label.onActive.textColor  = Color.white;

            submenu = OpenPane.None;
            Title   = "ScienceAlert Options";

            // smaller label for less important text hints
            miniLabelLeft                  = new GUIStyle(Skin.label);
            miniLabelLeft.fontSize         = 10;
            miniLabelLeft.normal.textColor = miniLabelLeft.onNormal.textColor = Color.white;

            miniLabelRight           = new GUIStyle(miniLabelLeft);
            miniLabelRight.alignment = TextAnchor.MiddleRight;

            miniLabelCenter           = new GUIStyle(miniLabelLeft);
            miniLabelCenter.alignment = TextAnchor.MiddleCenter;

            Settings.Instance.OnSave += OnAboutToSave;
            base.OnVisibilityChange  += OnVisibilityChanged;
            GameEvents.onVesselChange.Add(OnVesselChanged);

            LoadFrom(Settings.Instance.additional.GetNode("OptionsWindow") ?? new ConfigNode());

            return(new Rect(windowRect.x, windowRect.y, 324, Screen.height / 5 * 3));
        }