37 lines
998 B
C#
37 lines
998 B
C#
using Godot;
|
|
using System;
|
|
|
|
namespace BITKit.UX.Settings;
|
|
public partial class UXSettings : Node
|
|
{
|
|
[Export] private Slider uiScaleSlider;
|
|
[Export] private Slider renderResolutionSlider;
|
|
[Export] private CheckBox fullScreenCheckBox;
|
|
public override void _Ready()
|
|
{
|
|
base._Ready();
|
|
|
|
uiScaleSlider.ValueChanged += SetUIScale;
|
|
renderResolutionSlider.ValueChanged += SetRenderResolution;
|
|
fullScreenCheckBox.Toggled += SetFullScreen;
|
|
|
|
|
|
}
|
|
private void SetFullScreen(bool toggledon)
|
|
{
|
|
DisplayServer.WindowSetMode(toggledon ? DisplayServer.WindowMode.Fullscreen:DisplayServer.WindowMode.Minimized);
|
|
BIT4Log.Log<UXSettings>($"设置全屏为{toggledon}");
|
|
}
|
|
|
|
public void SetUIScale(double scale)
|
|
{
|
|
//GetViewport().Scaling3DScale =(float) scale;
|
|
BIT4Log.Log<UXSettings>($"设置UI缩放比例为{scale}");
|
|
}
|
|
public void SetRenderResolution(double scale)
|
|
{
|
|
GetViewport().Scaling3DScale = (float)scale;
|
|
BIT4Log.Log<UXSettings>($"设置渲染分辨率比例为{scale}");
|
|
}
|
|
}
|