{in progress] attemping to raise source changes first, before exporting data.
This commit is contained in:
Родитель
a530bdb5c8
Коммит
e7889572c5
|
@ -77,6 +77,14 @@ public class GenericNetworkTransmitter
|
|||
StartAsClient(serverIp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stop any pending sends or requests
|
||||
/// </summary>
|
||||
public void StopAll()
|
||||
{
|
||||
StopServerAndClient();
|
||||
}
|
||||
|
||||
// A lot of the work done in this class can only be done in UWP. The editor is not a UWP app.
|
||||
#if !UNITY_EDITOR
|
||||
/// <summary>
|
||||
|
@ -109,6 +117,15 @@ public class GenericNetworkTransmitter
|
|||
/// </summary>
|
||||
private const int timeToDeferFailedConnectionsMS = 3000;
|
||||
|
||||
/// <summary>
|
||||
/// Stop the server and client request.s
|
||||
/// </summary>
|
||||
private async void StopServerAndClient()
|
||||
{
|
||||
StopClient();
|
||||
await StopServer();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stop the current server
|
||||
/// </summary>
|
||||
|
@ -371,7 +388,11 @@ public class GenericNetworkTransmitter
|
|||
return await task;
|
||||
}
|
||||
#else
|
||||
public void StartAsServer(byte[] data)
|
||||
private void StopServerAndClient()
|
||||
{
|
||||
}
|
||||
|
||||
private void StartAsServer(byte[] data)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -151,7 +151,16 @@ public class MyNetworkAnchorClient : NetworkBehaviour
|
|||
// The last received anchor will no longer be relevant since we're taking ownership
|
||||
LastRecievedAnchor = null;
|
||||
|
||||
// Stop all pending work on the anchor transmitter
|
||||
anchorTransmitter.StopAll();
|
||||
|
||||
// Start taking ownership of the anchor
|
||||
SharedAnchorData anchorSource;
|
||||
anchorSource.SourceIp = LocalAddress;
|
||||
anchorSource.AnchorId = anchorId;
|
||||
CmdSetAnchorSource(anchorSource);
|
||||
|
||||
// Export binary data
|
||||
List<byte> buffer = new List<byte>();
|
||||
WorldAnchorTransferBatch batch = new WorldAnchorTransferBatch();
|
||||
batch.AddWorldAnchor(anchorId, worldAnchor);
|
||||
|
@ -230,11 +239,11 @@ public class MyNetworkAnchorClient : NetworkBehaviour
|
|||
{
|
||||
Debug.LogFormat("[MyNetworkAnchorClient] Exporting anchor succeeded: {0} ({1} bytes)", anchorId, data.Length);
|
||||
|
||||
SharedAnchorData anchorSource;
|
||||
anchorSource.SourceIp = LocalAddress;
|
||||
anchorSource.AnchorId = anchorId;
|
||||
//SharedAnchorData anchorSource;
|
||||
//anchorSource.SourceIp = LocalAddress;
|
||||
//anchorSource.AnchorId = anchorId;
|
||||
anchorTransmitter.SendData(data);
|
||||
CmdSetAnchorSource(anchorSource);
|
||||
//CmdSetAnchorSource(anchorSource);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче