This commit is contained in:
CortexCore 2024-08-05 09:53:22 +08:00
parent d33e1c1713
commit cc3d6f0ef1
7 changed files with 52 additions and 13 deletions

View File

@ -1,3 +1,4 @@
using System;
using System.IO;
namespace BITKit
@ -77,4 +78,25 @@ namespace BITKit
writer.Write(value);
}
}
public class GuidsSupport : NetMessageReader<Guid[]>
{
public override Guid[] ReadBinary(BinaryReader reader)
{
var count = reader.ReadInt32();
var result = new Guid[count];
for (var i = 0; i < count; i++)
{
result[i] = new Guid(reader.ReadBytes(16));
}
return result;
}
public override void WriteBinary(BinaryWriter writer, Guid[] value)
{
writer.Write(value.Length);
foreach (var guid in value)
{
writer.Write(guid.ToByteArray());
}
}
}
}

View File

@ -118,6 +118,12 @@ namespace BITKit.Net
public async UniTask<bool> Connect(string address = "127.0.0.1", ushort port = 27014)
{
if (IsConnecting)
{
BIT4Log.Warning<KcpNetClient>("正在连接中");
return false;
}
//如果address是域名,解析为Ip
if (address.Contains("."))
{
@ -128,13 +134,13 @@ namespace BITKit.Net
BIT4Log.Log<KcpNetClient>($"解析域名:{address}");
}
}
if (address is not "127.0.0.1")
_connectedAddress = address;
if (port is not 27014)
_connectedPort = port;
if (IsConnecting)
{
BIT4Log.Warning<KcpNetClient>("正在连接中");
return false;
}
IsConnecting = true;
if (client.connected) return false;
await BITApp.SwitchToMainThread();

View File

@ -325,7 +325,12 @@ namespace BITKit.Net
{
dynamic result = methodInfo.Invoke(handle, pars)!;
if (methodInfo.ReturnType == typeof(void) || methodInfo.ReturnType == typeof(UniTask))
if (methodInfo.ReturnType == typeof(void)
||
methodInfo.ReturnType == typeof(UniTask)
||
methodInfo.ReturnType == typeof(UniTask<>)
)
{
await result;
value = -1;

View File

@ -6101,7 +6101,7 @@ MonoBehaviour:
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
- regularTypeface: {fileID: 11400000, guid: 7b6a2cbff5c66dc42a81b604c826c04d, type: 2}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}

View File

@ -101838,15 +101838,15 @@ MonoBehaviour:
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
- regularTypeface: {fileID: 11400000, guid: 7b6a2cbff5c66dc42a81b604c826c04d, type: 2}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
- regularTypeface: {fileID: 11400000, guid: 7b6a2cbff5c66dc42a81b604c826c04d, type: 2}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
- regularTypeface: {fileID: 11400000}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
- regularTypeface: {fileID: 11400000}
italicTypeface: {fileID: 0}
m_RegularStyleWeight: 0
m_RegularStyleSpacing: 0

View File

@ -135,7 +135,8 @@ namespace BITKit.UX
try
{
CurrentOpacity = 0;
TargetOpacity = 1;
TargetOpacity = 1f;
document.rootVisualElement.SetActive(true);
OnEntry?.Invoke();
@ -190,7 +191,7 @@ namespace BITKit.UX
public virtual void OnUpdate(float deltaTime)
{
var duration = 1f;
if (TargetOpacity is 1)
if (TargetOpacity is not 0)
{
if (entryDuration.Allow is false)
{

View File

@ -70,6 +70,11 @@ namespace BITKit.UX
/// 历史面板
/// </summary>
internal static readonly Stack<IUXPanel> History = new();
/// <summary>
/// 清空历史面板,通常用于关闭返回上一步
/// </summary>
public static void ClearHistory() => History.Clear();
public static void Register(IUXPanel panel) => RegistryQueue.Enqueue(panel);