Пример #1
0
 public void Dispose()
 {
     ReflectionTexture.Clear();
     BgTexture.Clear();
     SkyTexture.Clear();
     Wallpaper.Clear();
 }
        private static void ResetDoDefault(ModConfiguration config)
        {
            var template = new ModConfiguration();

            config.BackgroundColor = template.BackgroundColor;
            BgTexture.SetPixel(0, 0, config.BackgroundColor);
            BgTexture.Apply();

            config.TitleBarColor = template.TitleBarColor;
            MoveNormalTexture.SetPixel(0, 0, config.TitleBarColor);
            MoveNormalTexture.Apply();

            MoveHoverTexture.SetPixel(0, 0, config.TitleBarColor * 1.2f);
            MoveHoverTexture.Apply();

            config.TitleBarTextColor = template.TitleBarTextColor;

            config.GameObjectColor        = template.GameObjectColor;
            config.EnabledComponentColor  = template.EnabledComponentColor;
            config.DisabledComponentColor = template.DisabledComponentColor;
            config.SelectedComponentColor = template.SelectedComponentColor;
            config.NameColor       = template.NameColor;
            config.TypeColor       = template.TypeColor;
            config.ModifierColor   = template.ModifierColor;
            config.MemberTypeColor = template.MemberTypeColor;
            config.ValueColor      = template.ValueColor;
            config.FontName        = template.FontName;
            config.FontSize        = template.FontSize;
        }
Пример #3
0
        /// <summary>
        /// Read texture data and bg color from environments
        /// </summary>
        public void HandleEnvironments(RenderEnvironment.Usage usage)
        {
            SimulatedEnvironment simenv;

            switch (usage)
            {
            case RenderEnvironment.Usage.Background:

                if (BackgroundEnvironment != null)
                {
                    simenv = BackgroundEnvironment.SimulateEnvironment(true);
                    if (simenv != null)
                    {
                        BgColor = simenv.BackgroundColor;
                    }
                    BitmapConverter.EnvironmentBitmapFromEvaluator(BackgroundEnvironment, BgTexture, Gamma);
                }
                else
                {
                    BgColor = Color.Empty;
                    BgTexture.Clear();
                }
                break;

            case RenderEnvironment.Usage.Skylighting:
                if (SkylightEnvironment != null)
                {
                    simenv = SkylightEnvironment.SimulateEnvironment(true);
                    if (simenv != null)
                    {
                        SkyColor = simenv.BackgroundColor;
                    }
                    BitmapConverter.EnvironmentBitmapFromEvaluator(SkylightEnvironment, SkyTexture, Gamma);
                }
                else
                {
                    SkyColor = Color.Empty;
                    SkyTexture.Clear();
                }
                break;

            case RenderEnvironment.Usage.ReflectionAndRefraction:
                if (ReflectionEnvironment != null)
                {
                    simenv = ReflectionEnvironment.SimulateEnvironment(true);
                    if (simenv != null)
                    {
                        ReflectionColor = simenv.BackgroundColor;
                    }
                    BitmapConverter.EnvironmentBitmapFromEvaluator(ReflectionEnvironment, ReflectionTexture, Gamma);
                }
                else
                {
                    ReflectionColor = Color.Empty;
                    ReflectionTexture.Clear();
                }
                break;
            }
        }
        protected override void DrawWindow()
        {
            var config = MainWindow.Instance.Config;

            GUILayout.BeginHorizontal();
            GUILayout.Label("Font");
            GUILayout.FlexibleSpace();

            var newSelectedFont = GUIComboBox.Box(selectedFont, availableFonts, "AppearanceSettingsFonts");

            if (newSelectedFont != selectedFont && newSelectedFont >= 0)
            {
                config.FontName = availableFonts[newSelectedFont];
                selectedFont    = newSelectedFont;
                UpdateFont();
            }

            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();

            GUILayout.Label("Font size");

            var newFontSize = (int)GUILayout.HorizontalSlider(config.FontSize, 13.0f, 39.0f, GUILayout.Width(256));

            if (newFontSize != config.FontSize)
            {
                config.FontSize = newFontSize;
                UpdateFont();
            }

            GUILayout.EndHorizontal();

            var newColor = DrawColorControl("Background", config.BackgroundColor);

            if (newColor != config.BackgroundColor)
            {
                config.BackgroundColor = newColor;
                BgTexture.SetPixel(0, 0, config.BackgroundColor);
                BgTexture.Apply();
            }

            newColor = DrawColorControl("Title bar", config.TitleBarColor);
            if (newColor != config.TitleBarColor)
            {
                config.TitleBarColor = newColor;
                MoveNormalTexture.SetPixel(0, 0, config.TitleBarColor);
                MoveNormalTexture.Apply();

                MoveHoverTexture.SetPixel(0, 0, config.TitleBarColor * 1.2f);
                MoveHoverTexture.Apply();
            }

            config.TitleBarTextColor = DrawColorControl("Title bar text", config.TitleBarTextColor);

            config.GameObjectColor        = DrawColorControl("GameObject", config.GameObjectColor);
            config.EnabledComponentColor  = DrawColorControl("Component (enabled)", config.EnabledComponentColor);
            config.DisabledComponentColor = DrawColorControl("Component (disabled)", config.DisabledComponentColor);
            config.SelectedComponentColor = DrawColorControl("Selected component", config.SelectedComponentColor);
            config.KeywordColor           = DrawColorControl("Keyword", config.KeywordColor);
            config.NameColor       = DrawColorControl("Member name", config.NameColor);
            config.TypeColor       = DrawColorControl("Member type", config.TypeColor);
            config.ModifierColor   = DrawColorControl("Member modifier", config.ModifierColor);
            config.MemberTypeColor = DrawColorControl("Field type", config.MemberTypeColor);
            config.ValueColor      = DrawColorControl("Member value", config.ValueColor);

            GUILayout.FlexibleSpace();

            GUILayout.BeginHorizontal();

            GUILayout.FlexibleSpace();

            if (GUILayout.Button("OK", GUILayout.Width(100)))
            {
                MainWindow.Instance.SaveConfig();
                Visible = false;
            }

            if (GUILayout.Button("Defaults", GUILayout.Width(100)))
            {
                ResetDoDefault(config);
                selectedFont = Array.IndexOf(availableFonts, config.FontName);
            }

            GUILayout.EndHorizontal();
        }