BITKit/Packages/Runtime~/Unity/Scripts/Components/TranslateComponent.cs

29 lines
763 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cysharp.Threading.Tasks;
namespace BITKit
{
public sealed class TranslateComponent : Provider<string>
{
[Header(Constant.Header.Settings)]
public TranslateSO so;
public bool async;
[Header(Constant.Header.Output)]
public Provider output;
[TextArea]
public string result;
public override string Get()
{
throw new System.NotImplementedException();
}
public override async void Set(string t)
{
if (async)
{
await UniTask.SwitchToThreadPool();
}
output.Set(result = so.Get(t, false));
}
}
}