|
|
@ -26,6 +26,9 @@ namespace CriticalPathAnalyzer.Client.Tool {
|
|
|
|
_logger = logger;
|
|
|
|
_logger = logger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Remove all highlights
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
public static void Clear() {
|
|
|
|
public static void Clear() {
|
|
|
|
PathHighlighter.RemoveHighlighting();
|
|
|
|
PathHighlighter.RemoveHighlighting();
|
|
|
|
Outliner.RemoveOutline(_startPegAddress);
|
|
|
|
Outliner.RemoveOutline(_startPegAddress);
|
|
|
@ -34,6 +37,10 @@ namespace CriticalPathAnalyzer.Client.Tool {
|
|
|
|
_endPegAddress = PegAddress.Empty;
|
|
|
|
_endPegAddress = PegAddress.Empty;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Cast a ray from the player's camera to find a peg or a wire the player is looking at.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <returns>The peg's address or peg address of an input in case of a wire</returns>
|
|
|
|
private static PegAddress RayCastPeg() {
|
|
|
|
private static PegAddress RayCastPeg() {
|
|
|
|
// Ray-cast into the world to find what the player is looking at
|
|
|
|
// Ray-cast into the world to find what the player is looking at
|
|
|
|
HitInfo hitInfo = PlayerCaster.CameraCast(Masks.Environment | Masks.Structure | Masks.Peg | Masks.Wire);
|
|
|
|
HitInfo hitInfo = PlayerCaster.CameraCast(Masks.Environment | Masks.Structure | Masks.Peg | Masks.Wire);
|
|
|
@ -58,6 +65,9 @@ namespace CriticalPathAnalyzer.Client.Tool {
|
|
|
|
return PegAddress.Empty;
|
|
|
|
return PegAddress.Empty;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Try to select the start of the path.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
public static void SelectPathStart() {
|
|
|
|
public static void SelectPathStart() {
|
|
|
|
_logger.Info("Analyze Path Start");
|
|
|
|
_logger.Info("Analyze Path Start");
|
|
|
|
PegAddress pegAddress = RayCastPeg();
|
|
|
|
PegAddress pegAddress = RayCastPeg();
|
|
|
@ -71,6 +81,9 @@ namespace CriticalPathAnalyzer.Client.Tool {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Try to select the end of the path.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
public static void SelectPathEnd() {
|
|
|
|
public static void SelectPathEnd() {
|
|
|
|
_logger.Info("Analyze Path End");
|
|
|
|
_logger.Info("Analyze Path End");
|
|
|
|
PegAddress pegAddress = RayCastPeg();
|
|
|
|
PegAddress pegAddress = RayCastPeg();
|
|
|
@ -84,6 +97,9 @@ namespace CriticalPathAnalyzer.Client.Tool {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Remove standard highlighting and only highlight clusters that form a loop.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
public static void DisplayLoop() {
|
|
|
|
public static void DisplayLoop() {
|
|
|
|
if (_response == null) {
|
|
|
|
if (_response == null) {
|
|
|
|
_logger.Error("Got no response - cannot display loop");
|
|
|
|
_logger.Error("Got no response - cannot display loop");
|
|
|
@ -94,6 +110,9 @@ namespace CriticalPathAnalyzer.Client.Tool {
|
|
|
|
PathHighlighter.HighlightWires(_response.LoopingClusters);
|
|
|
|
PathHighlighter.HighlightWires(_response.LoopingClusters);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Send a request to the server to analyze the path between the selected start and end pegs.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
private static void CalculateCriticalPath() {
|
|
|
|
private static void CalculateCriticalPath() {
|
|
|
|
if (_startPegAddress.IsEmpty() || _endPegAddress.IsEmpty()) {
|
|
|
|
if (_startPegAddress.IsEmpty() || _endPegAddress.IsEmpty()) {
|
|
|
|
_logger.Error("Invalid pegs");
|
|
|
|
_logger.Error("Invalid pegs");
|
|
|
@ -108,6 +127,11 @@ namespace CriticalPathAnalyzer.Client.Tool {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Handle incoming response packet from the server.
|
|
|
|
|
|
|
|
/// Highlight pegs and wires involved in the circuit with their color based on their delay from the start.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="response">The server's response packet</param>
|
|
|
|
public static void HandleResponse(AnalyzePathResponse response) {
|
|
|
|
public static void HandleResponse(AnalyzePathResponse response) {
|
|
|
|
if (_currentRequestGuid != response.RequestGuid) {
|
|
|
|
if (_currentRequestGuid != response.RequestGuid) {
|
|
|
|
// Not matching Guid, old or wrong request, discard.
|
|
|
|
// Not matching Guid, old or wrong request, discard.
|
|
|
|