合理化框架

合理化框架
This commit is contained in:
ALEXTANG
2023-07-16 15:37:38 +08:00
parent c6ecb48944
commit 7ce72b8aa8
12 changed files with 33 additions and 39 deletions

View File

@@ -399,12 +399,6 @@ namespace TEngine
public void Deserialize(Scene scene, bool resetId = false)
{
if (IsDisposed)
{
Log.Error($"component is Disposed {this.GetType().FullName}");
return;
}
if (RuntimeId != 0)
{
return;

View File

@@ -70,7 +70,7 @@ namespace TEngine
public void CreateSession(string remoteAddress, NetworkProtocolType networkProtocolType, Action onConnectComplete, Action onConnectFail, int connectTimeout = 5000)
{
var address = NetworkHelper.ToIPEndPoint(remoteAddress);
var clientNetworkComponent = AddComponent<ClientNetworkComponent>();
var clientNetworkComponent = GetComponent<ClientNetworkComponent>() ?? AddComponent<ClientNetworkComponent>();
clientNetworkComponent.Initialize(networkProtocolType, NetworkTarget.Outer);
clientNetworkComponent.Connect(address, onConnectComplete, onConnectFail, connectTimeout);
Session = clientNetworkComponent.Session;