UI框架调整,主界面重做 #16

初步调整
This commit is contained in:
2025-10-28 23:51:17 +08:00
parent 60596f2772
commit 239425c47d
40 changed files with 713 additions and 17 deletions

View File

@ -0,0 +1,36 @@
using UnrealSharp.Engine;
using UnrealSharp.Attributes;
using UnrealSharp.BusyRabbit;
using UnrealSharp.UMG;
namespace UI.Level.StateBar;
[UClass]
public class UBusyWidgetSatietyBar : UPW_MinimalWidget
{
protected UProgressBar? SatietyBar { get { return GetWidget("SatietyBar") as UProgressBar; } }
protected float CurrSatiety;
protected float MaxSatiety;
public void SetSatietyConfig(float CurrSatiety, float MaxSatiety)
{
this.MaxSatiety = MaxSatiety;
this.CurrSatiety = CurrSatiety;
RefreshDisplay();
}
public void OnSatietyChanged(float CurSatiety)
{
this.CurrSatiety = CurSatiety;
RefreshDisplay();
}
public void RefreshDisplay()
{
float Percent = MaxSatiety > 0 ? CurrSatiety / MaxSatiety : 0;
if (SatietyBar != null)
{
SatietyBar.Percent = Percent;
}
}
}