Improved ControlCore
This commit is contained in:
parent
1d2da54a17
commit
7e80a36027
@ -53,7 +53,7 @@ namespace Passer.Control {
|
||||
ProcessThing(thing);
|
||||
break;
|
||||
case NameMsg name:
|
||||
UnityEngine.Debug.Log($"Name [{name.networkId}/{name.thingId}] {name.name}");
|
||||
//UnityEngine.Debug.Log($"Name [{name.networkId}/{name.thingId}] {name.name}");
|
||||
ProcessName(name);
|
||||
break;
|
||||
case ModelUrlMsg modelUrl:
|
||||
|
10
Messages.cs
10
Messages.cs
@ -171,6 +171,7 @@ namespace Passer.Control {
|
||||
|
||||
public static bool Send(Client client, byte networkId, byte thingId) {
|
||||
InvestigateMsg msg = new(networkId, thingId);
|
||||
//UnityEngine.Debug.Log($"Send investigate [{msg.networkId}/{msg.thingId}]");
|
||||
return SendMsg(client, msg);
|
||||
}
|
||||
public static async Task<bool> Receive(Stream dataStream, Client client, byte packetSize) {
|
||||
@ -179,6 +180,8 @@ namespace Passer.Control {
|
||||
|
||||
byte[] buffer = await Receive(dataStream, packetSize);
|
||||
InvestigateMsg msg = new(buffer);
|
||||
//UnityEngine.Debug.Log($"Receive investigate [{msg.networkId}/{msg.thingId}]");
|
||||
|
||||
client.messageQueue.Enqueue(msg);
|
||||
return true;
|
||||
|
||||
@ -198,6 +201,7 @@ namespace Passer.Control {
|
||||
public byte parentId;
|
||||
|
||||
public ThingMsg(byte networkId, byte thingId, byte thingType, byte parentId) {
|
||||
this.networkId = networkId;
|
||||
this.thingId = thingId;
|
||||
this.thingType = thingType;
|
||||
this.parentId = parentId;
|
||||
@ -222,8 +226,9 @@ namespace Passer.Control {
|
||||
this.parentId = buffer[ix];
|
||||
}
|
||||
|
||||
public static bool Send(Client client, byte thingId, byte thingType, byte parentId) {
|
||||
ThingMsg msg = new(client.networkId, thingId, thingType, parentId);
|
||||
public static bool Send(Client client, byte networkId, byte thingId, byte thingType, byte parentId) {
|
||||
ThingMsg msg = new(networkId, thingId, thingType, parentId);
|
||||
//UnityEngine.Debug.Log($"Send thing [{msg.networkId}/{msg.thingId}]");
|
||||
return SendMsg(client, msg);
|
||||
}
|
||||
public static async Task<bool> Receive(Stream dataStream, Client client, byte packetSize) {
|
||||
@ -232,6 +237,7 @@ namespace Passer.Control {
|
||||
|
||||
byte[] buffer = await Receive(dataStream, packetSize);
|
||||
ThingMsg msg = new(buffer);
|
||||
//UnityEngine.Debug.Log($"Receive thing [{msg.networkId}/{msg.thingId}]");
|
||||
|
||||
// Do no process poses with nwid == 0 (== local)
|
||||
//if (msg.networkId == 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user