ControlCore improvements
This commit is contained in:
parent
0f0fcfdfbf
commit
1d2da54a17
@ -47,13 +47,13 @@ namespace Passer.Control {
|
|||||||
ProcessNetworkId(networkId);
|
ProcessNetworkId(networkId);
|
||||||
break;
|
break;
|
||||||
case InvestigateMsg investigate:
|
case InvestigateMsg investigate:
|
||||||
UnityEngine.Debug.Log($"investigate [{investigate.networkId}/{investigate.thingId}]");
|
|
||||||
ProcessInvestigate(investigate);
|
ProcessInvestigate(investigate);
|
||||||
break;
|
break;
|
||||||
case ThingMsg thing:
|
case ThingMsg thing:
|
||||||
ProcessThing(thing);
|
ProcessThing(thing);
|
||||||
break;
|
break;
|
||||||
case NameMsg name:
|
case NameMsg name:
|
||||||
|
UnityEngine.Debug.Log($"Name [{name.networkId}/{name.thingId}] {name.name}");
|
||||||
ProcessName(name);
|
ProcessName(name);
|
||||||
break;
|
break;
|
||||||
case ModelUrlMsg modelUrl:
|
case ModelUrlMsg modelUrl:
|
||||||
@ -101,7 +101,7 @@ namespace Passer.Control {
|
|||||||
foreach (Client client in Client.clients) {
|
foreach (Client client in Client.clients) {
|
||||||
if (client == this)
|
if (client == this)
|
||||||
continue;
|
continue;
|
||||||
UnityEngine.Debug.Log($"---> {client.ipAddress}");
|
//UnityEngine.Debug.Log($"---> {client.ipAddress}");
|
||||||
IMessage.SendMsg(client, msg);
|
IMessage.SendMsg(client, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
12
Messages.cs
12
Messages.cs
@ -234,8 +234,8 @@ namespace Passer.Control {
|
|||||||
ThingMsg msg = new(buffer);
|
ThingMsg msg = new(buffer);
|
||||||
|
|
||||||
// Do no process poses with nwid == 0 (== local)
|
// Do no process poses with nwid == 0 (== local)
|
||||||
if (msg.networkId == 0)
|
//if (msg.networkId == 0)
|
||||||
return true;
|
// return true;
|
||||||
|
|
||||||
client.messageQueue.Enqueue(msg);
|
client.messageQueue.Enqueue(msg);
|
||||||
return true;
|
return true;
|
||||||
@ -280,8 +280,8 @@ namespace Passer.Control {
|
|||||||
this.name = System.Text.Encoding.UTF8.GetString(buffer, (int)ix, strlen);
|
this.name = System.Text.Encoding.UTF8.GetString(buffer, (int)ix, strlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool Send(Client client, byte thingId, string name) {
|
public static bool Send(Client client, byte networkId, byte thingId, string name) {
|
||||||
NameMsg msg = new(client.networkId, thingId, name);
|
NameMsg msg = new(networkId, thingId, name);
|
||||||
return SendMsg(client, msg);
|
return SendMsg(client, msg);
|
||||||
}
|
}
|
||||||
public static async Task<bool> Receive(Stream dataStream, Client client, byte packetSize) {
|
public static async Task<bool> Receive(Stream dataStream, Client client, byte packetSize) {
|
||||||
@ -336,8 +336,8 @@ namespace Passer.Control {
|
|||||||
url = System.Text.Encoding.UTF8.GetString(buffer, (int)ix, strlen);
|
url = System.Text.Encoding.UTF8.GetString(buffer, (int)ix, strlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool Send(Client client, byte thingId, string modelUrl) {
|
public static bool Send(Client client, byte networkId, byte thingId, string modelUrl) {
|
||||||
ModelUrlMsg msg = new(client.networkId, thingId, modelUrl);
|
ModelUrlMsg msg = new(networkId, thingId, modelUrl);
|
||||||
return SendMsg(client, msg);
|
return SendMsg(client, msg);
|
||||||
}
|
}
|
||||||
public static async Task<bool> Receive(Stream dataStream, Client client, byte packetSize) {
|
public static async Task<bool> Receive(Stream dataStream, Client client, byte packetSize) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user