public override void Close()
 {
     callBack = delegate
     {
     };
     selectedPreset = null;
     base.Close();
 }
        private void CreateColorList()
        {
            if (isInitialized)
            {
                return;
            }

            isInitialized = true;
            colors2Display.Clear();
            foreach (ConfigNode colorNode in GameDatabase.Instance.GetConfigNodes("KK_ColorPreset2"))
            {
                if (colorNode.HasValue("Name") && colorNode.HasValue("GrassColor"))
                {
                    ColorPreset2 preset = new ColorPreset2();
                    preset.name = colorNode.GetValue("Name");
                    Log.Normal("Adding Color to List" + preset.name);
                    preset.grassColor = ConfigNode.ParseColor(colorNode.GetValue("GrassColor"));
                    if (colorNode.HasValue("NearGrassTexture"))
                    {
                        preset.nearGrassTexture = colorNode.GetValue("NearGrassTexture");
                    }
                    if (colorNode.HasValue("FarGrassTexture"))
                    {
                        preset.farGrassTexture = colorNode.GetValue("FarGrassTexture");
                    }
                    if (colorNode.HasValue("TarmacTexture"))
                    {
                        preset.tarmacTexture = colorNode.GetValue("TarmacTexture");
                    }
                    if (colorNode.HasValue("TarmacColor"))
                    {
                        preset.tarmacColor = ConfigNode.ParseColor(colorNode.GetValue("TarmacColor"));
                    }
                    colors2Display.Add(preset);
                }
            }
        }
        private void ColorSelectorWindow(int WindowID)
        {
            GUI.enabled = true;

            GUILayout.BeginHorizontal();
            {
                GUI.enabled = false;
                GUILayout.Button("-KK-", UIMain.DeadButton, GUILayout.Height(21));

                GUILayout.FlexibleSpace();

                GUILayout.Button(titleText, UIMain.DeadButton, GUILayout.Height(21));

                GUILayout.FlexibleSpace();

                GUI.enabled = true;

                if (GUILayout.Button("X", UIMain.DeadButtonRed, GUILayout.Height(21)))
                {
                    //KerbalKonstructs.instance.saveObjects();
                    this.Close();
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(1);
            GUILayout.Box(UIMain.tHorizontalSep.texture, UIMain.BoxNoBorder, GUILayout.Height(4));



            scrollPointer = GUILayout.BeginScrollView(scrollPointer);
            {
                foreach (ColorPreset2 preset in colors2Display)
                {
                    GUI.enabled = (selectedPreset != preset);
                    if (GUILayout.Button(preset.name))
                    {
                        selectedPreset = preset;
                        callBack.Invoke(selectedPreset);
                        this.Close();
                    }
                }
                GUI.enabled = true;
            }
            GUILayout.EndScrollView();
            GUI.enabled = true;
            GUILayout.BeginHorizontal();
            {
                //if (GUILayout.Button("OK", GUILayout.Height(23)))
                //{
                //    callBack.Invoke(selectedPreset.color, selectedPreset.texture);
                //    this.Close();
                //}
                if (GUILayout.Button("Cancel", GUILayout.Height(23)))
                {
                    this.Close();
                }
            }
            GUILayout.EndHorizontal();

            GUI.DragWindow(new Rect(0, 0, 10000, 10000));
        }