44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
|
using System.Data;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using TMPro;
|
||
|
using System.Text;
|
||
|
using Cysharp.Threading.Tasks;
|
||
|
namespace BITKit.UX
|
||
|
{
|
||
|
public class UGUITable : Provider, IProvider<DataTable>
|
||
|
{
|
||
|
public TMP_Text text;
|
||
|
public DataTable Get()
|
||
|
{
|
||
|
throw new System.NotImplementedException();
|
||
|
}
|
||
|
public override void Set<T>(T obj)
|
||
|
{
|
||
|
if (obj is DataTable t)
|
||
|
{
|
||
|
Set(t);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
throw new System.NotImplementedException();
|
||
|
}
|
||
|
}
|
||
|
public async void Set(DataTable t)
|
||
|
{
|
||
|
StringBuilder table = new();
|
||
|
t.Rows.Count.ForEach(row =>
|
||
|
{
|
||
|
StringBuilder line = new();
|
||
|
t.Columns.Count.ForEach(col =>
|
||
|
{
|
||
|
line.Append(t.Rows[row][col] as string);
|
||
|
});
|
||
|
table.AppendLine(line.ToString());
|
||
|
});
|
||
|
await UniTask.SwitchToMainThread(BITApp.CancellationTokenSource.Token);
|
||
|
text.text = table.ToString();
|
||
|
}
|
||
|
}
|
||
|
}
|