Skip to content

Commit

Permalink
Merge pull request #241 from Kapim/devel
Browse files Browse the repository at this point in the history
Changed:
  • Loading branch information
Kapim authored May 31, 2022
2 parents 274d8b0 + f87c9f4 commit 55df2aa
Show file tree
Hide file tree
Showing 7 changed files with 1,393 additions and 290 deletions.
2 changes: 1 addition & 1 deletion arcor2_AREditor/Assets/BASE/Scripts/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public class GameManager : Singleton<GameManager> {
/// <summary>
/// Api version
/// </summary>
public const string ApiVersion = "0.19.0";
public const string ApiVersion = "0.20.0";
/// <summary>
/// List of projects metadata
/// </summary>
Expand Down
Binary file modified arcor2_AREditor/Assets/BASE/Scripts/Swagger/IO.Swagger.dll
Binary file not shown.
1,619 changes: 1,356 additions & 263 deletions arcor2_AREditor/Assets/BASE/Scripts/Swagger/IO.Swagger.xml

Large diffs are not rendered by default.

52 changes: 30 additions & 22 deletions arcor2_AREditor/Assets/BASE/Scripts/WebsocketManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public class WebsocketManager : Singleton<WebsocketManager> {
/// Websocket context
/// </summary>
private WebSocket websocket;

int counter = 0;
/// <summary>
/// Dictionary of unprocessed responses
/// </summary>
Expand Down Expand Up @@ -579,30 +581,37 @@ private void HandleStateBefore(string obj) {
try {

IO.Swagger.Model.ActionStateBefore actionStateBefore = JsonConvert.DeserializeObject<IO.Swagger.Model.ActionStateBefore>(obj);
if (!string.IsNullOrEmpty(actionStateBefore.Data.ActionId)) {
puck_id = actionStateBefore.Data.ActionId;

puck_id = actionStateBefore.Data.ActionId;

if (!ProjectManager.Instance.Valid) {
Debug.LogWarning("Project not yet loaded, ignoring current action");
GameManager.Instance.ActionRunningOnStartupId = puck_id;
return;
if (!ProjectManager.Instance.Valid) {
Debug.LogWarning("Project not yet loaded, ignoring current action");
GameManager.Instance.ActionRunningOnStartupId = puck_id;
return;
}
// Stop previously running action (change its color to default)
if (ActionsManager.Instance.CurrentlyRunningAction != null)
ActionsManager.Instance.CurrentlyRunningAction.StopAction();

Action puck = ProjectManager.Instance.GetAction(puck_id);
ActionsManager.Instance.CurrentlyRunningAction = puck;
// Run current action (set its color to running)
puck.RunAction();
} else {
if (ActionsManager.Instance.CurrentlyRunningAction != null)
ActionsManager.Instance.CurrentlyRunningAction.StopAction();
ActionsManager.Instance.CurrentlyRunningAction = null;
}



} catch (NullReferenceException e) {
Debug.Log("Parse error in HandleCurrentAction()");
return;
} catch (ItemNotFoundException e) {
Debug.LogError(e);
}
// Stop previously running action (change its color to default)
if (ActionsManager.Instance.CurrentlyRunningAction != null)
ActionsManager.Instance.CurrentlyRunningAction.StopAction();
try {
Action puck = ProjectManager.Instance.GetAction(puck_id);
ActionsManager.Instance.CurrentlyRunningAction = puck;
// Run current action (set its color to running)
puck.RunAction();
} catch (ItemNotFoundException ex) {
Debug.LogError(ex);
}

}

private void HandleActionStateAfter(string obj) {
Expand All @@ -613,11 +622,10 @@ private void HandleActionStateAfter(string obj) {
try {

IO.Swagger.Model.ActionStateAfter actionStateBefore = JsonConvert.DeserializeObject<IO.Swagger.Model.ActionStateAfter>(obj);

puck_id = actionStateBefore.Data.ActionId;



if (ActionsManager.Instance.CurrentlyRunningAction != null)
ActionsManager.Instance.CurrentlyRunningAction.StopAction();
ActionsManager.Instance.CurrentlyRunningAction = null;

} catch (NullReferenceException e) {
Debug.Log("Parse error in HandleCurrentAction()");
return;
Expand Down
Loading

0 comments on commit 55df2aa

Please sign in to comment.