This commit is contained in:
parent
ca93bd2c56
commit
dfa249677f
|
@ -8,7 +8,7 @@ namespace BITKit
|
|||
{
|
||||
public static class BIT4Log
|
||||
{
|
||||
#if UNITY_EDITOR && UNITY_64
|
||||
#if UNITY_EDITOR && UNITY_5_3_OR_NEWER
|
||||
[RuntimeInitializeOnLoadMethod]
|
||||
private static void Reload()
|
||||
{
|
||||
|
|
|
@ -242,7 +242,7 @@ namespace BITKit.Net
|
|||
else
|
||||
{
|
||||
returnWriter.Write(false);
|
||||
returnWriter.Write("未找到对应的Rpc方法");
|
||||
returnWriter.Write($"未找到对应的Rpc方法:{path}");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -66,6 +66,10 @@ namespace BITKit.Net
|
|||
if (server.IsActive() is false || ManualTick) return;
|
||||
server.Tick();
|
||||
}
|
||||
catch (SocketException)
|
||||
{
|
||||
//丢失链接,有用户断开连接,通常是正常现象
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
BIT4Log.LogException(exception);
|
||||
|
@ -254,7 +258,7 @@ namespace BITKit.Net
|
|||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("未找到对应的Rpc方法");
|
||||
throw new Exception($"未找到对应的Rpc方法:{path}");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -262,7 +266,8 @@ namespace BITKit.Net
|
|||
{
|
||||
var commandObj = BITBinary.Read(reader)
|
||||
.As<object[]>()[0];
|
||||
if (_rpc.TryGetValue(commandObj.GetType()!.FullName!, out var func))
|
||||
var funcName = commandObj.GetType()!.FullName!;
|
||||
if (_rpc.TryGetValue(funcName, out var func))
|
||||
{
|
||||
var value = await func.As<Func<object, UniTask<object>>>().Invoke(commandObj);
|
||||
returnWriter.Write(true);
|
||||
|
@ -270,7 +275,7 @@ namespace BITKit.Net
|
|||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("未找到对应的Rpc方法");
|
||||
throw new Exception($"未找到对应的Rpc方法:{funcName}");
|
||||
}
|
||||
}
|
||||
{
|
||||
|
@ -471,7 +476,10 @@ namespace BITKit.Net
|
|||
.Write((byte)commandType)
|
||||
.WriteObject(values)
|
||||
.Build();
|
||||
server.Send(id,bytes, KcpChannel.Reliable);
|
||||
if (server.connections.ContainsKey(id))
|
||||
{
|
||||
server.Send(id,bytes, KcpChannel.Reliable);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -166,6 +166,8 @@ namespace kcp2k
|
|||
// the other end closing the connection is not an 'error'.
|
||||
// but connections should never just end silently.
|
||||
// at least log a message for easier debugging.
|
||||
|
||||
//sure I go next somewhere record it
|
||||
Log.Info($"KcpServer: ReceiveFrom failed: {e}");
|
||||
}
|
||||
|
||||
|
|
|
@ -107,6 +107,8 @@ namespace BITKit.UX
|
|||
private Button _cancelButton;
|
||||
private void Start()
|
||||
{
|
||||
destroyCancellationToken.Register(Dispose);
|
||||
|
||||
DI.Register<IUXDialogue,UnityDialogue>();
|
||||
|
||||
UXUtils.Inject(this);
|
||||
|
@ -114,8 +116,14 @@ namespace BITKit.UX
|
|||
Close();
|
||||
}
|
||||
|
||||
private void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
internal void PrintAlertMessage(AlertMessage message)
|
||||
{
|
||||
if(destroyCancellationToken.IsCancellationRequested)return;
|
||||
|
||||
document.rootVisualElement.SetActive(true);
|
||||
_titleLabel.text = message.title;
|
||||
_contextLabel.text = message.message;
|
||||
|
|
|
@ -54,6 +54,11 @@ namespace BITKit.UX
|
|||
/// </summary>
|
||||
private static readonly Stack<IUXPanel> EntryQueue = new();
|
||||
|
||||
/// <summary>
|
||||
/// 返回面板缓冲区
|
||||
/// </summary>
|
||||
private static readonly DoubleBuffer<IUXPanel> ReturnBuffer = new();
|
||||
|
||||
/// <summary>
|
||||
/// 已启用面板
|
||||
/// </summary>
|
||||
|
@ -74,12 +79,11 @@ namespace BITKit.UX
|
|||
{
|
||||
if (History.TryPop(out var returnPanel))
|
||||
{
|
||||
Entry(returnPanel);
|
||||
ReturnBuffer.Release(returnPanel);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Entry(IUXPanel panel) => EntryQueue.Push(panel);
|
||||
|
||||
public static void Entry(string panelName) => EntryQueue.Push(Panels[panelName]);
|
||||
|
||||
[SerializeReference, SubclassSelector] private IUXPanel initialPanel;
|
||||
|
@ -103,7 +107,7 @@ namespace BITKit.UX
|
|||
}
|
||||
private static void OnExit(IUXPanel obj)
|
||||
{
|
||||
History.Push(obj);
|
||||
//History.Push(obj);
|
||||
}
|
||||
private static void OnEntry(IUXPanel obj)
|
||||
{
|
||||
|
@ -125,8 +129,16 @@ namespace BITKit.UX
|
|||
Panels.Remove(result.Index);
|
||||
}
|
||||
|
||||
if (ReturnBuffer.TryGetRelease(out var returnPanel))
|
||||
{
|
||||
EntryGroup.Entry(x=>x.Index==returnPanel.Index);
|
||||
BITAppForUnity.AllowCursor.SetElements(this, returnPanel.AllowCursor);
|
||||
BITInputSystem.AllowInput.SetElements(this, returnPanel.AllowInput);
|
||||
}
|
||||
|
||||
if (EntryQueue.TryPop(out var nextPanel))
|
||||
{
|
||||
History.Push(CurrentPanel);
|
||||
EntryGroup.Entry(x=>x.Index==nextPanel.Index);
|
||||
BITAppForUnity.AllowCursor.SetElements(this, nextPanel.AllowCursor);
|
||||
BITInputSystem.AllowInput.SetElements(this, nextPanel.AllowInput);
|
||||
|
@ -136,38 +148,6 @@ namespace BITKit.UX
|
|||
{
|
||||
currentPanel.OnUpdate(Time.deltaTime);
|
||||
};
|
||||
|
||||
|
||||
// if (initialized is false && initialPanel is not null)
|
||||
// {
|
||||
// initialized = true;
|
||||
// Entry(initialPanel);
|
||||
// }
|
||||
//
|
||||
// if (!EntryQueue.TryPop(out var next) || next is null) return;
|
||||
//
|
||||
// if (Panels.ContainsKey(next.Index) is false) return;
|
||||
//
|
||||
// while (EntryCompletedPanels.TryPop(out var entryCompletedPanel))
|
||||
// {
|
||||
// entryCompletedPanel?.Exit();
|
||||
// }
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// next.Entry();
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// Debug.LogWarning(next.Index);
|
||||
// Debug.LogException(e);
|
||||
// }
|
||||
//
|
||||
// BITAppForUnity.AllowCursor.SetElements(this, next.AllowCursor);
|
||||
// BITInputSystem.AllowInput.SetElements(this, next.AllowInput);
|
||||
//
|
||||
// EntryCompletedPanels.Push(next);
|
||||
// History.Push(next);
|
||||
}
|
||||
|
||||
void IUXService.Register(IUXPanel panel) => Register(panel);
|
||||
|
|
|
@ -8,6 +8,7 @@ using UnityEngine.UIElements;
|
|||
|
||||
namespace BITKit.UX
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Field|AttributeTargets.Property)]
|
||||
public class UXBindPathAttribute : Attribute
|
||||
{
|
||||
public string Path;
|
||||
|
|
Loading…
Reference in New Issue