Unit test fixes
This commit is contained in:
parent
68b0622a1f
commit
052620c0f0
@ -365,7 +365,7 @@ namespace RoboidControl {
|
|||||||
Console.WriteLine($"Participant: Process NameMsg [{msg.networkId}/{msg.thingId}] {msg.nameLength} {msg.name}");
|
Console.WriteLine($"Participant: Process NameMsg [{msg.networkId}/{msg.thingId}] {msg.nameLength} {msg.name}");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Thing thing = sender.Get(msg.networkId, msg.thingId);
|
Thing thing = sender.Get(msg.thingId);
|
||||||
if (thing != null)
|
if (thing != null)
|
||||||
thing.name = msg.name;
|
thing.name = msg.name;
|
||||||
}
|
}
|
||||||
@ -375,7 +375,7 @@ namespace RoboidControl {
|
|||||||
Console.WriteLine($"Participant: Process ModelUrlMsg [{msg.networkId}/{msg.thingId}] {msg.urlLength} {msg.url}");
|
Console.WriteLine($"Participant: Process ModelUrlMsg [{msg.networkId}/{msg.thingId}] {msg.urlLength} {msg.url}");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Thing thing = sender.Get(msg.networkId, msg.thingId);
|
Thing thing = sender.Get(msg.thingId);
|
||||||
if (thing != null)
|
if (thing != null)
|
||||||
thing.modelUrl = msg.url;
|
thing.modelUrl = msg.url;
|
||||||
}
|
}
|
||||||
@ -384,7 +384,7 @@ namespace RoboidControl {
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
Console.WriteLine($"Participant: Process PoseMsg [{msg.networkId}/{msg.thingId}] {msg.poseType}");
|
Console.WriteLine($"Participant: Process PoseMsg [{msg.networkId}/{msg.thingId}] {msg.poseType}");
|
||||||
#endif
|
#endif
|
||||||
Thing thing = sender.Get(msg.networkId, msg.thingId);
|
Thing thing = sender.Get(msg.thingId);
|
||||||
if (thing != null) {
|
if (thing != null) {
|
||||||
if ((msg.poseType & PoseMsg.Pose_Position) != 0)
|
if ((msg.poseType & PoseMsg.Pose_Position) != 0)
|
||||||
thing.position = msg.position;
|
thing.position = msg.position;
|
||||||
@ -405,7 +405,7 @@ namespace RoboidControl {
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
Console.WriteLine($"Participant: Process BinaryMsg [{msg.networkId}/{msg.thingId}] {msg.dataLength}");
|
Console.WriteLine($"Participant: Process BinaryMsg [{msg.networkId}/{msg.thingId}] {msg.dataLength}");
|
||||||
#endif
|
#endif
|
||||||
Thing thing = sender.Get(msg.networkId, msg.thingId);
|
Thing thing = sender.Get(msg.thingId);
|
||||||
thing?.ProcessBinary(msg.data);
|
thing?.ProcessBinary(msg.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,10 +420,12 @@ namespace RoboidControl {
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
Console.WriteLine($"Participant: Process Destroy Msg [{msg.networkId}/{msg.thingId}]");
|
Console.WriteLine($"Participant: Process Destroy Msg [{msg.networkId}/{msg.thingId}]");
|
||||||
#endif
|
#endif
|
||||||
Thing thing = sender.Get(msg.networkId, msg.thingId);
|
Thing thing = sender.Get(msg.thingId);
|
||||||
if (thing != null)
|
if (thing != null)
|
||||||
this.Remove(thing);
|
this.Remove(thing);
|
||||||
|
#if UNITY_5_3_OR_NEWER
|
||||||
thing.component.core = null;
|
thing.component.core = null;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ForwardMessage(IMessage msg) {
|
private void ForwardMessage(IMessage msg) {
|
||||||
|
@ -105,7 +105,7 @@ namespace RoboidControl {
|
|||||||
protected override void Process(Participant sender, ThingMsg msg) {
|
protected override void Process(Participant sender, ThingMsg msg) {
|
||||||
Console.WriteLine($"SiteServer: Process thing [{msg.networkId}/{msg.thingId}] {msg.thingType} {msg.parentId} ");
|
Console.WriteLine($"SiteServer: Process thing [{msg.networkId}/{msg.thingId}] {msg.thingType} {msg.parentId} ");
|
||||||
|
|
||||||
Thing thing = sender.Get(msg.networkId, msg.thingId);
|
Thing thing = sender.Get(msg.thingId);
|
||||||
if (thing == null) {
|
if (thing == null) {
|
||||||
switch (msg.thingType) {
|
switch (msg.thingType) {
|
||||||
case (byte)Thing.Type.TouchSensor:
|
case (byte)Thing.Type.TouchSensor:
|
||||||
@ -118,7 +118,7 @@ namespace RoboidControl {
|
|||||||
thing = new Thing(sender, msg.networkId, msg.thingId, msg.thingType);
|
thing = new Thing(sender, msg.networkId, msg.thingId, msg.thingType);
|
||||||
|
|
||||||
if (msg.parentId != 0) {
|
if (msg.parentId != 0) {
|
||||||
thing.parent = sender.Get(msg.networkId, msg.parentId);
|
thing.parent = sender.Get(msg.parentId);
|
||||||
if (thing.parent == null)
|
if (thing.parent == null)
|
||||||
Console.WriteLine($"Could not find parent [{msg.networkId}/{msg.parentId}]");
|
Console.WriteLine($"Could not find parent [{msg.networkId}/{msg.parentId}]");
|
||||||
}
|
}
|
||||||
|
@ -357,6 +357,8 @@ namespace RoboidControl {
|
|||||||
public static ulong GetTimeMs() {
|
public static ulong GetTimeMs() {
|
||||||
#if UNITY_5_3_OR_NEWER
|
#if UNITY_5_3_OR_NEWER
|
||||||
return (ulong)(UnityEngine.Time.time * 1000);
|
return (ulong)(UnityEngine.Time.time * 1000);
|
||||||
|
#else
|
||||||
|
return TimeManager.GetCurrentTimeMilliseconds();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,7 +367,7 @@ namespace RoboidControl {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="recursively">When true, this will Update the descendants recursively</param>
|
/// <param name="recursively">When true, this will Update the descendants recursively</param>
|
||||||
public void Update(bool recursively = false) {
|
public void Update(bool recursively = false) {
|
||||||
Update(TimeManager.GetCurrentTimeMilliseconds(), recursively);
|
Update(GetTimeMs(), recursively);
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user