1
This commit is contained in:
@@ -5,18 +5,16 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace BITKit;
|
||||
|
||||
public partial class UXApplicationService : EntityComponent
|
||||
|
||||
public partial class UXApplicationService : EntityBehaviour
|
||||
{
|
||||
[Export] private Label currentVersionLabel;
|
||||
[Export] private Label latestVersionLabel;
|
||||
[Export] private Button downloadLatestButton;
|
||||
|
||||
[Inject]
|
||||
private IApplicationService _service;
|
||||
public override void OnAwake()
|
||||
{
|
||||
_service = Entity.ServiceProvider.GetRequiredService<IApplicationService>();
|
||||
|
||||
downloadLatestButton.Hide();
|
||||
|
||||
downloadLatestButton.Pressed += () =>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace BITKit.UX;
|
||||
|
||||
@@ -17,17 +18,39 @@ public partial class UXPanel : Control, IUXPanel
|
||||
public bool AllowInput => allowInput;
|
||||
|
||||
private string _index;
|
||||
public bool IsEntered { get; set; }
|
||||
|
||||
public virtual void Entry()
|
||||
{
|
||||
Show();
|
||||
//OnEntry();
|
||||
}
|
||||
|
||||
public UniTask EntryAsync()
|
||||
{
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
public void Entered()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void Exit()
|
||||
{
|
||||
Hide();
|
||||
//OnExit();
|
||||
}
|
||||
|
||||
public UniTask ExitAsync()
|
||||
{
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
public void Exited()
|
||||
{
|
||||
}
|
||||
|
||||
public event Action OnEntry;
|
||||
public event Action OnExit;
|
||||
|
||||
@@ -55,4 +78,9 @@ public partial class UXPanel : Control, IUXPanel
|
||||
UXService.UnRegister(this);
|
||||
IsValid = false;
|
||||
}
|
||||
|
||||
public void OnUpdate(float deltaTime)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ public partial class UXProfiler : Node
|
||||
if (fpsLabel is not null)
|
||||
fpsLabel.Text = $"FPS: {Engine.GetFramesPerSecond()}";
|
||||
if (resolutionLabel is not null)
|
||||
resolutionLabel.Text = $"Resolution: {windowSize.X}x{windowSize.Y}";
|
||||
resolutionLabel.Text = $"{windowSize.X}x{windowSize.Y}";
|
||||
}
|
||||
}
|
||||
|
||||
36
BITKit/Scripts/UX/UXSettings.cs
Normal file
36
BITKit/Scripts/UX/UXSettings.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
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}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user