Exemple #1
0
 // Called when the node enters the scene tree for the first time.
 public override void _Ready()
 {
     popup = (PopupDialog)GetNode("PopupDialog");
     popup.Popup_();
     texte = (Label)GetNode("PopupDialog/Label");
 }
Exemple #2
0
    public void on_apply()
    {
        //
        AncientSettings.width  = (int)ProjectSettings.GetSetting("display/window/size/width");
        AncientSettings.height = (int)ProjectSettings.GetSetting("display/window/size/height");
        //
        int width  = Convert.ToInt32(te_width.Text);
        int height = Convert.ToInt32(te_height.Text);

        if (width != AncientSettings.width || height != AncientSettings.height)
        {
            need_restart = true;
        }
        //FPS
        globale.aff_fps = cb_showfps.Pressed;
        //Resolution
        ProjectSettings.SetSetting("display/window/size/width", (int)width);
        ProjectSettings.SetSetting("display/window/size/height", (int)height);
        //Vsync
        CheckBox cb_vsync = (CheckBox)GetNode("Settings/VBoxContainer/St_vsync/Cb");

        if (cb_vsync.Pressed != (bool)ProjectSettings.GetSetting("display/window/vsync/use_vsync"))
        {
            need_restart = true;
            ProjectSettings.SetSetting("display/window/vsync/use_vsync", cb_vsync.Pressed);
        }
        //3d effects
        CheckBox cb_effects = (CheckBox)GetNode("Settings/VBoxContainer/St_3d_effects/Cb");
        int      value      = 3;

        if (cb_effects.Pressed)
        {
            value = 2;
        }
        if (globale.is_mobile())
        {
            if (value != (int)ProjectSettings.GetSetting("rendering/quality/intended_usage/framebuffer_allocation.mobile"))
            {
                need_restart = true;
                ProjectSettings.SetSetting("rendering/quality/intended_usage/framebuffer_allocation.mobile", value);
            }
        }
        else
        {
            if (value != (int)ProjectSettings.GetSetting("rendering/quality/intended_usage/framebuffer_allocation"))
            {
                need_restart = true;
                ProjectSettings.SetSetting("rendering/quality/intended_usage/framebuffer_allocation", value);
            }
        }
        //hdr
        CheckBox cb_hdr = (CheckBox)GetNode("Settings/VBoxContainer/St_hdr/Cb");

        if (globale.is_mobile())
        {
            if (cb_hdr.Pressed != (bool)ProjectSettings.GetSetting("rendering/quality/depth/hdr.mobile"))
            {
                ProjectSettings.SetSetting("rendering/quality/depth/hdr.mobile", cb_hdr.Pressed);
                need_restart = true;
            }
        }
        else
        {
            if (cb_hdr.Pressed != (bool)ProjectSettings.GetSetting("rendering/quality/depth/hdr"))
            {
                ProjectSettings.SetSetting("rendering/quality/depth/hdr", cb_hdr.Pressed);
                need_restart = true;
            }
        }
        //Anisotropic
        HScrollBar sb_ani    = (HScrollBar)GetNode("Settings/VBoxContainer/St_anisotropic/HScrollBar");
        int        value_ani = anisotropics[(int)sb_ani.Value];

        ProjectSettings.SetSetting("rendering/quality/filters/anisotropic_filter_level", value_ani);
        //high quality ggx
        CheckBox cb_ggx = (CheckBox)GetNode("Settings/VBoxContainer/St_high_quality_ggx/Cb");

        if (globale.is_mobile())
        {
            if (cb_ggx.Pressed != (bool)ProjectSettings.GetSetting("rendering/quality/reflections/high_quality_ggx.mobile"))
            {
                need_restart = true;
                ProjectSettings.SetSetting("rendering/quality/reflections/high_quality_ggx.mobile", cb_ggx.Pressed);
            }
        }
        else
        {
            if (cb_ggx.Pressed != (bool)ProjectSettings.GetSetting("rendering/quality/reflections/high_quality_ggx"))
            {
                need_restart = true;
                ProjectSettings.SetSetting("rendering/quality/reflections/high_quality_ggx", cb_ggx.Pressed);
            }
        }
        //Reflexion Atlas Size
        HScrollBar sb_ras    = (HScrollBar)GetNode("Settings/VBoxContainer/St_reflex_atlas_size/HScrollBar");
        int        value_ras = atlas_sizes[(int)sb_ras.Value];

        ProjectSettings.SetSetting("rendering/quality/reflections/atlas_size", value_ras);
        //Texture array reflexion
        CheckBox cb_tar = (CheckBox)GetNode("Settings/VBoxContainer/St_high_quality_ggx/Cb");

        if (globale.is_mobile())
        {
            if (cb_tar.Pressed != (bool)ProjectSettings.GetSetting("rendering/quality/reflections/texture_array_reflections.mobile"))
            {
                need_restart = true;
                ProjectSettings.SetSetting("rendering/quality/reflections/texture_array_reflections.mobile", cb_tar.Pressed);
            }
        }
        else
        {
            if (cb_tar.Pressed != (bool)ProjectSettings.GetSetting("rendering/quality/reflections/texture_array_reflections"))
            {
                need_restart = true;
                ProjectSettings.SetSetting("rendering/quality/reflections/texture_array_reflections", cb_tar.Pressed);
            }
        }
        //Force vertex shading
        CheckBox cb_fvs = (CheckBox)GetNode("Settings/VBoxContainer/St_force_vertex_shading/Cb");

        if (globale.is_mobile())
        {
            if (cb_fvs.Pressed != (bool)ProjectSettings.GetSetting("rendering/quality/shading/force_vertex_shading.mobile"))
            {
                need_restart = true;
                ProjectSettings.SetSetting("rendering/quality/shading/force_vertex_shading.mobile", cb_fvs.Pressed);
            }
        }
        else
        {
            if (cb_fvs.Pressed != (bool)ProjectSettings.GetSetting("rendering/quality/shading/force_vertex_shading"))
            {
                need_restart = true;
                ProjectSettings.SetSetting("rendering/quality/shading/force_vertex_shading", cb_fvs.Pressed);
            }
        }
        //Shadow Atlas size
        HScrollBar sb_sas    = (HScrollBar)GetNode("Settings/VBoxContainer/St_reflex_atlas_size/HScrollBar");
        int        value_sas = atlas_sizes[(int)sb_sas.Value];

        if (globale.is_mobile())
        {
            ProjectSettings.SetSetting("rendering/quality/shadow_atlas/size.mobile", value_sas);
        }
        else
        {
            ProjectSettings.SetSetting("rendering/quality/shadow_atlas/size", value_sas);
        }
        //Subsurface Scattering
        HScrollBar hsb_ssc = (HScrollBar)GetNode("Settings/VBoxContainer/St_subsurface_scattering/HScrollBar");

        ProjectSettings.SetSetting("rendering/quality/subsurface_scattering/quality", (int)hsb_ssc.Value);
        //Ambient Occlusion
        HScrollBar hsb_sao   = (HScrollBar)GetNode("Settings/VBoxContainer/St_ambient_occlusion/HScrollBar");
        double     value_sao = hsb_sao.Value;

        if (value_sao == 0)
        {
            globale.sao = false;
        }
        else
        {
            globale.sao         = true;
            globale.sao_quality = (int)value_sao - 1;
        }
        //Glow Strength
        HScrollBar hsb_gs = (HScrollBar)GetNode("Settings/VBoxContainer/St_glow_strength/HScrollBar");

        globale.glow_strength = (float)hsb_gs.Value;
        //Glow Intensity
        HScrollBar hsb_gi = (HScrollBar)GetNode("Settings/VBoxContainer/St_glow_intensity/HScrollBar");

        globale.glow_intensity = (float)hsb_gi.Value;
        //Saturation
        HScrollBar hsb_sat = (HScrollBar)GetNode("Settings/VBoxContainer/St_Saturation/HScrollBar");

        globale.saturation = (float)hsb_sat.Value;
        //Brightness
        HScrollBar hsb_lum = (HScrollBar)GetNode("Settings/VBoxContainer/St_Brightness/HScrollBar");

        globale.luminosity = (float)hsb_lum.Value;
        //Far
        HScrollBar hsb_far = (HScrollBar)GetNode("Settings/VBoxContainer/St_fov/HScrollBar");

        globale.cam_far = (float)hsb_far.Value;
        //Save Settings
        ProjectSettings.Save();
        globale.SaveGame();
        //
        if (need_restart)
        {
            popup.Popup_();
        }
    }