This commit is contained in:
parent
d33e1c1713
commit
cc3d6f0ef1
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace BITKit
|
namespace BITKit
|
||||||
|
@ -77,4 +78,25 @@ namespace BITKit
|
||||||
writer.Write(value);
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -118,6 +118,12 @@ namespace BITKit.Net
|
||||||
|
|
||||||
public async UniTask<bool> Connect(string address = "127.0.0.1", ushort port = 27014)
|
public async UniTask<bool> Connect(string address = "127.0.0.1", ushort port = 27014)
|
||||||
{
|
{
|
||||||
|
if (IsConnecting)
|
||||||
|
{
|
||||||
|
BIT4Log.Warning<KcpNetClient>("正在连接中");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//如果address是域名,解析为Ip
|
//如果address是域名,解析为Ip
|
||||||
if (address.Contains("."))
|
if (address.Contains("."))
|
||||||
{
|
{
|
||||||
|
@ -128,13 +134,13 @@ namespace BITKit.Net
|
||||||
BIT4Log.Log<KcpNetClient>($"解析域名:{address}");
|
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;
|
IsConnecting = true;
|
||||||
if (client.connected) return false;
|
if (client.connected) return false;
|
||||||
await BITApp.SwitchToMainThread();
|
await BITApp.SwitchToMainThread();
|
||||||
|
|
|
@ -325,7 +325,12 @@ namespace BITKit.Net
|
||||||
{
|
{
|
||||||
dynamic result = methodInfo.Invoke(handle, pars)!;
|
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;
|
await result;
|
||||||
value = -1;
|
value = -1;
|
||||||
|
|
|
@ -6101,7 +6101,7 @@ MonoBehaviour:
|
||||||
italicTypeface: {fileID: 0}
|
italicTypeface: {fileID: 0}
|
||||||
- regularTypeface: {fileID: 0}
|
- regularTypeface: {fileID: 0}
|
||||||
italicTypeface: {fileID: 0}
|
italicTypeface: {fileID: 0}
|
||||||
- regularTypeface: {fileID: 0}
|
- regularTypeface: {fileID: 11400000, guid: 7b6a2cbff5c66dc42a81b604c826c04d, type: 2}
|
||||||
italicTypeface: {fileID: 0}
|
italicTypeface: {fileID: 0}
|
||||||
- regularTypeface: {fileID: 0}
|
- regularTypeface: {fileID: 0}
|
||||||
italicTypeface: {fileID: 0}
|
italicTypeface: {fileID: 0}
|
||||||
|
|
|
@ -101838,15 +101838,15 @@ MonoBehaviour:
|
||||||
italicTypeface: {fileID: 0}
|
italicTypeface: {fileID: 0}
|
||||||
- regularTypeface: {fileID: 0}
|
- regularTypeface: {fileID: 0}
|
||||||
italicTypeface: {fileID: 0}
|
italicTypeface: {fileID: 0}
|
||||||
- regularTypeface: {fileID: 0}
|
- regularTypeface: {fileID: 11400000, guid: 7b6a2cbff5c66dc42a81b604c826c04d, type: 2}
|
||||||
italicTypeface: {fileID: 0}
|
italicTypeface: {fileID: 0}
|
||||||
- regularTypeface: {fileID: 0}
|
- regularTypeface: {fileID: 0}
|
||||||
italicTypeface: {fileID: 0}
|
italicTypeface: {fileID: 0}
|
||||||
- regularTypeface: {fileID: 0}
|
- regularTypeface: {fileID: 11400000, guid: 7b6a2cbff5c66dc42a81b604c826c04d, type: 2}
|
||||||
italicTypeface: {fileID: 0}
|
italicTypeface: {fileID: 0}
|
||||||
- regularTypeface: {fileID: 0}
|
- regularTypeface: {fileID: 11400000}
|
||||||
italicTypeface: {fileID: 0}
|
italicTypeface: {fileID: 0}
|
||||||
- regularTypeface: {fileID: 0}
|
- regularTypeface: {fileID: 11400000}
|
||||||
italicTypeface: {fileID: 0}
|
italicTypeface: {fileID: 0}
|
||||||
m_RegularStyleWeight: 0
|
m_RegularStyleWeight: 0
|
||||||
m_RegularStyleSpacing: 0
|
m_RegularStyleSpacing: 0
|
||||||
|
|
|
@ -135,7 +135,8 @@ namespace BITKit.UX
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CurrentOpacity = 0;
|
CurrentOpacity = 0;
|
||||||
TargetOpacity = 1;
|
TargetOpacity = 1f;
|
||||||
|
|
||||||
document.rootVisualElement.SetActive(true);
|
document.rootVisualElement.SetActive(true);
|
||||||
|
|
||||||
OnEntry?.Invoke();
|
OnEntry?.Invoke();
|
||||||
|
@ -190,7 +191,7 @@ namespace BITKit.UX
|
||||||
public virtual void OnUpdate(float deltaTime)
|
public virtual void OnUpdate(float deltaTime)
|
||||||
{
|
{
|
||||||
var duration = 1f;
|
var duration = 1f;
|
||||||
if (TargetOpacity is 1)
|
if (TargetOpacity is not 0)
|
||||||
{
|
{
|
||||||
if (entryDuration.Allow is false)
|
if (entryDuration.Allow is false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,6 +70,11 @@ namespace BITKit.UX
|
||||||
/// 历史面板
|
/// 历史面板
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static readonly Stack<IUXPanel> History = new();
|
internal static readonly Stack<IUXPanel> History = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清空历史面板,通常用于关闭返回上一步
|
||||||
|
/// </summary>
|
||||||
|
public static void ClearHistory() => History.Clear();
|
||||||
|
|
||||||
public static void Register(IUXPanel panel) => RegistryQueue.Enqueue(panel);
|
public static void Register(IUXPanel panel) => RegistryQueue.Enqueue(panel);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue