Before update to NET 7
This commit is contained in:
18
BITKit/Scripts/Extensions/LabelExtensions.cs
Normal file
18
BITKit/Scripts/Extensions/LabelExtensions.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Godot;
|
||||
|
||||
namespace BITKit;
|
||||
|
||||
public static class LabelExtensions
|
||||
{
|
||||
public static async void SetTextAsync(this Label self, string text)
|
||||
{
|
||||
await UniTask.SwitchToSynchronizationContext(BITApp.SynchronizationContext);
|
||||
self.Text = text;
|
||||
}
|
||||
public static async void SetTextAsync(this RichTextLabel self,string text)
|
||||
{
|
||||
await UniTask.SwitchToSynchronizationContext(BITApp.SynchronizationContext);
|
||||
self.Text = text;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user