提交更新

This commit is contained in:
CortexCore
2023-07-12 15:27:27 +08:00
parent 4af7cec47b
commit 498b0617f8
13 changed files with 294 additions and 154 deletions

View File

@@ -1,3 +1,4 @@
using System;
using Cysharp.Threading.Tasks;
using Godot;
@@ -8,11 +9,23 @@ public static class LabelExtensions
public static async void SetTextAsync(this Label self, string text)
{
await UniTask.SwitchToSynchronizationContext(BITApp.SynchronizationContext);
self.Text = text;
if (self is not null)
self.Text = text;
}
public static async void SetTextAsync(this RichTextLabel self,string text)
public static async void SetTextAsync(this RichTextLabel self, string text)
{
var path = self.SceneFilePath;
await UniTask.SwitchToSynchronizationContext(BITApp.SynchronizationContext);
self.Text = text;
try
{
self.Text = text;
}
catch (Exception e)
{
BIT4Log.Warnning(path);
throw;
}
}
}